Update 217 files

This commit is contained in:
Amin Rahimi 2023-06-08 22:14:33 +00:00
parent eff730bada
commit fb55aa5456
27 changed files with 8682 additions and 8650 deletions

4
.gitignore vendored
View File

@ -19,12 +19,12 @@ npm-debug.log*
# Dependency directory # Dependency directory
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
node_modules # node_modules
lib/ lib/
stats.json stats.json
cypress/ cypress/
bundles/ # bundles/
typings/* typings/*
!typings/styled-patch.d.ts !typings/styled-patch.d.ts

View File

@ -73,7 +73,7 @@ export class SectionItem extends React.Component<ContentItemProps> {
<> <>
<Row> <Row>
<MiddlePanel compact={false}> <MiddlePanel compact={false}>
<Header> <Header className="sar-header">
<ShareLink to={this.props.item.id} /> <ShareLink to={this.props.item.id} />
{name} {name}
</Header> </Header>

View File

@ -65,7 +65,9 @@ export class Field extends React.Component<FieldProps> {
const paramName = withSubSchema ? ( const paramName = withSubSchema ? (
<ClickablePropertyNameCell <ClickablePropertyNameCell
className={deprecated ? 'deprecated' : ''} className={
deprecated ? 'deprecated ClickablePropertyNameCell' : 'ClickablePropertyNameCell'
}
kind={kind} kind={kind}
title={name} title={name}
> >
@ -92,12 +94,12 @@ export class Field extends React.Component<FieldProps> {
<> <>
<tr className={isLast ? 'last ' + className : className}> <tr className={isLast ? 'last ' + className : className}>
{paramName} {paramName}
<PropertyDetailsCell> <PropertyDetailsCell className={'PropertyDetailsCell ' + field.name}>
<FieldDetails {...this.props} /> <FieldDetails {...this.props} className="FieldDetails" />
</PropertyDetailsCell> </PropertyDetailsCell>
</tr> </tr>
{expanded && withSubSchema && ( {expanded && withSubSchema && (
<tr key={field.name + 'inner'}> <tr key={field.name + 'inner'} className="sar-tr">
<PropertyCellWithInner colSpan={2}> <PropertyCellWithInner colSpan={2}>
<InnerPropertiesWrap> <InnerPropertiesWrap>
<Schema <Schema

View File

@ -14,7 +14,10 @@ export class ConstraintsView extends React.PureComponent<ConstraintsViewProps> {
<span> <span>
{' '} {' '}
{this.props.constraints.map(constraint => ( {this.props.constraints.map(constraint => (
<ConstraintItem key={constraint}> {constraint} </ConstraintItem> <ConstraintItem key={constraint} className="sar-ConstraintItem">
{' '}
{constraint}{' '}
</ConstraintItem>
))} ))}
</span> </span>
); );

View File

@ -16,7 +16,8 @@ function FieldDetailComponent({ value, label, raw }: FieldDetailProps) {
return ( return (
<div> <div>
<FieldLabel> {label} </FieldLabel> <ExampleValue>{stringifyValue}</ExampleValue> <FieldLabel> {label} </FieldLabel>{' '}
<ExampleValue className="sar-ExampleValue">{stringifyValue}</ExampleValue>
</div> </div>
); );
} }

View File

@ -29,7 +29,15 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
const { enumSkipQuotes, hideSchemaTitles } = React.useContext(OptionsContext); const { enumSkipQuotes, hideSchemaTitles } = React.useContext(OptionsContext);
const { showExamples, field, renderDiscriminatorSwitch } = props; const { showExamples, field, renderDiscriminatorSwitch } = props;
const { schema, description, deprecated, extensions, in: _in, const: _const } = field; const {
schema,
description,
descriptionClass,
deprecated,
extensions,
in: _in,
const: _const,
} = field;
const isArrayType = schema.type === 'array'; const isArrayType = schema.type === 'array';
const rawDefault = enumSkipQuotes || _in === 'header'; // having quotes around header field default values is confusing and inappropriate const rawDefault = enumSkipQuotes || _in === 'header'; // having quotes around header field default values is confusing and inappropriate
@ -57,10 +65,10 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
: schema.default; : schema.default;
return ( return (
<div> <div className="FieldDetailsDiv">
<div> <div className="FieldDetailsDiv__childDiv1">
<TypePrefix>{schema.typePrefix}</TypePrefix> <TypePrefix>{schema.typePrefix}</TypePrefix>
<TypeName>{schema.displayType}</TypeName> <TypeName className="sar-TypeName">{schema.displayType}</TypeName>
{schema.displayFormat && ( {schema.displayFormat && (
<TypeFormat> <TypeFormat>
{' '} {' '}
@ -96,20 +104,29 @@ export const FieldDetailsComponent = observer((props: FieldProps) => {
<Badge type="warning"> {l('deprecated')} </Badge> <Badge type="warning"> {l('deprecated')} </Badge>
</div> </div>
)} )}
<FieldDetail raw={rawDefault} label={l('default') + ':'} value={defaultValue} /> <div className="FieldDetailsDiv__childDiv2">
{!renderDiscriminatorSwitch && ( <FieldDetail raw={rawDefault} label={l('default') + ':'} value={defaultValue} />
<EnumValues isArrayType={isArrayType} values={schema.enum} /> </div>
)}{' '}
{renderedExamples} <div className="FieldDetailsDiv__childDiv3">
<Extensions extensions={{ ...extensions, ...schema.extensions }} /> {!renderDiscriminatorSwitch && (
<div> <EnumValues isArrayType={isArrayType} values={schema.enum} />
)}{' '}
{renderedExamples}
</div>
<div className="FieldDetailsDiv__childDiv4">
<Extensions extensions={{ ...extensions, ...schema.extensions }} />
</div>
<div className={descriptionClass + ' FieldDetailsDiv__description'}>
<Markdown compact={true} source={description} /> <Markdown compact={true} source={description} />
</div> </div>
{schema.externalDocs && ( <div className="FieldDetailsDiv__childDiv6">
<ExternalDocumentation externalDocs={schema.externalDocs} compact={true} /> {schema.externalDocs && (
)} <ExternalDocumentation externalDocs={schema.externalDocs} compact={true} />
{(renderDiscriminatorSwitch && renderDiscriminatorSwitch(props)) || null} )}
{(_const && <FieldDetail label={l('const') + ':'} value={_const} />) || null} {(renderDiscriminatorSwitch && renderDiscriminatorSwitch(props)) || null}
{(_const && <FieldDetail label={l('const') + ':'} value={_const} />) || null}
</div>
</div> </div>
); );
}); });

View File

@ -10,7 +10,17 @@ export interface ResponseViewProps {
} }
export const ResponseView = observer(({ response }: ResponseViewProps): React.ReactElement => { export const ResponseView = observer(({ response }: ResponseViewProps): React.ReactElement => {
const { extensions, headers, type, summary, description, code, expanded, content } = response; const {
extensions,
headers,
type,
summary,
description,
descriptionClass,
code,
expanded,
content,
} = response;
const mimes = React.useMemo<MediaTypeModel[]>( const mimes = React.useMemo<MediaTypeModel[]>(
() => () =>
@ -29,14 +39,17 @@ export const ResponseView = observer(({ response }: ResponseViewProps): React.Re
return ( return (
<div> <div>
<StyledResponseTitle <span className="StyledResponseTitle">
onClick={() => response.toggle()} <StyledResponseTitle
type={type} onClick={() => response.toggle()}
empty={empty} type={type}
title={summary || ''} empty={empty}
code={code} title={summary || ''}
opened={expanded} descriptionClass={descriptionClass}
/> code={code}
opened={expanded}
/>
</span>
{expanded && !empty && ( {expanded && !empty && (
<ResponseDetailsWrap> <ResponseDetailsWrap>
<ResponseDetails response={response} /> <ResponseDetails response={response} />

View File

@ -14,10 +14,12 @@ import { ConstraintsView } from '../Fields/FieldContstraints';
export class ResponseDetails extends React.PureComponent<{ response: ResponseModel }> { export class ResponseDetails extends React.PureComponent<{ response: ResponseModel }> {
render() { render() {
const { description, extensions, headers, content } = this.props.response; const { description, descriptionClass, extensions, headers, content } = this.props.response;
return ( return (
<> <>
{description && <Markdown source={description} />} <span className={descriptionClass + ' ResponseDetails__description'}>
{description && <Markdown source={description} />}
</span>
<Extensions extensions={extensions} /> <Extensions extensions={extensions} />
<ResponseHeaders headers={headers} /> <ResponseHeaders headers={headers} />
<MediaTypesSwitch content={content} renderDropdown={this.renderDropdown}> <MediaTypesSwitch content={content} renderDropdown={this.renderDropdown}>

View File

@ -8,6 +8,7 @@ export interface ResponseTitleProps {
code: string; code: string;
title: string; title: string;
type: string; type: string;
descriptionClass?: string;
empty?: boolean; empty?: boolean;
opened?: boolean; opened?: boolean;
className?: string; className?: string;
@ -19,6 +20,7 @@ function ResponseTitleComponent({
type, type,
empty, empty,
code, code,
descriptionClass,
opened, opened,
className, className,
onClick, onClick,
@ -39,7 +41,9 @@ function ResponseTitleComponent({
/> />
)} )}
<Code>{code} </Code> <Code>{code} </Code>
<Markdown compact={true} inline={true} source={title} /> <div className={descriptionClass + ' ResponseTitleComponent__Markdown'}>
<Markdown compact={true} inline={true} source={title} />
</div>
</button> </button>
); );
} }

View File

@ -26,7 +26,7 @@ export class ResponsesList extends React.PureComponent<ResponseListProps> {
} }
return ( return (
<div> <div className="ResponsesList">
<ResponsesHeader>{isCallback ? l('callbackResponses') : l('responses')}</ResponsesHeader> <ResponsesHeader>{isCallback ? l('callbackResponses') : l('responses')}</ResponsesHeader>
{responses.map(response => { {responses.map(response => {
return <ResponseView key={response.code} response={response} />; return <ResponseView key={response.code} response={response} />;

View File

@ -1,53 +1,53 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = ` exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = `
<div> <div>
<span <span
class="sc-kfYoZR juYXUf" class="sc-kfYoZR juYXUf"
> >
One of One of
</span> </span>
<div <div
class="sc-dlMDgC EoFth" class="sc-dlMDgC EoFth"
> >
<button <button
class="sc-fKgJPI iEPbLk" class="sc-fKgJPI iEPbLk"
> >
string string
</button> </button>
<button <button
class="sc-fKgJPI bpjiHN" class="sc-fKgJPI bpjiHN"
> >
integer integer
</button> </button>
</div> </div>
<div> <div>
<span <span
class="sc-bqGGPW eSYQnm" class="sc-bqGGPW eSYQnm"
type="warning" type="warning"
> >
Deprecated Deprecated
</span> </span>
</div> </div>
<div> <div>
<div> <div>
<div> <div>
<span <span
class="sc-laZMeE sc-iNiQyp jWaWWE jrLlAa" class="sc-laZMeE sc-iNiQyp jWaWWE jrLlAa"
/> />
<span <span
class="sc-laZMeE sc-jffHpj jWaWWE cThoNa" class="sc-laZMeE sc-jffHpj jWaWWE cThoNa"
> >
string string
</span> </span>
</div> </div>
<div> <div>
<div <div
class="sc-iJCRrE sc-ciSkZP jCdxGr lhENGb" class="sc-iJCRrE sc-ciSkZP jCdxGr lhENGb"
/> />
</div> </div>
</div> </div>
</div> </div>
</div> </div>
`; `;

View File

@ -1,23 +1,23 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`SecurityRequirement should render SecurityDefs 1`] = ` exports[`SecurityRequirement should render SecurityDefs 1`] = `
"<div id=\\"section/Authentication/petstore_auth\\" data-section-id=\\"section/Authentication/petstore_auth\\" class=\\"sc-eCApnc jlMQbh\\"><div class=\\"sc-iCoGMd gLxhOh\\"><div class=\\"sc-hKFxyN juinod\\"><h2 class=\\"sc-pNWdM eftmgB\\">petstore_auth</h2><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>Get access to data while protecting your account credentials. "<div id=\\"section/Authentication/petstore_auth\\" data-section-id=\\"section/Authentication/petstore_auth\\" class=\\"sc-eCApnc jlMQbh\\"><div class=\\"sc-iCoGMd gLxhOh\\"><div class=\\"sc-hKFxyN juinod\\"><h2 class=\\"sc-pNWdM eftmgB\\">petstore_auth</h2><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.</p> OAuth2 is also a safer and more secure way to give you access.</p>
</div><div class=\\"sc-eEVmNe lmbHgE\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Security Scheme Type: </b><span>OAuth2</span></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Flow type: </b><code>implicit </code></div><div class=\\"sc-jXcxbT gllWlr\\"><strong> Authorization URL: </strong><code><a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"http://petstore.swagger.io/api/oauth/dialog\\">http://petstore.swagger.io/api/oauth/dialog</a></code></div><div class=\\"sc-jXcxbT gllWlr\\"><b> Scopes: </b></div><div class=\\"sc-fmdNqN eKoRDV container\\" style=\\"height: 4em;\\"><ul><li><code>write:pets</code> - <span class=\\"sc-carFqZ bmTzxo redoc-markdown\\"><p>modify pets in your account</p> </div><div class=\\"sc-eEVmNe lmbHgE\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Security Scheme Type: </b><span>OAuth2</span></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Flow type: </b><code>implicit </code></div><div class=\\"sc-jXcxbT gllWlr\\"><strong> Authorization URL: </strong><code><a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"http://petstore.swagger.io/api/oauth/dialog\\">http://petstore.swagger.io/api/oauth/dialog</a></code></div><div class=\\"sc-jXcxbT gllWlr\\"><b> Scopes: </b></div><div class=\\"sc-fmdNqN eKoRDV container\\" style=\\"height: 4em;\\"><ul><li><code>write:pets</code> - <span class=\\"sc-carFqZ bmTzxo redoc-markdown\\"><p>modify pets in your account</p>
</span></li><li><code>read:pets</code> - <span class=\\"sc-carFqZ bmTzxo redoc-markdown\\"><p>read your pets</p> </span></li><li><code>read:pets</code> - <span class=\\"sc-carFqZ bmTzxo redoc-markdown\\"><p>read your pets</p>
</span></li></ul></div><div class=\\"sc-ljsmAU blhEdv\\"></div></div></div></div></div></div><div id=\\"section/Authentication/GitLab_PersonalAccessToken\\" data-section-id=\\"section/Authentication/GitLab_PersonalAccessToken\\" class=\\"sc-eCApnc jlMQbh\\"><div class=\\"sc-iCoGMd gLxhOh\\"><div class=\\"sc-hKFxyN juinod\\"><h2 class=\\"sc-pNWdM eftmgB\\">GitLab_PersonalAccessToken</h2><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>GitLab Personal Access Token description</p> </span></li></ul></div><div class=\\"sc-ljsmAU blhEdv\\"></div></div></div></div></div></div><div id=\\"section/Authentication/GitLab_PersonalAccessToken\\" data-section-id=\\"section/Authentication/GitLab_PersonalAccessToken\\" class=\\"sc-eCApnc jlMQbh\\"><div class=\\"sc-iCoGMd gLxhOh\\"><div class=\\"sc-hKFxyN juinod\\"><h2 class=\\"sc-pNWdM eftmgB\\">GitLab_PersonalAccessToken</h2><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>GitLab Personal Access Token description</p>
</div><div class=\\"sc-eEVmNe lmbHgE\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Security Scheme Type: </b><span>API Key</span></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Header parameter name: </b><code>PRIVATE-TOKEN</code></div></div></div></div></div></div><div id=\\"section/Authentication/GitLab_OpenIdConnect\\" data-section-id=\\"section/Authentication/GitLab_OpenIdConnect\\" class=\\"sc-eCApnc jlMQbh\\"><div class=\\"sc-iCoGMd gLxhOh\\"><div class=\\"sc-hKFxyN juinod\\"><h2 class=\\"sc-pNWdM eftmgB\\">GitLab_OpenIdConnect</h2><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>GitLab OpenIdConnect description</p> </div><div class=\\"sc-eEVmNe lmbHgE\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Security Scheme Type: </b><span>API Key</span></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Header parameter name: </b><code>PRIVATE-TOKEN</code></div></div></div></div></div></div><div id=\\"section/Authentication/GitLab_OpenIdConnect\\" data-section-id=\\"section/Authentication/GitLab_OpenIdConnect\\" class=\\"sc-eCApnc jlMQbh\\"><div class=\\"sc-iCoGMd gLxhOh\\"><div class=\\"sc-hKFxyN juinod\\"><h2 class=\\"sc-pNWdM eftmgB\\">GitLab_OpenIdConnect</h2><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>GitLab OpenIdConnect description</p>
</div><div class=\\"sc-eEVmNe lmbHgE\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Security Scheme Type: </b><span>OpenID Connect</span></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Connect URL: </b><code><a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"https://gitlab.com/.well-known/openid-configuration\\">https://gitlab.com/.well-known/openid-configuration</a></code></div></div></div></div></div></div><div id=\\"section/Authentication/basicAuth\\" data-section-id=\\"section/Authentication/basicAuth\\" class=\\"sc-eCApnc jlMQbh\\"><div class=\\"sc-iCoGMd gLxhOh\\"><div class=\\"sc-hKFxyN juinod\\"><h2 class=\\"sc-pNWdM eftmgB\\">basicAuth</h2><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"></div><div class=\\"sc-eEVmNe lmbHgE\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Security Scheme Type: </b><span>HTTP</span></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>HTTP Authorization Scheme: </b><code>basic</code></div><div class=\\"sc-jXcxbT gllWlr\\"></div></div></div></div></div></div>" </div><div class=\\"sc-eEVmNe lmbHgE\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Security Scheme Type: </b><span>OpenID Connect</span></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Connect URL: </b><code><a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"https://gitlab.com/.well-known/openid-configuration\\">https://gitlab.com/.well-known/openid-configuration</a></code></div></div></div></div></div></div><div id=\\"section/Authentication/basicAuth\\" data-section-id=\\"section/Authentication/basicAuth\\" class=\\"sc-eCApnc jlMQbh\\"><div class=\\"sc-iCoGMd gLxhOh\\"><div class=\\"sc-hKFxyN juinod\\"><h2 class=\\"sc-pNWdM eftmgB\\">basicAuth</h2><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"></div><div class=\\"sc-eEVmNe lmbHgE\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Security Scheme Type: </b><span>HTTP</span></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>HTTP Authorization Scheme: </b><code>basic</code></div><div class=\\"sc-jXcxbT gllWlr\\"></div></div></div></div></div></div>"
`; `;
exports[`SecurityRequirement should render authDefinition 1`] = `"<div class=\\"sc-EZqKI eriJMk\\"><div class=\\"sc-jHcXXw kurgNF\\"><h5 class=\\"sc-iqAclL sc-fXgAZx eONCmm xiVXt\\">Authorizations:</h5><svg class=\\"sc-dIsUp iPqByX\\" version=\\"1.1\\" viewBox=\\"0 0 24 24\\" x=\\"0\\" xmlns=\\"http://www.w3.org/2000/svg\\" y=\\"0\\" aria-hidden=\\"true\\"><polygon points=\\"17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 \\"></polygon></svg></div><div class=\\"sc-bQCEYZ cCwYjG\\"><span class=\\"sc-dWBRfb hoKBYz\\">(<span class=\\"sc-xGAEC bCFTJj\\">API Key: <i>GitLab_PersonalAccessToken</i></span><span class=\\"sc-xGAEC bCFTJj\\">OpenID Connect: <i>GitLab_OpenIdConnect</i></span><span class=\\"sc-xGAEC bCFTJj\\">HTTP: <i>basicAuth</i></span>) </span><span class=\\"sc-dWBRfb hoKBYz\\"><span class=\\"sc-xGAEC bCFTJj\\">OAuth2: <i>petstore_auth</i></span></span></div></div>,"`; exports[`SecurityRequirement should render authDefinition 1`] = `"<div class=\\"sc-EZqKI eriJMk\\"><div class=\\"sc-jHcXXw kurgNF\\"><h5 class=\\"sc-iqAclL sc-fXgAZx eONCmm xiVXt\\">Authorizations:</h5><svg class=\\"sc-dIsUp iPqByX\\" version=\\"1.1\\" viewBox=\\"0 0 24 24\\" x=\\"0\\" xmlns=\\"http://www.w3.org/2000/svg\\" y=\\"0\\" aria-hidden=\\"true\\"><polygon points=\\"17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 \\"></polygon></svg></div><div class=\\"sc-bQCEYZ cCwYjG\\"><span class=\\"sc-dWBRfb hoKBYz\\">(<span class=\\"sc-xGAEC bCFTJj\\">API Key: <i>GitLab_PersonalAccessToken</i></span><span class=\\"sc-xGAEC bCFTJj\\">OpenID Connect: <i>GitLab_OpenIdConnect</i></span><span class=\\"sc-xGAEC bCFTJj\\">HTTP: <i>basicAuth</i></span>) </span><span class=\\"sc-dWBRfb hoKBYz\\"><span class=\\"sc-xGAEC bCFTJj\\">OAuth2: <i>petstore_auth</i></span></span></div></div>,"`;
exports[`SecurityRequirement should render authDefinition 2`] = ` exports[`SecurityRequirement should render authDefinition 2`] = `
"<div class=\\"sc-EZqKI hSmRqE\\"><div class=\\"sc-jHcXXw kurgNF\\"><h5 class=\\"sc-iqAclL sc-fXgAZx eONCmm xiVXt\\">Authorizations:</h5><svg class=\\"sc-dIsUp fVWtGJ\\" version=\\"1.1\\" viewBox=\\"0 0 24 24\\" x=\\"0\\" xmlns=\\"http://www.w3.org/2000/svg\\" y=\\"0\\" aria-hidden=\\"true\\"><polygon points=\\"17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 \\"></polygon></svg></div><div class=\\"sc-bQCEYZ gvMhNy\\"><span class=\\"sc-dWBRfb eLEzSd\\">(<span class=\\"sc-xGAEC bCFTJj\\">API Key: <i>GitLab_PersonalAccessToken</i></span><span class=\\"sc-xGAEC bCFTJj\\">OpenID Connect: <i>GitLab_OpenIdConnect</i></span><span class=\\"sc-xGAEC bCFTJj\\">HTTP: <i>basicAuth</i></span>) </span><span class=\\"sc-dWBRfb eLEzSd\\"><span class=\\"sc-xGAEC bCFTJj\\">OAuth2: <i>petstore_auth</i> (<code class=\\"sc-kYPZxB beMTTe\\">write:pets</code><code class=\\"sc-kYPZxB beMTTe\\">read:pets</code>) </span></span></div></div><div class=\\"sc-eEVmNe lmbHgE\\"><h5><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"11\\" height=\\"11\\"><path fill=\\"currentColor\\" d=\\"M18 10V6A6 6 0 0 0 6 6v4H3v14h18V10h-3zM8 6c0-2.206 1.794-4 4-4s4 1.794 4 4v4H8V6zm11 16H5V12h14v10z\\"></path></svg> OAuth2: petstore_auth</h5><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>Get access to data while protecting your account credentials. "<div class=\\"sc-EZqKI hSmRqE\\"><div class=\\"sc-jHcXXw kurgNF\\"><h5 class=\\"sc-iqAclL sc-fXgAZx eONCmm xiVXt\\">Authorizations:</h5><svg class=\\"sc-dIsUp fVWtGJ\\" version=\\"1.1\\" viewBox=\\"0 0 24 24\\" x=\\"0\\" xmlns=\\"http://www.w3.org/2000/svg\\" y=\\"0\\" aria-hidden=\\"true\\"><polygon points=\\"17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 \\"></polygon></svg></div><div class=\\"sc-bQCEYZ gvMhNy\\"><span class=\\"sc-dWBRfb eLEzSd\\">(<span class=\\"sc-xGAEC bCFTJj\\">API Key: <i>GitLab_PersonalAccessToken</i></span><span class=\\"sc-xGAEC bCFTJj\\">OpenID Connect: <i>GitLab_OpenIdConnect</i></span><span class=\\"sc-xGAEC bCFTJj\\">HTTP: <i>basicAuth</i></span>) </span><span class=\\"sc-dWBRfb eLEzSd\\"><span class=\\"sc-xGAEC bCFTJj\\">OAuth2: <i>petstore_auth</i> (<code class=\\"sc-kYPZxB beMTTe\\">write:pets</code><code class=\\"sc-kYPZxB beMTTe\\">read:pets</code>) </span></span></div></div><div class=\\"sc-eEVmNe lmbHgE\\"><h5><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"11\\" height=\\"11\\"><path fill=\\"currentColor\\" d=\\"M18 10V6A6 6 0 0 0 6 6v4H3v14h18V10h-3zM8 6c0-2.206 1.794-4 4-4s4 1.794 4 4v4H8V6zm11 16H5V12h14v10z\\"></path></svg> OAuth2: petstore_auth</h5><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.</p> OAuth2 is also a safer and more secure way to give you access.</p>
</div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Flow type: </b><code>implicit </code></div><div class=\\"sc-jXcxbT gllWlr\\"><strong> Authorization URL: </strong><code><a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"http://petstore.swagger.io/api/oauth/dialog\\">http://petstore.swagger.io/api/oauth/dialog</a></code></div><div><b>Required scopes: </b><code>write:pets</code> <code>read:pets</code> </div><div class=\\"sc-jXcxbT gllWlr\\"><b> Scopes: </b></div><div class=\\"sc-fmdNqN eKoRDV container\\" style=\\"height: 4em;\\"><ul><li><code>write:pets</code> - <span class=\\"sc-carFqZ bmTzxo redoc-markdown\\"><p>modify pets in your account</p> </div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Flow type: </b><code>implicit </code></div><div class=\\"sc-jXcxbT gllWlr\\"><strong> Authorization URL: </strong><code><a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"http://petstore.swagger.io/api/oauth/dialog\\">http://petstore.swagger.io/api/oauth/dialog</a></code></div><div><b>Required scopes: </b><code>write:pets</code> <code>read:pets</code> </div><div class=\\"sc-jXcxbT gllWlr\\"><b> Scopes: </b></div><div class=\\"sc-fmdNqN eKoRDV container\\" style=\\"height: 4em;\\"><ul><li><code>write:pets</code> - <span class=\\"sc-carFqZ bmTzxo redoc-markdown\\"><p>modify pets in your account</p>
</span></li><li><code>read:pets</code> - <span class=\\"sc-carFqZ bmTzxo redoc-markdown\\"><p>read your pets</p> </span></li><li><code>read:pets</code> - <span class=\\"sc-carFqZ bmTzxo redoc-markdown\\"><p>read your pets</p>
</span></li></ul></div><div class=\\"sc-ljsmAU blhEdv\\"></div></div></div><div class=\\"sc-eEVmNe lmbHgE\\"><h5><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"11\\" height=\\"11\\"><path fill=\\"currentColor\\" d=\\"M18 10V6A6 6 0 0 0 6 6v4H3v14h18V10h-3zM8 6c0-2.206 1.794-4 4-4s4 1.794 4 4v4H8V6zm11 16H5V12h14v10z\\"></path></svg> API Key: GitLab_PersonalAccessToken</h5><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>GitLab Personal Access Token description</p> </span></li></ul></div><div class=\\"sc-ljsmAU blhEdv\\"></div></div></div><div class=\\"sc-eEVmNe lmbHgE\\"><h5><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"11\\" height=\\"11\\"><path fill=\\"currentColor\\" d=\\"M18 10V6A6 6 0 0 0 6 6v4H3v14h18V10h-3zM8 6c0-2.206 1.794-4 4-4s4 1.794 4 4v4H8V6zm11 16H5V12h14v10z\\"></path></svg> API Key: GitLab_PersonalAccessToken</h5><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>GitLab Personal Access Token description</p>
</div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Header parameter name: </b><code>PRIVATE-TOKEN</code></div></div></div><div class=\\"sc-eEVmNe lmbHgE\\"><h5><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"11\\" height=\\"11\\"><path fill=\\"currentColor\\" d=\\"M18 10V6A6 6 0 0 0 6 6v4H3v14h18V10h-3zM8 6c0-2.206 1.794-4 4-4s4 1.794 4 4v4H8V6zm11 16H5V12h14v10z\\"></path></svg> OpenID Connect: GitLab_OpenIdConnect</h5><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>GitLab OpenIdConnect description</p> </div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Header parameter name: </b><code>PRIVATE-TOKEN</code></div></div></div><div class=\\"sc-eEVmNe lmbHgE\\"><h5><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"11\\" height=\\"11\\"><path fill=\\"currentColor\\" d=\\"M18 10V6A6 6 0 0 0 6 6v4H3v14h18V10h-3zM8 6c0-2.206 1.794-4 4-4s4 1.794 4 4v4H8V6zm11 16H5V12h14v10z\\"></path></svg> OpenID Connect: GitLab_OpenIdConnect</h5><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><p>GitLab OpenIdConnect description</p>
</div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Connect URL: </b><code><a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"https://gitlab.com/.well-known/openid-configuration\\">https://gitlab.com/.well-known/openid-configuration</a></code></div></div></div><div class=\\"sc-eEVmNe lmbHgE\\"><h5><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"11\\" height=\\"11\\"><path fill=\\"currentColor\\" d=\\"M18 10V6A6 6 0 0 0 6 6v4H3v14h18V10h-3zM8 6c0-2.206 1.794-4 4-4s4 1.794 4 4v4H8V6zm11 16H5V12h14v10z\\"></path></svg> HTTP: basicAuth</h5><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>HTTP Authorization Scheme: </b><code>basic</code></div><div class=\\"sc-jXcxbT gllWlr\\"></div></div></div>," </div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>Connect URL: </b><code><a target=\\"_blank\\" rel=\\"noopener noreferrer\\" href=\\"https://gitlab.com/.well-known/openid-configuration\\">https://gitlab.com/.well-known/openid-configuration</a></code></div></div></div><div class=\\"sc-eEVmNe lmbHgE\\"><h5><svg xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" width=\\"11\\" height=\\"11\\"><path fill=\\"currentColor\\" d=\\"M18 10V6A6 6 0 0 0 6 6v4H3v14h18V10h-3zM8 6c0-2.206 1.794-4 4-4s4 1.794 4 4v4H8V6zm11 16H5V12h14v10z\\"></path></svg> HTTP: basicAuth</h5><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"></div><div class=\\"sc-iJCRrE sc-ciSkZP jCdxGr QGruV\\"><div class=\\"sc-jXcxbT gllWlr\\"><b>HTTP Authorization Scheme: </b><code>basic</code></div><div class=\\"sc-jXcxbT gllWlr\\"></div></div></div>,"
`; `;

View File

@ -22,21 +22,14 @@
"type": { "type": {
"type": "string", "type": "string",
"description": "The type of response.", "description": "The type of response.",
"enum": [ "enum": ["TestResponse.Complete"]
"TestResponse.Complete"
]
}, },
"status": { "status": {
"type": "string", "type": "string",
"enum": [ "enum": ["FAILURE", "SUCCESS"]
"FAILURE",
"SUCCESS"
]
} }
}, },
"required": [ "required": ["status"]
"status"
]
} }
} }
} }
@ -63,4 +56,4 @@
} }
} }
} }
} }

View File

@ -4,9 +4,7 @@
"schemas": { "schemas": {
"Pet": { "Pet": {
"type": "object", "type": "object",
"required": [ "required": ["type"],
"type"
],
"discriminator": { "discriminator": {
"propertyName": "type" "propertyName": "type"
}, },

View File

@ -1,116 +1,116 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Models Schema should correct resolve double $ref if no need sibling 1`] = ` exports[`Models Schema should correct resolve double $ref if no need sibling 1`] = `
Object { Object {
"refsStack": Array [ "refsStack": Array [
"#/components/schemas/Parent", "#/components/schemas/Parent",
], ],
"resolved": Object { "resolved": Object {
"properties": Object { "properties": Object {
"test": Object { "test": Object {
"type": "string", "type": "string",
}, },
}, },
"type": "object", "type": "object",
}, },
} }
`; `;
exports[`Models Schema should hoist oneOfs when mergin allOf 1`] = ` exports[`Models Schema should hoist oneOfs when mergin allOf 1`] = `
Object { Object {
"oneOf": Array [ "oneOf": Array [
Object { Object {
"allOf": Array [ "allOf": Array [
Object { Object {
"properties": Object { "properties": Object {
"username": Object { "username": Object {
"description": "The user's name", "description": "The user's name",
"type": "string", "type": "string",
}, },
}, },
}, },
Object { Object {
"properties": Object { "properties": Object {
"extra": Object { "extra": Object {
"type": "string", "type": "string",
}, },
}, },
}, },
Object { Object {
"oneOf": Array [ "oneOf": Array [
Object { Object {
"properties": Object { "properties": Object {
"password": Object { "password": Object {
"description": "The user's password", "description": "The user's password",
"type": "string", "type": "string",
}, },
}, },
}, },
Object { Object {
"properties": Object { "properties": Object {
"mobile": Object { "mobile": Object {
"description": "The user's mobile", "description": "The user's mobile",
"type": "string", "type": "string",
}, },
}, },
}, },
], ],
}, },
], ],
"x-refsStack": undefined, "x-refsStack": undefined,
}, },
Object { Object {
"allOf": Array [ "allOf": Array [
Object { Object {
"properties": Object { "properties": Object {
"email": Object { "email": Object {
"description": "The user's email", "description": "The user's email",
"type": "string", "type": "string",
}, },
}, },
}, },
Object { Object {
"properties": Object { "properties": Object {
"extra": Object { "extra": Object {
"type": "string", "type": "string",
}, },
}, },
}, },
Object { Object {
"oneOf": Array [ "oneOf": Array [
Object { Object {
"properties": Object { "properties": Object {
"password": Object { "password": Object {
"description": "The user's password", "description": "The user's password",
"type": "string", "type": "string",
}, },
}, },
}, },
Object { Object {
"properties": Object { "properties": Object {
"mobile": Object { "mobile": Object {
"description": "The user's mobile", "description": "The user's mobile",
"type": "string", "type": "string",
}, },
}, },
}, },
], ],
}, },
], ],
"x-refsStack": undefined, "x-refsStack": undefined,
}, },
], ],
} }
`; `;
exports[`Models Schema should override description from $ref of the referenced component, when sibling description exists 1`] = ` exports[`Models Schema should override description from $ref of the referenced component, when sibling description exists 1`] = `
Object { Object {
"refsStack": Array [ "refsStack": Array [
"#/components/schemas/Test", "#/components/schemas/Test",
], ],
"resolved": Object { "resolved": Object {
"description": "Overriden description", "description": "Overriden description",
"type": "object", "type": "object",
}, },
} }
`; `;

View File

@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`prism.js helpers highlight js code 1`] = `"<span class=\\"token keyword\\">const</span> t <span class=\\"token operator\\">=</span> <span class=\\"token number\\">10</span><span class=\\"token punctuation\\">;</span>"`; exports[`prism.js helpers highlight js code 1`] = `"<span class=\\"token keyword\\">const</span> t <span class=\\"token operator\\">=</span> <span class=\\"token number\\">10</span><span class=\\"token punctuation\\">;</span>"`;

View File

@ -18,9 +18,7 @@
"summary": "Get a cat details after update", "summary": "Get a cat details after update",
"description": "Get a cat details after update", "description": "Get a cat details after update",
"operationId": "updatedCat", "operationId": "updatedCat",
"tags": [ "tags": ["pet"],
"pet"
],
"requestBody": { "requestBody": {
"description": "Information about cat in the system", "description": "Information about cat in the system",
"content": { "content": {
@ -41,9 +39,7 @@
"summary": "Create new cat", "summary": "Create new cat",
"description": "Info about new cat", "description": "Info about new cat",
"operationId": "createdCat", "operationId": "createdCat",
"tags": [ "tags": ["pet"],
"pet"
],
"requestBody": { "requestBody": {
"description": "Information about cat in the system", "description": "Information about cat in the system",
"content": { "content": {

View File

@ -1,64 +1,57 @@
{ {
"openapi": "3.0.0", "openapi": "3.0.0",
"info": { "info": {
"version": "1.0", "version": "1.0",
"title": "Foo" "title": "Foo"
}, },
"components": { "components": {
"callbacks": { "callbacks": {
"Test": { "Test": {
"post": { "post": {
"operationId": "testCallback", "operationId": "testCallback",
"description": "Test callback.", "description": "Test callback.",
"requestBody": { "requestBody": {
"content": { "content": {
"application/json": { "application/json": {
"schema": { "schema": {
"title": "TestTitle", "title": "TestTitle",
"type": "object", "type": "object",
"description": "Test description", "description": "Test description",
"properties": { "properties": {
"type": { "type": {
"type": "string", "type": "string",
"description": "The type of response.", "description": "The type of response.",
"enum": [ "enum": ["TestResponse.Complete"]
"TestResponse.Complete" },
] "status": {
}, "type": "string",
"status": { "enum": ["FAILURE", "SUCCESS"]
"type": "string",
"enum": [
"FAILURE",
"SUCCESS"
]
}
},
"required": [
"status"
]
} }
} },
} "required": ["status"]
},
"parameters": [
{
"name": "X-Test-Header",
"in": "header",
"required": true,
"example": "1",
"description": "This is a test header parameter",
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": "Test response."
} }
} }
} }
},
"parameters": [
{
"name": "X-Test-Header",
"in": "header",
"required": true,
"example": "1",
"description": "This is a test header parameter",
"schema": {
"type": "string"
}
}
],
"responses": {
"204": {
"description": "Test response."
}
} }
}
} }
} }
} }
}

View File

@ -28,9 +28,7 @@
"JsonApiResource": { "JsonApiResource": {
"type": "object", "type": "object",
"description": "A related resource.", "description": "A related resource.",
"required": [ "required": ["type"],
"type"
],
"discriminator": { "discriminator": {
"propertyName": "type" "propertyName": "type"
}, },
@ -43,9 +41,7 @@
}, },
"FooTopLevel": { "FooTopLevel": {
"type": "object", "type": "object",
"required": [ "required": ["data"],
"data"
],
"properties": { "properties": {
"data": { "data": {
"$ref": "#/components/schemas/Foo" "$ref": "#/components/schemas/Foo"
@ -64,4 +60,4 @@
} }
} }
} }
} }

View File

@ -59,4 +59,4 @@
} }
} }
} }
} }

View File

@ -58,22 +58,25 @@
} }
}, },
"WithArray": { "WithArray": {
"oneOf": [{ "oneOf": [
"type" : "array", {
"items": { "type": "array",
"oneOf": [ "items": {
{ "oneOf": [
"type": "string" {
}, "type": "string"
{ },
"type": "number" {
} "type": "number"
] }
]
}
},
{
"type": "string"
} }
}, { ]
"type": "string"
}]
} }
} }
} }
} }

View File

@ -1,144 +1,144 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Models Schema schemaDefinition should resolve field with conditional operators 1`] = ` exports[`Models Schema schemaDefinition should resolve field with conditional operators 1`] = `
Object { Object {
"allOf": undefined, "allOf": undefined,
"default": undefined, "default": undefined,
"description": undefined, "description": undefined,
"items": Object { "items": Object {
"allOf": undefined, "allOf": undefined,
"description": undefined, "description": undefined,
"format": "url", "format": "url",
"readOnly": undefined, "readOnly": undefined,
"title": undefined, "title": undefined,
"type": "string", "type": "string",
"writeOnly": undefined, "writeOnly": undefined,
"x-circular-ref": undefined, "x-circular-ref": undefined,
"x-parentRefs": Array [], "x-parentRefs": Array [],
}, },
"maxItems": 20, "maxItems": 20,
"minItems": 1, "minItems": 1,
"readOnly": undefined, "readOnly": undefined,
"title": "isString", "title": "isString",
"type": "string", "type": "string",
"writeOnly": undefined, "writeOnly": undefined,
"x-circular-ref": undefined, "x-circular-ref": undefined,
"x-displayName": "isString", "x-displayName": "isString",
"x-parentRefs": Array [], "x-parentRefs": Array [],
} }
`; `;
exports[`Models Schema schemaDefinition should resolve field with conditional operators 2`] = ` exports[`Models Schema schemaDefinition should resolve field with conditional operators 2`] = `
Object { Object {
"allOf": undefined, "allOf": undefined,
"default": undefined, "default": undefined,
"description": undefined, "description": undefined,
"items": Object { "items": Object {
"allOf": undefined, "allOf": undefined,
"description": undefined, "description": undefined,
"format": "url", "format": "url",
"readOnly": undefined, "readOnly": undefined,
"title": undefined, "title": undefined,
"type": "string", "type": "string",
"writeOnly": undefined, "writeOnly": undefined,
"x-circular-ref": undefined, "x-circular-ref": undefined,
"x-parentRefs": Array [], "x-parentRefs": Array [],
}, },
"maxItems": 10, "maxItems": 10,
"minItems": 1, "minItems": 1,
"pattern": "\\\\d+", "pattern": "\\\\d+",
"readOnly": undefined, "readOnly": undefined,
"title": "notString", "title": "notString",
"type": Array [ "type": Array [
"string", "string",
"integer", "integer",
"null", "null",
], ],
"writeOnly": undefined, "writeOnly": undefined,
"x-circular-ref": undefined, "x-circular-ref": undefined,
"x-displayName": "notString", "x-displayName": "notString",
"x-parentRefs": Array [], "x-parentRefs": Array [],
} }
`; `;
exports[`Models Schema schemaDefinition should resolve schema with conditional operators 1`] = ` exports[`Models Schema schemaDefinition should resolve schema with conditional operators 1`] = `
Object { Object {
"allOf": undefined, "allOf": undefined,
"description": undefined, "description": undefined,
"maxItems": 2, "maxItems": 2,
"properties": Object { "properties": Object {
"test": Object { "test": Object {
"allOf": undefined, "allOf": undefined,
"description": "The list of URL to a cute photos featuring pet", "description": "The list of URL to a cute photos featuring pet",
"enum": Array [ "enum": Array [
10, 10,
], ],
"items": Object { "items": Object {
"allOf": undefined, "allOf": undefined,
"description": undefined, "description": undefined,
"format": "url", "format": "url",
"readOnly": undefined, "readOnly": undefined,
"title": undefined, "title": undefined,
"type": "string", "type": "string",
"writeOnly": undefined, "writeOnly": undefined,
"x-circular-ref": undefined, "x-circular-ref": undefined,
"x-parentRefs": Array [], "x-parentRefs": Array [],
}, },
"maxItems": 20, "maxItems": 20,
"minItems": 1, "minItems": 1,
"readOnly": undefined, "readOnly": undefined,
"title": undefined, "title": undefined,
"type": Array [ "type": Array [
"string", "string",
"integer", "integer",
"null", "null",
], ],
"writeOnly": undefined, "writeOnly": undefined,
"x-circular-ref": undefined, "x-circular-ref": undefined,
"x-parentRefs": Array [], "x-parentRefs": Array [],
"x-refsStack": Array [ "x-refsStack": Array [
"/oneOf/0", "/oneOf/0",
], ],
}, },
}, },
"readOnly": undefined, "readOnly": undefined,
"title": "=== 10", "title": "=== 10",
"type": "object", "type": "object",
"writeOnly": undefined, "writeOnly": undefined,
"x-circular-ref": undefined, "x-circular-ref": undefined,
"x-parentRefs": Array [], "x-parentRefs": Array [],
} }
`; `;
exports[`Models Schema schemaDefinition should resolve schema with conditional operators 2`] = ` exports[`Models Schema schemaDefinition should resolve schema with conditional operators 2`] = `
Object { Object {
"allOf": undefined, "allOf": undefined,
"description": undefined, "description": undefined,
"maxItems": 20, "maxItems": 20,
"properties": Object { "properties": Object {
"test": Object { "test": Object {
"description": "The list of URL to a cute photos featuring pet", "description": "The list of URL to a cute photos featuring pet",
"items": Object { "items": Object {
"format": "url", "format": "url",
"type": "string", "type": "string",
}, },
"maxItems": 20, "maxItems": 20,
"minItems": 1, "minItems": 1,
"type": Array [ "type": Array [
"string", "string",
"integer", "integer",
"null", "null",
], ],
"x-refsStack": Array [ "x-refsStack": Array [
"/oneOf/1", "/oneOf/1",
], ],
}, },
}, },
"readOnly": undefined, "readOnly": undefined,
"title": "case 2", "title": "case 2",
"type": "object", "type": "object",
"writeOnly": undefined, "writeOnly": undefined,
"x-circular-ref": undefined, "x-circular-ref": undefined,
"x-parentRefs": Array [], "x-parentRefs": Array [],
} }
`; `;

View File

@ -47,6 +47,7 @@ export class FieldModel {
name: string; name: string;
required: boolean; required: boolean;
description: string; description: string;
descriptionClass: string;
example?: string; example?: string;
examples?: Record<string, ExampleModel> | any[]; examples?: Record<string, ExampleModel> | any[];
deprecated: boolean; deprecated: boolean;
@ -117,6 +118,8 @@ export class FieldModel {
} }
this.const = this.schema?.const || info?.const || ''; this.const = this.schema?.const || info?.const || '';
this.descriptionClass = info.descriptionClass || '';
} }
@action @action

View File

@ -25,6 +25,7 @@ export class ResponseModel {
code: string; code: string;
summary: string; summary: string;
description: string; description: string;
descriptionClass?: string;
type: string; type: string;
headers: FieldModel[] = []; headers: FieldModel[] = [];
extensions: Record<string, any>; extensions: Record<string, any>;
@ -68,6 +69,8 @@ export class ResponseModel {
if (options.showExtensions) { if (options.showExtensions) {
this.extensions = extractExtensions(info, options.showExtensions); this.extensions = extractExtensions(info, options.showExtensions);
} }
this.descriptionClass = info.descriptionClass || '';
} }
@action @action

View File

@ -91,6 +91,7 @@ export interface OpenAPIParameter {
name: string; name: string;
in?: OpenAPIParameterLocation; in?: OpenAPIParameterLocation;
description?: string; description?: string;
descriptionClass?: string;
required?: boolean; required?: boolean;
deprecated?: boolean; deprecated?: boolean;
allowEmptyValue?: boolean; allowEmptyValue?: boolean;
@ -196,6 +197,7 @@ export type OpenAPIParameterStyle =
export interface OpenAPIRequestBody { export interface OpenAPIRequestBody {
description?: string; description?: string;
descriptionClass?: string;
required?: boolean; required?: boolean;
content: { [mime: string]: OpenAPIMediaType }; content: { [mime: string]: OpenAPIMediaType };
@ -208,7 +210,10 @@ export interface OpenAPIResponses {
} }
export interface OpenAPIResponse export interface OpenAPIResponse
extends Pick<OpenAPIRequestBody, 'description' | 'x-examples' | 'x-example'> { extends Pick<
OpenAPIRequestBody,
'description' | 'descriptionClass' | 'x-examples' | 'x-example'
> {
headers?: { [name: string]: Referenced<OpenAPIHeader> }; headers?: { [name: string]: Referenced<OpenAPIHeader> };
links?: { [name: string]: Referenced<OpenAPILink> }; links?: { [name: string]: Referenced<OpenAPILink> };
content?: { [mime: string]: OpenAPIMediaType }; content?: { [mime: string]: OpenAPIMediaType };

File diff suppressed because it is too large Load Diff