mirror of
https://github.com/LukeHagar/developer.sailpoint.com.git
synced 2025-12-09 20:37:47 +00:00
adding Experimental back to createApiPageMD and fixing auth section
This commit is contained in:
@@ -73,6 +73,7 @@ export function createApiPageMD({
|
||||
frontMatter.show_extensions
|
||||
? createVendorExtensions(extensions)
|
||||
: undefined,
|
||||
createExperimentalNotice(parameters),
|
||||
createDeprecationNotice({ deprecated, description: deprecatedDescription }),
|
||||
createDescription(description),
|
||||
requestBody || parameters ? createRequestHeader("Request") : undefined,
|
||||
@@ -86,17 +87,6 @@ export function createApiPageMD({
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
function createDeprecation({ deprecated, description }: { deprecated?: boolean; description?: string }) {
|
||||
if (deprecated == true) {
|
||||
if (description !== undefined) {
|
||||
return `:::caution deprecated\n\n${description}\n\n:::`;
|
||||
} else {
|
||||
return `:::caution deprecated\n\nThis endpoint has been deprecated and may be replaced or removed in future versions of the API.\n\n:::`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function createExperimentalNotice(parameters){
|
||||
if (parameters && parameters.some(element => element.in === 'header' && element.name === 'X-SailPoint-Experimental')) {
|
||||
return ":::warning experimental\n\nThis API is currently in an experimental state. The API is subject to change based on feedback and further testing. You must include the X-SailPoint-Experimental header and set it to `true` to use this endpoint.\n\n:::\n\n";
|
||||
|
||||
@@ -8,6 +8,8 @@ function SecuritySchemes(props: any) {
|
||||
const selected = useTypedSelector((state: any) => state.auth.selected);
|
||||
const infoAuthPath = `/${props.infoPath}#authentication`;
|
||||
|
||||
console.log(props)
|
||||
|
||||
if (selected === undefined) return null;
|
||||
|
||||
if (options[selected]?.[0]?.type === undefined) {
|
||||
@@ -16,7 +18,7 @@ function SecuritySchemes(props: any) {
|
||||
|
||||
const selectedAuth = options[selected];
|
||||
return (
|
||||
<details className="openapi-security__details" open={false}>
|
||||
<details className="openapi-security__details" open={true}>
|
||||
<summary className="openapi-security__summary-container">
|
||||
<h4 className="openapi-security__summary-header">
|
||||
Authorization: {selectedAuth[0].name ?? selectedAuth[0].type}
|
||||
@@ -180,6 +182,7 @@ function SecuritySchemes(props: any) {
|
||||
}
|
||||
|
||||
if (isOauth2) {
|
||||
console.log(auth)
|
||||
const { name, key, type, scopes, flows, ...rest } = auth;
|
||||
return (
|
||||
<React.Fragment key={selected}>
|
||||
@@ -190,39 +193,46 @@ function SecuritySchemes(props: any) {
|
||||
background: "var(--openapi-card-background-color)",
|
||||
}}
|
||||
>
|
||||
<span>
|
||||
<strong>name:</strong>{" "}
|
||||
<Link to={infoAuthPath}>{name ?? key}</Link>
|
||||
</span>
|
||||
<span>
|
||||
<strong>type: </strong>
|
||||
{type}
|
||||
</span>
|
||||
{scopes && scopes.length > 0 && (
|
||||
<span>
|
||||
<strong>scopes: </strong>
|
||||
{props.item['security'] && props.item['security'].length > 0 && (
|
||||
<code>
|
||||
{auth.scopes.length > 0 ? auth.scopes.toString() : "[]"}
|
||||
{props.item['security'].map((sec: any, index: number) => {
|
||||
const key = Object.keys(sec)[0];
|
||||
const securityScheme = props.item['securitySchemes']?.[key];
|
||||
return (
|
||||
<div key={key}>
|
||||
<strong>type: </strong>
|
||||
{securityScheme ? (
|
||||
<Link to={infoAuthPath}>
|
||||
{securityScheme['x-displayName']}
|
||||
</Link>
|
||||
) : (
|
||||
<Link to={infoAuthPath}>{key}</Link> // Fallback to key if no displayName found
|
||||
)}
|
||||
{scopes && scopes.length > 0 && (
|
||||
<div>
|
||||
<span>
|
||||
<strong>scopes: </strong>
|
||||
<code>
|
||||
{auth.scopes.length > 0 ? auth.scopes.join(', ') : "[]"}
|
||||
</code>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{props.item['x-sailpoint-userLevels'] && props.item['x-sailpoint-userLevels'].length > 0 && key !== 'applicationAuth' && (
|
||||
<div>
|
||||
<span>
|
||||
<strong>user levels: </strong>
|
||||
<code>
|
||||
{props.item['x-sailpoint-userLevels'].length > 0 ? props.item['x-sailpoint-userLevels'].join(', ') : "[]"}
|
||||
</code>
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
{index < props.item['security'].length - 1 && (<hr></hr>) }
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</code>
|
||||
</span>
|
||||
)}
|
||||
{Object.keys(rest).map((k, i) => {
|
||||
return (
|
||||
<span key={k}>
|
||||
<strong>{k}: </strong>
|
||||
{typeof rest[k] === "object"
|
||||
? JSON.stringify(rest[k], null, 2)
|
||||
: String(rest[k])}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
{flows && (
|
||||
<span>
|
||||
<code>
|
||||
<strong>flows: </strong>
|
||||
{JSON.stringify(flows, null, 2)}
|
||||
</code>
|
||||
</span>
|
||||
)}
|
||||
</pre>
|
||||
</React.Fragment>
|
||||
@@ -277,4 +287,4 @@ function SecuritySchemes(props: any) {
|
||||
);
|
||||
}
|
||||
|
||||
export default SecuritySchemes;
|
||||
export default SecuritySchemes;
|
||||
Reference in New Issue
Block a user