From fb55aa5456984693121c5094a1cf2b4da2a42268 Mon Sep 17 00:00:00 2001 From: Amin Rahimi Date: Thu, 8 Jun 2023 22:14:33 +0000 Subject: [PATCH] Update 217 files --- .gitignore | 4 +- src/components/ContentItems/ContentItems.tsx | 2 +- src/components/Fields/Field.tsx | 10 +- src/components/Fields/FieldContstraints.tsx | 5 +- src/components/Fields/FieldDetail.tsx | 3 +- src/components/Fields/FieldDetails.tsx | 49 +- src/components/Responses/Response.tsx | 31 +- src/components/Responses/ResponseDetails.tsx | 6 +- src/components/Responses/ResponseTitle.tsx | 6 +- src/components/Responses/ResponsesList.tsx | 2 +- .../DiscriminatorDropdown.test.tsx.snap | 5994 ++++----- .../__snapshots__/OneOfSchema.test.tsx.snap | 106 +- .../SecurityRequirement.test.tsx.snap | 46 +- .../__tests__/fixtures/simple-callback.json | 15 +- .../fixtures/simple-discriminator.json | 4 +- .../__snapshots__/OpenAPIParser.test.ts.snap | 232 +- .../__snapshots__/prism.test.ts.snap | 6 +- .../__tests__/fixtures/3.1/pathItems.json | 8 +- src/services/__tests__/fixtures/callback.json | 105 +- .../__tests__/fixtures/discriminator.json | 10 +- .../__tests__/fixtures/oneOfHoist.json | 2 +- .../__tests__/fixtures/oneOfTitles.json | 33 +- .../models/__snapshots__/Schema.test.ts.snap | 288 +- src/services/models/Field.ts | 3 + src/services/models/Response.ts | 3 + src/types/open-api.ts | 7 +- .../loadAndBundleSpec.test.ts.snap | 10352 ++++++++-------- 27 files changed, 8682 insertions(+), 8650 deletions(-) diff --git a/.gitignore b/.gitignore index e7f639c0..65be1a3a 100644 --- a/.gitignore +++ b/.gitignore @@ -19,12 +19,12 @@ npm-debug.log* # Dependency directory # https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git -node_modules +# node_modules lib/ stats.json cypress/ -bundles/ +# bundles/ typings/* !typings/styled-patch.d.ts diff --git a/src/components/ContentItems/ContentItems.tsx b/src/components/ContentItems/ContentItems.tsx index 2be1fc64..b27f8662 100644 --- a/src/components/ContentItems/ContentItems.tsx +++ b/src/components/ContentItems/ContentItems.tsx @@ -73,7 +73,7 @@ export class SectionItem extends React.Component { <> -
+
{name}
diff --git a/src/components/Fields/Field.tsx b/src/components/Fields/Field.tsx index d142c9a5..3d430b65 100644 --- a/src/components/Fields/Field.tsx +++ b/src/components/Fields/Field.tsx @@ -65,7 +65,9 @@ export class Field extends React.Component { const paramName = withSubSchema ? ( @@ -92,12 +94,12 @@ export class Field extends React.Component { <> {paramName} - - + + {expanded && withSubSchema && ( - + { {' '} {this.props.constraints.map(constraint => ( - {constraint} + + {' '} + {constraint}{' '} + ))} ); diff --git a/src/components/Fields/FieldDetail.tsx b/src/components/Fields/FieldDetail.tsx index 53fb89bf..8b02527a 100644 --- a/src/components/Fields/FieldDetail.tsx +++ b/src/components/Fields/FieldDetail.tsx @@ -16,7 +16,8 @@ function FieldDetailComponent({ value, label, raw }: FieldDetailProps) { return (
- {label} {stringifyValue} + {label} {' '} + {stringifyValue}
); } diff --git a/src/components/Fields/FieldDetails.tsx b/src/components/Fields/FieldDetails.tsx index 4a7f66d1..7411bf19 100644 --- a/src/components/Fields/FieldDetails.tsx +++ b/src/components/Fields/FieldDetails.tsx @@ -29,7 +29,15 @@ export const FieldDetailsComponent = observer((props: FieldProps) => { const { enumSkipQuotes, hideSchemaTitles } = React.useContext(OptionsContext); 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 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; return ( -
-
+
+
{schema.typePrefix} - {schema.displayType} + {schema.displayType} {schema.displayFormat && ( {' '} @@ -96,20 +104,29 @@ export const FieldDetailsComponent = observer((props: FieldProps) => { {l('deprecated')}
)} - - {!renderDiscriminatorSwitch && ( - - )}{' '} - {renderedExamples} - -
+
+ +
+ +
+ {!renderDiscriminatorSwitch && ( + + )}{' '} + {renderedExamples} +
+
+ +
+
- {schema.externalDocs && ( - - )} - {(renderDiscriminatorSwitch && renderDiscriminatorSwitch(props)) || null} - {(_const && ) || null} +
+ {schema.externalDocs && ( + + )} + {(renderDiscriminatorSwitch && renderDiscriminatorSwitch(props)) || null} + {(_const && ) || null} +
); }); diff --git a/src/components/Responses/Response.tsx b/src/components/Responses/Response.tsx index 117b8fb5..794b8467 100644 --- a/src/components/Responses/Response.tsx +++ b/src/components/Responses/Response.tsx @@ -10,7 +10,17 @@ export interface ResponseViewProps { } 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( () => @@ -29,14 +39,17 @@ export const ResponseView = observer(({ response }: ResponseViewProps): React.Re return (
- response.toggle()} - type={type} - empty={empty} - title={summary || ''} - code={code} - opened={expanded} - /> + + response.toggle()} + type={type} + empty={empty} + title={summary || ''} + descriptionClass={descriptionClass} + code={code} + opened={expanded} + /> + {expanded && !empty && ( diff --git a/src/components/Responses/ResponseDetails.tsx b/src/components/Responses/ResponseDetails.tsx index e32b0760..7d50eb03 100644 --- a/src/components/Responses/ResponseDetails.tsx +++ b/src/components/Responses/ResponseDetails.tsx @@ -14,10 +14,12 @@ import { ConstraintsView } from '../Fields/FieldContstraints'; export class ResponseDetails extends React.PureComponent<{ response: ResponseModel }> { render() { - const { description, extensions, headers, content } = this.props.response; + const { description, descriptionClass, extensions, headers, content } = this.props.response; return ( <> - {description && } + + {description && } + diff --git a/src/components/Responses/ResponseTitle.tsx b/src/components/Responses/ResponseTitle.tsx index 812bbccd..f84da45e 100644 --- a/src/components/Responses/ResponseTitle.tsx +++ b/src/components/Responses/ResponseTitle.tsx @@ -8,6 +8,7 @@ export interface ResponseTitleProps { code: string; title: string; type: string; + descriptionClass?: string; empty?: boolean; opened?: boolean; className?: string; @@ -19,6 +20,7 @@ function ResponseTitleComponent({ type, empty, code, + descriptionClass, opened, className, onClick, @@ -39,7 +41,9 @@ function ResponseTitleComponent({ /> )} {code} - +
+ +
); } diff --git a/src/components/Responses/ResponsesList.tsx b/src/components/Responses/ResponsesList.tsx index e578a1cf..7de7cc4d 100644 --- a/src/components/Responses/ResponsesList.tsx +++ b/src/components/Responses/ResponsesList.tsx @@ -26,7 +26,7 @@ export class ResponsesList extends React.PureComponent { } return ( -
+
{isCallback ? l('callbackResponses') : l('responses')} {responses.map(response => { return ; diff --git a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap index 5f865af5..5d3e794d 100644 --- a/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/DiscriminatorDropdown.test.tsx.snap @@ -1,2997 +1,2997 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Components SchemaView discriminator should correctly render SchemaView 1`] = ` - -`; - -exports[`Components SchemaView discriminator should correctly render discriminator dropdown 1`] = ` - - - >>", - "pattern": undefined, - "pointer": "#/components/schemas/Dog/properties/packSize", - "rawSchema": Object { - "default": undefined, - "type": "number", - }, - "readOnly": false, - "refsStack": Array [ - "#/components/schemas/Dog", - "#/components/schemas/Dog/properties/packSize", - ], - "schema": Object { - "default": undefined, - "type": "number", - }, - "title": "", - "type": "number", - "typePrefix": "", - "writeOnly": false, - }, - } - } - isLast={false} - key="packSize" - showExamples={false} - /> - >>", - "pattern": undefined, - "pointer": "#/components/schemas/Dog/properties/type", - "rawSchema": Object { - "default": undefined, - "type": "string", - "x-refsStack": Array [ - "#/components/schemas/Dog", - "#/components/schemas/Pet", - ], - }, - "readOnly": false, - "refsStack": Array [ - "#/components/schemas/Dog", - "#/components/schemas/Dog", - "#/components/schemas/Pet", - "#/components/schemas/Dog", - "#/components/schemas/Pet", - "#/components/schemas/Dog/properties/type", - ], - "schema": Object { - "default": undefined, - "type": "string", - "x-refsStack": Array [ - "#/components/schemas/Dog", - "#/components/schemas/Pet", - ], - }, - "title": "", - "type": "string", - "typePrefix": "", - "writeOnly": false, - }, - } - } - isLast={true} - key="type" - renderDiscriminatorSwitch={[Function]} - showExamples={false} - /> - - -`; +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Components SchemaView discriminator should correctly render SchemaView 1`] = ` + +`; + +exports[`Components SchemaView discriminator should correctly render discriminator dropdown 1`] = ` + + + >>", + "pattern": undefined, + "pointer": "#/components/schemas/Dog/properties/packSize", + "rawSchema": Object { + "default": undefined, + "type": "number", + }, + "readOnly": false, + "refsStack": Array [ + "#/components/schemas/Dog", + "#/components/schemas/Dog/properties/packSize", + ], + "schema": Object { + "default": undefined, + "type": "number", + }, + "title": "", + "type": "number", + "typePrefix": "", + "writeOnly": false, + }, + } + } + isLast={false} + key="packSize" + showExamples={false} + /> + >>", + "pattern": undefined, + "pointer": "#/components/schemas/Dog/properties/type", + "rawSchema": Object { + "default": undefined, + "type": "string", + "x-refsStack": Array [ + "#/components/schemas/Dog", + "#/components/schemas/Pet", + ], + }, + "readOnly": false, + "refsStack": Array [ + "#/components/schemas/Dog", + "#/components/schemas/Dog", + "#/components/schemas/Pet", + "#/components/schemas/Dog", + "#/components/schemas/Pet", + "#/components/schemas/Dog/properties/type", + ], + "schema": Object { + "default": undefined, + "type": "string", + "x-refsStack": Array [ + "#/components/schemas/Dog", + "#/components/schemas/Pet", + ], + }, + "title": "", + "type": "string", + "typePrefix": "", + "writeOnly": false, + }, + } + } + isLast={true} + key="type" + renderDiscriminatorSwitch={[Function]} + showExamples={false} + /> + + +`; diff --git a/src/components/__tests__/__snapshots__/OneOfSchema.test.tsx.snap b/src/components/__tests__/__snapshots__/OneOfSchema.test.tsx.snap index 79b0c2df..d20665a6 100644 --- a/src/components/__tests__/__snapshots__/OneOfSchema.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/OneOfSchema.test.tsx.snap @@ -1,53 +1,53 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = ` -
- - One of - -
- - -
-
- - Deprecated - -
-
-
-
- - - string - -
- -
-
-
-
-
-
-`; +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Components SchemaView OneOf deprecated should match snapshot 1`] = ` +
+ + One of + +
+ + +
+
+ + Deprecated + +
+
+
+
+ + + string + +
+ +
+
+
+
+
+
+`; diff --git a/src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap b/src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap index 34ae4fc2..b321c6b7 100644 --- a/src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/SecurityRequirement.test.tsx.snap @@ -1,23 +1,23 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`SecurityRequirement should render SecurityDefs 1`] = ` -"

petstore_auth

Get access to data while protecting your account credentials. -OAuth2 is also a safer and more secure way to give you access.

-
Security Scheme Type: OAuth2
Flow type: implicit
Scopes:
  • write:pets -

    modify pets in your account

    -
  • read:pets -

    read your pets

    -

GitLab_PersonalAccessToken

GitLab Personal Access Token description

-
Security Scheme Type: API Key
Header parameter name: PRIVATE-TOKEN

GitLab_OpenIdConnect

GitLab OpenIdConnect description

-
Security Scheme Type: OpenID Connect

basicAuth

Security Scheme Type: HTTP
HTTP Authorization Scheme: basic
" -`; - -exports[`SecurityRequirement should render authDefinition 1`] = `"
Authorizations:
(API Key: GitLab_PersonalAccessTokenOpenID Connect: GitLab_OpenIdConnectHTTP: basicAuth) OAuth2: petstore_auth
,"`; - -exports[`SecurityRequirement should render authDefinition 2`] = ` -"
Authorizations:
(API Key: GitLab_PersonalAccessTokenOpenID Connect: GitLab_OpenIdConnectHTTP: basicAuth) OAuth2: petstore_auth (write:petsread:pets)
OAuth2: petstore_auth

Get access to data while protecting your account credentials. -OAuth2 is also a safer and more secure way to give you access.

-
Flow type: implicit
Required scopes: write:pets read:pets
Scopes:
  • write:pets -

    modify pets in your account

    -
  • read:pets -

    read your pets

    -
API Key: GitLab_PersonalAccessToken

GitLab Personal Access Token description

-
Header parameter name: PRIVATE-TOKEN
OpenID Connect: GitLab_OpenIdConnect

GitLab OpenIdConnect description

-
HTTP: basicAuth
HTTP Authorization Scheme: basic
," -`; +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`SecurityRequirement should render SecurityDefs 1`] = ` +"

petstore_auth

Get access to data while protecting your account credentials. +OAuth2 is also a safer and more secure way to give you access.

+
Security Scheme Type: OAuth2
Flow type: implicit
Scopes:
  • write:pets -

    modify pets in your account

    +
  • read:pets -

    read your pets

    +

GitLab_PersonalAccessToken

GitLab Personal Access Token description

+
Security Scheme Type: API Key
Header parameter name: PRIVATE-TOKEN

GitLab_OpenIdConnect

GitLab OpenIdConnect description

+
Security Scheme Type: OpenID Connect

basicAuth

Security Scheme Type: HTTP
HTTP Authorization Scheme: basic
" +`; + +exports[`SecurityRequirement should render authDefinition 1`] = `"
Authorizations:
(API Key: GitLab_PersonalAccessTokenOpenID Connect: GitLab_OpenIdConnectHTTP: basicAuth) OAuth2: petstore_auth
,"`; + +exports[`SecurityRequirement should render authDefinition 2`] = ` +"
Authorizations:
(API Key: GitLab_PersonalAccessTokenOpenID Connect: GitLab_OpenIdConnectHTTP: basicAuth) OAuth2: petstore_auth (write:petsread:pets)
OAuth2: petstore_auth

Get access to data while protecting your account credentials. +OAuth2 is also a safer and more secure way to give you access.

+
Flow type: implicit
Required scopes: write:pets read:pets
Scopes:
  • write:pets -

    modify pets in your account

    +
  • read:pets -

    read your pets

    +
API Key: GitLab_PersonalAccessToken

GitLab Personal Access Token description

+
Header parameter name: PRIVATE-TOKEN
OpenID Connect: GitLab_OpenIdConnect

GitLab OpenIdConnect description

+
HTTP: basicAuth
HTTP Authorization Scheme: basic
," +`; diff --git a/src/components/__tests__/fixtures/simple-callback.json b/src/components/__tests__/fixtures/simple-callback.json index 6ee56361..ccf588d8 100644 --- a/src/components/__tests__/fixtures/simple-callback.json +++ b/src/components/__tests__/fixtures/simple-callback.json @@ -22,21 +22,14 @@ "type": { "type": "string", "description": "The type of response.", - "enum": [ - "TestResponse.Complete" - ] + "enum": ["TestResponse.Complete"] }, "status": { "type": "string", - "enum": [ - "FAILURE", - "SUCCESS" - ] + "enum": ["FAILURE", "SUCCESS"] } }, - "required": [ - "status" - ] + "required": ["status"] } } } @@ -63,4 +56,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/components/__tests__/fixtures/simple-discriminator.json b/src/components/__tests__/fixtures/simple-discriminator.json index 4d4867b4..c06746eb 100644 --- a/src/components/__tests__/fixtures/simple-discriminator.json +++ b/src/components/__tests__/fixtures/simple-discriminator.json @@ -4,9 +4,7 @@ "schemas": { "Pet": { "type": "object", - "required": [ - "type" - ], + "required": ["type"], "discriminator": { "propertyName": "type" }, diff --git a/src/services/__tests__/__snapshots__/OpenAPIParser.test.ts.snap b/src/services/__tests__/__snapshots__/OpenAPIParser.test.ts.snap index 3b983a1f..356ba74b 100644 --- a/src/services/__tests__/__snapshots__/OpenAPIParser.test.ts.snap +++ b/src/services/__tests__/__snapshots__/OpenAPIParser.test.ts.snap @@ -1,116 +1,116 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Models Schema should correct resolve double $ref if no need sibling 1`] = ` -Object { - "refsStack": Array [ - "#/components/schemas/Parent", - ], - "resolved": Object { - "properties": Object { - "test": Object { - "type": "string", - }, - }, - "type": "object", - }, -} -`; - -exports[`Models Schema should hoist oneOfs when mergin allOf 1`] = ` -Object { - "oneOf": Array [ - Object { - "allOf": Array [ - Object { - "properties": Object { - "username": Object { - "description": "The user's name", - "type": "string", - }, - }, - }, - Object { - "properties": Object { - "extra": Object { - "type": "string", - }, - }, - }, - Object { - "oneOf": Array [ - Object { - "properties": Object { - "password": Object { - "description": "The user's password", - "type": "string", - }, - }, - }, - Object { - "properties": Object { - "mobile": Object { - "description": "The user's mobile", - "type": "string", - }, - }, - }, - ], - }, - ], - "x-refsStack": undefined, - }, - Object { - "allOf": Array [ - Object { - "properties": Object { - "email": Object { - "description": "The user's email", - "type": "string", - }, - }, - }, - Object { - "properties": Object { - "extra": Object { - "type": "string", - }, - }, - }, - Object { - "oneOf": Array [ - Object { - "properties": Object { - "password": Object { - "description": "The user's password", - "type": "string", - }, - }, - }, - Object { - "properties": Object { - "mobile": Object { - "description": "The user's mobile", - "type": "string", - }, - }, - }, - ], - }, - ], - "x-refsStack": undefined, - }, - ], -} -`; - -exports[`Models Schema should override description from $ref of the referenced component, when sibling description exists 1`] = ` -Object { - "refsStack": Array [ - "#/components/schemas/Test", - ], - "resolved": Object { - "description": "Overriden description", - "type": "object", - }, -} -`; +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Models Schema should correct resolve double $ref if no need sibling 1`] = ` +Object { + "refsStack": Array [ + "#/components/schemas/Parent", + ], + "resolved": Object { + "properties": Object { + "test": Object { + "type": "string", + }, + }, + "type": "object", + }, +} +`; + +exports[`Models Schema should hoist oneOfs when mergin allOf 1`] = ` +Object { + "oneOf": Array [ + Object { + "allOf": Array [ + Object { + "properties": Object { + "username": Object { + "description": "The user's name", + "type": "string", + }, + }, + }, + Object { + "properties": Object { + "extra": Object { + "type": "string", + }, + }, + }, + Object { + "oneOf": Array [ + Object { + "properties": Object { + "password": Object { + "description": "The user's password", + "type": "string", + }, + }, + }, + Object { + "properties": Object { + "mobile": Object { + "description": "The user's mobile", + "type": "string", + }, + }, + }, + ], + }, + ], + "x-refsStack": undefined, + }, + Object { + "allOf": Array [ + Object { + "properties": Object { + "email": Object { + "description": "The user's email", + "type": "string", + }, + }, + }, + Object { + "properties": Object { + "extra": Object { + "type": "string", + }, + }, + }, + Object { + "oneOf": Array [ + Object { + "properties": Object { + "password": Object { + "description": "The user's password", + "type": "string", + }, + }, + }, + Object { + "properties": Object { + "mobile": Object { + "description": "The user's mobile", + "type": "string", + }, + }, + }, + ], + }, + ], + "x-refsStack": undefined, + }, + ], +} +`; + +exports[`Models Schema should override description from $ref of the referenced component, when sibling description exists 1`] = ` +Object { + "refsStack": Array [ + "#/components/schemas/Test", + ], + "resolved": Object { + "description": "Overriden description", + "type": "object", + }, +} +`; diff --git a/src/services/__tests__/__snapshots__/prism.test.ts.snap b/src/services/__tests__/__snapshots__/prism.test.ts.snap index 43799965..2bfc3741 100644 --- a/src/services/__tests__/__snapshots__/prism.test.ts.snap +++ b/src/services/__tests__/__snapshots__/prism.test.ts.snap @@ -1,3 +1,3 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`prism.js helpers highlight js code 1`] = `"const t = 10;"`; +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`prism.js helpers highlight js code 1`] = `"const t = 10;"`; diff --git a/src/services/__tests__/fixtures/3.1/pathItems.json b/src/services/__tests__/fixtures/3.1/pathItems.json index 0bd88b05..0b980a4b 100644 --- a/src/services/__tests__/fixtures/3.1/pathItems.json +++ b/src/services/__tests__/fixtures/3.1/pathItems.json @@ -18,9 +18,7 @@ "summary": "Get a cat details after update", "description": "Get a cat details after update", "operationId": "updatedCat", - "tags": [ - "pet" - ], + "tags": ["pet"], "requestBody": { "description": "Information about cat in the system", "content": { @@ -41,9 +39,7 @@ "summary": "Create new cat", "description": "Info about new cat", "operationId": "createdCat", - "tags": [ - "pet" - ], + "tags": ["pet"], "requestBody": { "description": "Information about cat in the system", "content": { diff --git a/src/services/__tests__/fixtures/callback.json b/src/services/__tests__/fixtures/callback.json index 5ca4af74..4e556669 100644 --- a/src/services/__tests__/fixtures/callback.json +++ b/src/services/__tests__/fixtures/callback.json @@ -1,64 +1,57 @@ { - "openapi": "3.0.0", - "info": { - "version": "1.0", - "title": "Foo" - }, - "components": { - "callbacks": { - "Test": { - "post": { - "operationId": "testCallback", - "description": "Test callback.", - "requestBody": { - "content": { - "application/json": { - "schema": { - "title": "TestTitle", - "type": "object", - "description": "Test description", - "properties": { - "type": { - "type": "string", - "description": "The type of response.", - "enum": [ - "TestResponse.Complete" - ] - }, - "status": { - "type": "string", - "enum": [ - "FAILURE", - "SUCCESS" - ] - } - }, - "required": [ - "status" - ] + "openapi": "3.0.0", + "info": { + "version": "1.0", + "title": "Foo" + }, + "components": { + "callbacks": { + "Test": { + "post": { + "operationId": "testCallback", + "description": "Test callback.", + "requestBody": { + "content": { + "application/json": { + "schema": { + "title": "TestTitle", + "type": "object", + "description": "Test description", + "properties": { + "type": { + "type": "string", + "description": "The type of response.", + "enum": ["TestResponse.Complete"] + }, + "status": { + "type": "string", + "enum": ["FAILURE", "SUCCESS"] } - } - } - }, - "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." + }, + "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." + } } + } } } - } \ No newline at end of file + } +} diff --git a/src/services/__tests__/fixtures/discriminator.json b/src/services/__tests__/fixtures/discriminator.json index 9af0d945..3d18adf2 100644 --- a/src/services/__tests__/fixtures/discriminator.json +++ b/src/services/__tests__/fixtures/discriminator.json @@ -28,9 +28,7 @@ "JsonApiResource": { "type": "object", "description": "A related resource.", - "required": [ - "type" - ], + "required": ["type"], "discriminator": { "propertyName": "type" }, @@ -43,9 +41,7 @@ }, "FooTopLevel": { "type": "object", - "required": [ - "data" - ], + "required": ["data"], "properties": { "data": { "$ref": "#/components/schemas/Foo" @@ -64,4 +60,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/services/__tests__/fixtures/oneOfHoist.json b/src/services/__tests__/fixtures/oneOfHoist.json index 05568aaf..a49edfb3 100644 --- a/src/services/__tests__/fixtures/oneOfHoist.json +++ b/src/services/__tests__/fixtures/oneOfHoist.json @@ -59,4 +59,4 @@ } } } -} \ No newline at end of file +} diff --git a/src/services/__tests__/fixtures/oneOfTitles.json b/src/services/__tests__/fixtures/oneOfTitles.json index 68b0e4e4..cfbc9912 100644 --- a/src/services/__tests__/fixtures/oneOfTitles.json +++ b/src/services/__tests__/fixtures/oneOfTitles.json @@ -58,22 +58,25 @@ } }, "WithArray": { - "oneOf": [{ - "type" : "array", - "items": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] + "oneOf": [ + { + "type": "array", + "items": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "number" + } + ] + } + }, + { + "type": "string" } - }, { - "type": "string" - }] + ] } } } -} \ No newline at end of file +} diff --git a/src/services/__tests__/models/__snapshots__/Schema.test.ts.snap b/src/services/__tests__/models/__snapshots__/Schema.test.ts.snap index b28bc664..3f680e17 100644 --- a/src/services/__tests__/models/__snapshots__/Schema.test.ts.snap +++ b/src/services/__tests__/models/__snapshots__/Schema.test.ts.snap @@ -1,144 +1,144 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Models Schema schemaDefinition should resolve field with conditional operators 1`] = ` -Object { - "allOf": undefined, - "default": undefined, - "description": undefined, - "items": Object { - "allOf": undefined, - "description": undefined, - "format": "url", - "readOnly": undefined, - "title": undefined, - "type": "string", - "writeOnly": undefined, - "x-circular-ref": undefined, - "x-parentRefs": Array [], - }, - "maxItems": 20, - "minItems": 1, - "readOnly": undefined, - "title": "isString", - "type": "string", - "writeOnly": undefined, - "x-circular-ref": undefined, - "x-displayName": "isString", - "x-parentRefs": Array [], -} -`; - -exports[`Models Schema schemaDefinition should resolve field with conditional operators 2`] = ` -Object { - "allOf": undefined, - "default": undefined, - "description": undefined, - "items": Object { - "allOf": undefined, - "description": undefined, - "format": "url", - "readOnly": undefined, - "title": undefined, - "type": "string", - "writeOnly": undefined, - "x-circular-ref": undefined, - "x-parentRefs": Array [], - }, - "maxItems": 10, - "minItems": 1, - "pattern": "\\\\d+", - "readOnly": undefined, - "title": "notString", - "type": Array [ - "string", - "integer", - "null", - ], - "writeOnly": undefined, - "x-circular-ref": undefined, - "x-displayName": "notString", - "x-parentRefs": Array [], -} -`; - -exports[`Models Schema schemaDefinition should resolve schema with conditional operators 1`] = ` -Object { - "allOf": undefined, - "description": undefined, - "maxItems": 2, - "properties": Object { - "test": Object { - "allOf": undefined, - "description": "The list of URL to a cute photos featuring pet", - "enum": Array [ - 10, - ], - "items": Object { - "allOf": undefined, - "description": undefined, - "format": "url", - "readOnly": undefined, - "title": undefined, - "type": "string", - "writeOnly": undefined, - "x-circular-ref": undefined, - "x-parentRefs": Array [], - }, - "maxItems": 20, - "minItems": 1, - "readOnly": undefined, - "title": undefined, - "type": Array [ - "string", - "integer", - "null", - ], - "writeOnly": undefined, - "x-circular-ref": undefined, - "x-parentRefs": Array [], - "x-refsStack": Array [ - "/oneOf/0", - ], - }, - }, - "readOnly": undefined, - "title": "=== 10", - "type": "object", - "writeOnly": undefined, - "x-circular-ref": undefined, - "x-parentRefs": Array [], -} -`; - -exports[`Models Schema schemaDefinition should resolve schema with conditional operators 2`] = ` -Object { - "allOf": undefined, - "description": undefined, - "maxItems": 20, - "properties": Object { - "test": Object { - "description": "The list of URL to a cute photos featuring pet", - "items": Object { - "format": "url", - "type": "string", - }, - "maxItems": 20, - "minItems": 1, - "type": Array [ - "string", - "integer", - "null", - ], - "x-refsStack": Array [ - "/oneOf/1", - ], - }, - }, - "readOnly": undefined, - "title": "case 2", - "type": "object", - "writeOnly": undefined, - "x-circular-ref": undefined, - "x-parentRefs": Array [], -} -`; +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Models Schema schemaDefinition should resolve field with conditional operators 1`] = ` +Object { + "allOf": undefined, + "default": undefined, + "description": undefined, + "items": Object { + "allOf": undefined, + "description": undefined, + "format": "url", + "readOnly": undefined, + "title": undefined, + "type": "string", + "writeOnly": undefined, + "x-circular-ref": undefined, + "x-parentRefs": Array [], + }, + "maxItems": 20, + "minItems": 1, + "readOnly": undefined, + "title": "isString", + "type": "string", + "writeOnly": undefined, + "x-circular-ref": undefined, + "x-displayName": "isString", + "x-parentRefs": Array [], +} +`; + +exports[`Models Schema schemaDefinition should resolve field with conditional operators 2`] = ` +Object { + "allOf": undefined, + "default": undefined, + "description": undefined, + "items": Object { + "allOf": undefined, + "description": undefined, + "format": "url", + "readOnly": undefined, + "title": undefined, + "type": "string", + "writeOnly": undefined, + "x-circular-ref": undefined, + "x-parentRefs": Array [], + }, + "maxItems": 10, + "minItems": 1, + "pattern": "\\\\d+", + "readOnly": undefined, + "title": "notString", + "type": Array [ + "string", + "integer", + "null", + ], + "writeOnly": undefined, + "x-circular-ref": undefined, + "x-displayName": "notString", + "x-parentRefs": Array [], +} +`; + +exports[`Models Schema schemaDefinition should resolve schema with conditional operators 1`] = ` +Object { + "allOf": undefined, + "description": undefined, + "maxItems": 2, + "properties": Object { + "test": Object { + "allOf": undefined, + "description": "The list of URL to a cute photos featuring pet", + "enum": Array [ + 10, + ], + "items": Object { + "allOf": undefined, + "description": undefined, + "format": "url", + "readOnly": undefined, + "title": undefined, + "type": "string", + "writeOnly": undefined, + "x-circular-ref": undefined, + "x-parentRefs": Array [], + }, + "maxItems": 20, + "minItems": 1, + "readOnly": undefined, + "title": undefined, + "type": Array [ + "string", + "integer", + "null", + ], + "writeOnly": undefined, + "x-circular-ref": undefined, + "x-parentRefs": Array [], + "x-refsStack": Array [ + "/oneOf/0", + ], + }, + }, + "readOnly": undefined, + "title": "=== 10", + "type": "object", + "writeOnly": undefined, + "x-circular-ref": undefined, + "x-parentRefs": Array [], +} +`; + +exports[`Models Schema schemaDefinition should resolve schema with conditional operators 2`] = ` +Object { + "allOf": undefined, + "description": undefined, + "maxItems": 20, + "properties": Object { + "test": Object { + "description": "The list of URL to a cute photos featuring pet", + "items": Object { + "format": "url", + "type": "string", + }, + "maxItems": 20, + "minItems": 1, + "type": Array [ + "string", + "integer", + "null", + ], + "x-refsStack": Array [ + "/oneOf/1", + ], + }, + }, + "readOnly": undefined, + "title": "case 2", + "type": "object", + "writeOnly": undefined, + "x-circular-ref": undefined, + "x-parentRefs": Array [], +} +`; diff --git a/src/services/models/Field.ts b/src/services/models/Field.ts index 537fdbee..11712c73 100644 --- a/src/services/models/Field.ts +++ b/src/services/models/Field.ts @@ -47,6 +47,7 @@ export class FieldModel { name: string; required: boolean; description: string; + descriptionClass: string; example?: string; examples?: Record | any[]; deprecated: boolean; @@ -117,6 +118,8 @@ export class FieldModel { } this.const = this.schema?.const || info?.const || ''; + + this.descriptionClass = info.descriptionClass || ''; } @action diff --git a/src/services/models/Response.ts b/src/services/models/Response.ts index b57eea24..3e3c3b7a 100644 --- a/src/services/models/Response.ts +++ b/src/services/models/Response.ts @@ -25,6 +25,7 @@ export class ResponseModel { code: string; summary: string; description: string; + descriptionClass?: string; type: string; headers: FieldModel[] = []; extensions: Record; @@ -68,6 +69,8 @@ export class ResponseModel { if (options.showExtensions) { this.extensions = extractExtensions(info, options.showExtensions); } + + this.descriptionClass = info.descriptionClass || ''; } @action diff --git a/src/types/open-api.ts b/src/types/open-api.ts index fd80bf8d..53905006 100644 --- a/src/types/open-api.ts +++ b/src/types/open-api.ts @@ -91,6 +91,7 @@ export interface OpenAPIParameter { name: string; in?: OpenAPIParameterLocation; description?: string; + descriptionClass?: string; required?: boolean; deprecated?: boolean; allowEmptyValue?: boolean; @@ -196,6 +197,7 @@ export type OpenAPIParameterStyle = export interface OpenAPIRequestBody { description?: string; + descriptionClass?: string; required?: boolean; content: { [mime: string]: OpenAPIMediaType }; @@ -208,7 +210,10 @@ export interface OpenAPIResponses { } export interface OpenAPIResponse - extends Pick { + extends Pick< + OpenAPIRequestBody, + 'description' | 'descriptionClass' | 'x-examples' | 'x-example' + > { headers?: { [name: string]: Referenced }; links?: { [name: string]: Referenced }; content?: { [mime: string]: OpenAPIMediaType }; diff --git a/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap b/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap index 6230f442..587d9452 100644 --- a/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap +++ b/src/utils/__tests__/__snapshots__/loadAndBundleSpec.test.ts.snap @@ -1,5176 +1,5176 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`#loadAndBundleSpec should load And Bundle Spec demo/openapi.yaml 1`] = ` -Object { - "components": Object { - "examples": Object { - "Order": Object { - "value": Object { - "complete": false, - "quantity": 1, - "shipDate": "2018-10-19T16:46:45Z", - "status": "placed", - }, - }, - }, - "requestBodies": Object { - "Pet": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "allOf": Array [ - Object { - "description": "My Pet", - "title": "Pettie", - }, - Object { - "$ref": "#/components/schemas/Pet", - }, - ], - }, - }, - "application/xml": Object { - "schema": Object { - "properties": Object { - "name": Object { - "description": "hooray", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - "description": "Pet object that needs to be added to the store", - "required": true, - }, - "UserArray": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/User", - }, - "type": "array", - }, - }, - }, - "description": "List of user object", - "required": true, - }, - }, - "schemas": Object { - "ApiResponse": Object { - "properties": Object { - "code": Object { - "format": "int32", - "type": "integer", - }, - "message": Object { - "type": "string", - }, - "type": Object { - "type": "string", - }, - }, - "type": "object", - }, - "Cat": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "huntingSkill": Object { - "default": "lazy", - "description": "The measured skill for hunting", - "enum": Array [ - "clueless", - "lazy", - "adventurous", - "aggressive", - ], - "example": "adventurous", - "type": "string", - }, - }, - "required": Array [ - "huntingSkill", - ], - "type": "object", - }, - ], - "description": "A representation of a cat", - }, - "Category": Object { - "properties": Object { - "id": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Category ID", - }, - "name": Object { - "description": "Category name", - "minLength": 1, - "type": "string", - }, - "sub": Object { - "description": "Test Sub Category", - "properties": Object { - "prop1": Object { - "description": "Dumb Property", - "type": "string", - }, - }, - "type": "object", - }, - }, - "type": "object", - "xml": Object { - "name": "Category", - }, - }, - "Dog": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "packSize": Object { - "default": 1, - "description": "The size of the pack the dog is from", - "format": "int32", - "minimum": 1, - "type": "integer", - }, - }, - "required": Array [ - "packSize", - ], - "type": "object", - }, - ], - "description": "A representation of a dog", - }, - "HoneyBee": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "honeyPerDay": Object { - "description": "Average amount of honey produced per day in ounces", - "example": 3.14, - "multipleOf": 0.01, - "type": "number", - }, - }, - "required": Array [ - "honeyPerDay", - ], - "type": "object", - }, - ], - "description": "A representation of a honey bee", - }, - "Id": Object { - "format": "int64", - "readOnly": true, - "type": "integer", - }, - "Order": Object { - "properties": Object { - "complete": Object { - "default": false, - "description": "Indicates whenever order was completed or not", - "readOnly": true, - "type": "boolean", - }, - "id": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Order ID", - }, - "petId": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Pet ID", - }, - "quantity": Object { - "default": 1, - "format": "int32", - "minimum": 1, - "type": "integer", - }, - "requestId": Object { - "description": "Unique Request Id", - "type": "string", - "writeOnly": true, - }, - "shipDate": Object { - "description": "Estimated ship date", - "format": "date-time", - "type": "string", - }, - "status": Object { - "description": "Order Status", - "enum": Array [ - "placed", - "approved", - "delivered", - ], - "type": "string", - }, - }, - "type": "object", - "xml": Object { - "name": "Order", - }, - }, - "Pet": Object { - "discriminator": Object { - "mapping": Object { - "bee": "#/components/schemas/HoneyBee", - "cat": "#/components/schemas/Cat", - "dog": "#/components/schemas/Dog", - }, - "propertyName": "petType", - }, - "properties": Object { - "category": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Category", - }, - ], - "description": "Categories this pet belongs to", - }, - "friend": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - ], - }, - "id": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Pet ID", - "externalDocs": Object { - "description": "Find more info here", - "url": "https://example.com", - }, - }, - "name": Object { - "description": "The name given to a pet", - "example": "Guru", - "type": "string", - }, - "petType": Object { - "description": "Type of a pet", - "type": "string", - }, - "photoUrls": Object { - "description": "The list of URL to a cute photos featuring pet", - "items": Object { - "format": "url", - "type": "string", - }, - "maxItems": 20, - "type": "array", - "xml": Object { - "name": "photoUrl", - "wrapped": true, - }, - }, - "status": Object { - "description": "Pet status in the store", - "enum": Array [ - "available", - "pending", - "sold", - ], - "type": "string", - }, - "tags": Object { - "description": "Tags attached to the pet", - "items": Object { - "$ref": "#/components/schemas/Tag", - }, - "minItems": 1, - "type": "array", - "xml": Object { - "name": "tag", - "wrapped": true, - }, - }, - }, - "required": Array [ - "name", - "photoUrls", - ], - "type": "object", - "xml": Object { - "name": "Pet", - }, - }, - "Tag": Object { - "properties": Object { - "id": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Tag ID", - }, - "name": Object { - "description": "Tag name", - "minLength": 1, - "type": "string", - }, - }, - "type": "object", - "xml": Object { - "name": "Tag", - }, - }, - "User": Object { - "properties": Object { - "addresses": Object { - "additionalItems": Object { - "type": "string", - }, - "items": Array [ - Object { - "properties": Object { - "city": Object { - "minLength": 0, - "type": "string", - }, - "country": Object { - "minLength": 0, - "type": "string", - }, - "street": Object { - "description": "includes build/apartment number", - "minLength": 0, - "type": "string", - }, - }, - "type": "object", - }, - Object { - "type": "number", - }, - ], - "maxLength": 10, - "minItems": 0, - "type": "array", - }, - "email": Object { - "description": "User email address", - "example": "john.smith@example.com", - "format": "email", - "type": "string", - }, - "firstName": Object { - "description": "User first name", - "example": "John", - "minLength": 1, - "type": "string", - }, - "id": Object { - "$ref": "#/components/schemas/Id", - }, - "lastName": Object { - "description": "User last name", - "example": "Smith", - "minLength": 1, - "type": "string", - }, - "password": Object { - "description": "User password, MUST contain a mix of upper and lower case letters, as well as digits", - "example": "drowssaP123", - "format": "password", - "minLength": 8, - "pattern": "/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/", - "type": "string", - }, - "pet": Object { - "oneOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "$ref": "#/components/schemas/Tag", - }, - ], - }, - "phone": Object { - "description": "User phone number in international format", - "example": "+1-202-555-0192", - "pattern": "/^\\\\+(?:[0-9]-?){6,14}[0-9]$/", - "type": "string", - }, - "userStatus": Object { - "description": "User status", - "format": "int32", - "type": "integer", - }, - "username": Object { - "description": "User supplied username", - "example": "John78", - "minLength": 4, - "type": "string", - }, - }, - "type": "object", - "xml": Object { - "name": "User", - }, - }, - }, - "securitySchemes": Object { - "api_key": Object { - "description": "For this sample, you can use the api key \`special-key\` to test the authorization filters. -", - "in": "header", - "name": "api_key", - "type": "apiKey", - }, - "petstore_auth": Object { - "description": "Get access to data while protecting your account credentials. -OAuth2 is also a safer and more secure way to give you access. -", - "flows": Object { - "implicit": Object { - "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog", - "scopes": Object { - "read:pets": "read your pets", - "write:pets": "modify pets in your account", - }, - }, - }, - "type": "oauth2", - }, - }, - }, - "externalDocs": Object { - "description": "Find out how to create Github repo for your OpenAPI spec.", - "url": "https://github.com/Rebilly/generator-openapi-repo", - }, - "info": Object { - "contact": Object { - "email": "apiteam@swagger.io", - "name": "API Support", - "url": "https://github.com/Redocly/redoc", - }, - "description": "This is a sample server Petstore server. -You can find out more about Swagger at -[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). -For this sample, you can use the api key \`special-key\` to test the authorization filters. - -# Introduction -This API is documented in **OpenAPI format** and is based on -[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. -It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) -tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard -OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). - -# OpenAPI Specification -This API is documented in **OpenAPI format** and is based on -[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. -It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) -tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard -OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). - -# Cross-Origin Resource Sharing -This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). -And that allows cross-domain communication from the browser. -All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. - -# Authentication - -Petstore offers two forms of authentication: - - API Key - - OAuth2 -OAuth2 - an open protocol to allow secure authorization in a simple -and standard method from web, mobile and desktop applications. - - -", - "license": Object { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html", - }, - "termsOfService": "http://swagger.io/terms/", - "title": "Swagger Petstore", - "version": "1.0.0", - "x-logo": Object { - "altText": "Petstore logo", - "url": "https://redocly.github.io/redoc/petstore-logo.png", - }, - }, - "openapi": "3.0.0", - "paths": Object { - "/pet": Object { - "parameters": Array [ - Object { - "description": "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US", - "example": "en-US", - "in": "header", - "name": "Accept-Language", - "required": false, - "schema": Object { - "default": "en-AU", - "type": "string", - }, - }, - Object { - "description": "Some cookie", - "in": "cookie", - "name": "cookieParam", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "post": Object { - "description": "Add new pet to the store inventory.", - "operationId": "addPet", - "requestBody": Object { - "$ref": "#/components/requestBodies/Pet", - }, - "responses": Object { - "405": Object { - "description": "Invalid input", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Add a new pet to the store", - "tags": Array [ - "pet", - ], - "x-codeSamples": Array [ - Object { - "lang": "C#", - "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); -pet.setApiKey(\\"your api key\\"); -pet.petType = PetStore.v1.Pet.TYPE_DOG; -pet.name = \\"Rex\\"; -// set other fields -PetStoreResponse response = pet.create(); -if (response.statusCode == HttpStatusCode.Created) -{ - // Successfully created -} -else -{ - // Something wrong -- check response for errors - Console.WriteLine(response.getRawResponse()); -} -", - }, - Object { - "lang": "PHP", - "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); -$form->setPetType(\\"Dog\\"); -$form->setName(\\"Rex\\"); -// set other fields -try { - $pet = $client->pets()->create($form); -} catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); -} -", - }, - ], - }, - "put": Object { - "description": "", - "operationId": "updatePet", - "requestBody": Object { - "$ref": "#/components/requestBodies/Pet", - }, - "responses": Object { - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Pet not found", - }, - "405": Object { - "description": "Validation exception", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Update an existing pet", - "tags": Array [ - "pet", - ], - "x-codeSamples": Array [ - Object { - "lang": "PHP", - "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); -$form->setPetId(1); -$form->setPetType(\\"Dog\\"); -$form->setName(\\"Rex\\"); -// set other fields -try { - $pet = $client->pets()->update($form); -} catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); -} -", - }, - ], - }, - }, - "/pet/findByStatus": Object { - "get": Object { - "description": "Multiple status values can be provided with comma separated strings", - "operationId": "findPetsByStatus", - "parameters": Array [ - Object { - "description": "Status values that need to be considered for filter", - "in": "query", - "name": "status", - "required": true, - "schema": Object { - "items": Object { - "default": "available", - "enum": Array [ - "available", - "pending", - "sold", - ], - "type": "string", - }, - "maxItems": 3, - "minItems": 1, - "type": "array", - }, - "style": "form", - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - "application/xml": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid status value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Finds Pets by status", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/findByTags": Object { - "get": Object { - "deprecated": true, - "description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", - "operationId": "findPetsByTags", - "parameters": Array [ - Object { - "description": "Tags to filter by", - "in": "query", - "name": "tags", - "required": true, - "schema": Object { - "items": Object { - "type": "string", - }, - "type": "array", - }, - "style": "form", - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - "application/xml": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - "maxItems": 111, - }, - "maxItems": 999, - "type": "array", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid tag value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Finds Pets by tags", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/{petId}": Object { - "delete": Object { - "description": "", - "operationId": "deletePet", - "parameters": Array [ - Object { - "example": "Bearer ", - "in": "header", - "name": "api_key", - "required": false, - "schema": Object { - "type": "string", - }, - }, - Object { - "description": "Pet id to delete", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "responses": Object { - "400": Object { - "description": "Invalid pet value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Deletes a pet", - "tags": Array [ - "pet", - ], - }, - "get": Object { - "description": "Returns a single pet", - "operationId": "getPetById", - "parameters": Array [ - Object { - "deprecated": true, - "description": "ID of pet to return", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Pet not found", - }, - }, - "security": Array [ - Object { - "api_key": Array [], - }, - ], - "summary": "Find pet by ID", - "tags": Array [ - "pet", - ], - }, - "post": Object { - "description": "", - "operationId": "updatePetWithForm", - "parameters": Array [ - Object { - "description": "ID of pet that needs to be updated", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "requestBody": Object { - "content": Object { - "application/x-www-form-urlencoded": Object { - "schema": Object { - "properties": Object { - "name": Object { - "description": "Updated name of the pet", - "type": "string", - }, - "status": Object { - "description": "Updated status of the pet", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "405": Object { - "description": "Invalid input", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Updates a pet in the store with form data", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/{petId}/uploadImage": Object { - "post": Object { - "description": "", - "operationId": "uploadFile", - "parameters": Array [ - Object { - "description": "ID of pet to update", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "requestBody": Object { - "content": Object { - "application/octet-stream": Object { - "schema": Object { - "format": "binary", - "type": "string", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/ApiResponse", - }, - }, - }, - "description": "successful operation", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "uploads an image", - "tags": Array [ - "pet", - ], - }, - }, - "/store/inventory": Object { - "get": Object { - "description": "Returns a map of status codes to quantities", - "operationId": "getInventory", - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "additionalProperties": Object { - "format": "int32", - "type": "integer", - }, - "minProperties": 2, - "type": "object", - }, - }, - }, - "description": "successful operation", - }, - }, - "security": Array [ - Object { - "api_key": Array [], - }, - ], - "summary": "Returns pet inventories by status", - "tags": Array [ - "store", - ], - }, - }, - "/store/order": Object { - "post": Object { - "description": "", - "operationId": "placeOrder", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "order placed for purchasing the pet", - "required": true, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "content": Object { - "application/json": Object { - "example": Object { - "message": "Invalid Order", - "status": 400, - }, - }, - }, - "description": "Invalid Order", - }, - }, - "summary": "Place an order for a pet", - "tags": Array [ - "store", - ], - }, - }, - "/store/order/{orderId}": Object { - "delete": Object { - "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", - "operationId": "deleteOrder", - "parameters": Array [ - Object { - "description": "ID of the order that needs to be deleted", - "in": "path", - "name": "orderId", - "required": true, - "schema": Object { - "minimum": 1, - "type": "string", - }, - }, - ], - "responses": Object { - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Order not found", - }, - }, - "summary": "Delete purchase order by ID", - "tags": Array [ - "store", - ], - }, - "get": Object { - "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", - "operationId": "getOrderById", - "parameters": Array [ - Object { - "description": "ID of pet that needs to be fetched", - "in": "path", - "name": "orderId", - "required": true, - "schema": Object { - "format": "int64", - "maximum": 5, - "minimum": 1, - "type": "integer", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Order not found", - }, - }, - "summary": "Find purchase order by ID", - "tags": Array [ - "store", - ], - }, - }, - "/store/subscribe": Object { - "post": Object { - "callbacks": Object { - "orderDelivered": Object { - "http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}": Object { - "post": Object { - "deprecated": true, - "description": "A callback triggered every time an Order is delivered to the recipient", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - "timestamp": Object { - "example": "2018-10-19T16:46:45Z", - "format": "date-time", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "description": "Callback successfully processed and no retries will be performed", - }, - }, - "summary": "Order delivered", - }, - }, - }, - "orderInProgress": Object { - "{$request.body#/callbackUrl}?event={$request.body#/eventName}": Object { - "post": Object { - "description": "A callback triggered every time an Order is updated status to \\"inProgress\\" (Description)", - "externalDocs": Object { - "description": "Find out more", - "url": "https://more-details.com/demo", - }, - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - "status": Object { - "example": "inProgress", - "type": "string", - }, - "timestamp": Object { - "example": "2018-10-19T16:46:45Z", - "format": "date-time", - "type": "string", - }, - }, - "type": "object", - }, - }, - "application/xml": Object { - "example": " - - 123 - inProgress - 2018-10-19T16:46:45Z - -", - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "someProp": Object { - "example": "123", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - "description": "Callback successfully processed and no retries will be performed", - }, - "299": Object { - "description": "Response for cancelling subscription", - }, - "500": Object { - "description": "Callback processing failed and retries will be performed", - }, - }, - "summary": "Order in Progress (Summary)", - "x-codeSamples": Array [ - Object { - "lang": "C#", - "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); -pet.setApiKey(\\"your api key\\"); -pet.petType = PetStore.v1.Pet.TYPE_DOG; -pet.name = \\"Rex\\"; -// set other fields -PetStoreResponse response = pet.create(); -if (response.statusCode == HttpStatusCode.Created) -{ - // Successfully created -} -else -{ - // Something wrong -- check response for errors - Console.WriteLine(response.getRawResponse()); -} -", - }, - Object { - "lang": "PHP", - "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); -$form->setPetType(\\"Dog\\"); -$form->setName(\\"Rex\\"); -// set other fields -try { - $pet = $client->pets()->create($form); -} catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); -} -", - }, - ], - }, - "put": Object { - "description": "Order in Progress (Only Description)", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - "status": Object { - "example": "inProgress", - "type": "string", - }, - "timestamp": Object { - "example": "2018-10-19T16:46:45Z", - "format": "date-time", - "type": "string", - }, - }, - "type": "object", - }, - }, - "application/xml": Object { - "example": " - - 123 - inProgress - 2018-10-19T16:46:45Z - -", - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "someProp": Object { - "example": "123", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - "description": "Callback successfully processed and no retries will be performed", - }, - }, - "servers": Array [ - Object { - "description": "Operation level server 1 (Operation override)", - "url": "//callback-url.operation-level/v1", - }, - Object { - "description": "Operation level server 2 (Operation override)", - "url": "//callback-url.operation-level/v2", - }, - ], - }, - "servers": Array [ - Object { - "description": "Path level server 1", - "url": "//callback-url.path-level/v1", - }, - Object { - "description": "Path level server 2", - "url": "//callback-url.path-level/v2", - }, - ], - }, - }, - "orderShipped": Object { - "{$request.body#/callbackUrl}?event={$request.body#/eventName}": Object { - "post": Object { - "description": "Very long description -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor -incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis -nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. -Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu -fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in -culpa qui officia deserunt mollit anim id est laborum. -", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "estimatedDeliveryDate": Object { - "example": "2018-11-11T16:00:00Z", - "format": "date-time", - "type": "string", - }, - "orderId": Object { - "example": "123", - "type": "string", - }, - "timestamp": Object { - "example": "2018-10-19T16:46:45Z", - "format": "date-time", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "description": "Callback successfully processed and no retries will be performed", - }, - }, - }, - }, - }, - }, - "description": "Add subscription for a store events", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "callbackUrl": Object { - "description": "This URL will be called by the server when the desired event will occur", - "example": "https://myserver.com/send/callback/here", - "format": "uri", - "type": "string", - }, - "eventName": Object { - "description": "Event name for the subscription", - "enum": Array [ - "orderInProgress", - "orderShipped", - "orderDelivered", - ], - "example": "orderInProgress", - "type": "string", - }, - }, - "required": Array [ - "callbackUrl", - "eventName", - ], - "type": "object", - }, - }, - }, - }, - "responses": Object { - "201": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "subscriptionId": Object { - "example": "AAA-123-BBB-456", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - "description": "Subscription added", - }, - }, - "summary": "Subscribe to the Store events", - "tags": Array [ - "store", - ], - }, - }, - "/user": Object { - "post": Object { - "description": "This can only be done by the logged in user.", - "operationId": "createUser", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "Created user object", - "required": true, - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Create user", - "tags": Array [ - "user", - ], - }, - }, - "/user/createWithArray": Object { - "post": Object { - "description": "", - "operationId": "createUsersWithArrayInput", - "requestBody": Object { - "$ref": "#/components/requestBodies/UserArray", - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Creates list of users with given input array", - "tags": Array [ - "user", - ], - }, - }, - "/user/createWithList": Object { - "post": Object { - "description": "", - "operationId": "createUsersWithListInput", - "requestBody": Object { - "$ref": "#/components/requestBodies/UserArray", - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Creates list of users with given input array", - "tags": Array [ - "user", - ], - }, - }, - "/user/login": Object { - "get": Object { - "description": "", - "operationId": "loginUser", - "parameters": Array [ - Object { - "description": "The user name for login", - "in": "query", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - Object { - "description": "The password for login in clear text", - "in": "query", - "name": "password", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "examples": Object { - "response": Object { - "value": "OK", - }, - }, - "schema": Object { - "type": "string", - }, - }, - "application/xml": Object { - "examples": Object { - "response": Object { - "value": " OK ", - }, - }, - "schema": Object { - "type": "string", - }, - }, - "text/plain": Object { - "examples": Object { - "response": Object { - "value": "OK", - }, - }, - }, - }, - "description": "successful operation", - "headers": Object { - "X-Expires-After": Object { - "description": "date in UTC when token expires", - "schema": Object { - "format": "date-time", - "type": "string", - }, - }, - "X-Rate-Limit": Object { - "description": "calls per hour allowed by the user", - "schema": Object { - "format": "int32", - "type": "integer", - }, - }, - }, - }, - "400": Object { - "description": "Invalid username/password supplied", - }, - }, - "summary": "Logs user into the system", - "tags": Array [ - "user", - ], - }, - }, - "/user/logout": Object { - "get": Object { - "description": "", - "operationId": "logoutUser", - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Logs out current logged in user session", - "tags": Array [ - "user", - ], - }, - }, - "/user/{username}": Object { - "delete": Object { - "description": "This can only be done by the logged in user.", - "operationId": "deleteUser", - "parameters": Array [ - Object { - "description": "The name that needs to be deleted", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "400": Object { - "description": "Invalid username supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Delete user", - "tags": Array [ - "user", - ], - }, - "get": Object { - "description": "", - "operationId": "getUserByName", - "parameters": Array [ - Object { - "description": "The name that needs to be fetched. Use user1 for testing. ", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid username supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Get user by user name", - "tags": Array [ - "user", - ], - }, - "put": Object { - "description": "This can only be done by the logged in user.", - "operationId": "updateUser", - "parameters": Array [ - Object { - "description": "name that need to be deleted", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "Updated user object", - "required": true, - }, - "responses": Object { - "400": Object { - "description": "Invalid user supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Updated user", - "tags": Array [ - "user", - ], - }, - }, - }, - "security": Array [ - Object {}, - ], - "servers": Array [ - Object { - "description": "Default server", - "url": "//petstore.swagger.io/v2", - }, - Object { - "description": "Sandbox server", - "url": "//petstore.swagger.io/sandbox", - }, - ], - "tags": Array [ - Object { - "description": "Everything about your Pets", - "name": "pet", - }, - Object { - "description": "Access to Petstore orders", - "name": "store", - }, - Object { - "description": "Operations about user", - "name": "user", - }, - Object { - "description": " -", - "name": "pet_model", - "x-displayName": "The Pet Model", - }, - Object { - "description": " -", - "name": "store_model", - "x-displayName": "The Order Model", - }, - ], - "x-tagGroups": Array [ - Object { - "name": "General", - "tags": Array [ - "pet", - "store", - ], - }, - Object { - "name": "User Management", - "tags": Array [ - "user", - ], - }, - Object { - "name": "Models", - "tags": Array [ - "pet_model", - "store_model", - ], - }, - ], - "x-webhooks": Object { - "newPet": Object { - "post": Object { - "description": "Information about a new pet in the systems", - "operationId": "newPet", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "description": "Return a 200 status to indicate that the data was received successfully", - }, - }, - "summary": "New pet", - "tags": Array [ - "pet", - ], - }, - }, - }, -} -`; - -exports[`#loadAndBundleSpec should load And Bundle Spec demo/openapi-3-1.yaml 1`] = ` -Object { - "components": Object { - "examples": Object { - "Order": Object { - "value": Object { - "complete": false, - "quantity": 1, - "shipDate": "2018-10-19T16:46:45Z", - "status": "placed", - }, - }, - }, - "pathItems": Object { - "webhooks": Object { - "post": Object { - "description": "Info about new cat", - "operationId": "createdCat", - "requestBody": Object { - "content": Object { - "multipart/form-data": Object { - "schema": Object { - "$ref": "#/components/schemas/Cat", - }, - }, - }, - "description": "Information about cat in the system", - }, - "responses": Object { - "200": Object { - "description": "create Cat details", - }, - }, - "summary": "Create new cat", - "tags": Array [ - "webhooks", - ], - }, - "put": Object { - "description": "Get a cat details after update", - "operationId": "updatedCat", - "requestBody": Object { - "content": Object { - "multipart/form-data": Object { - "schema": Object { - "$ref": "#/components/schemas/Cat", - }, - }, - }, - "description": "Information about cat in the system", - }, - "responses": Object { - "200": Object { - "description": "update Cat details", - }, - }, - "summary": "Get a cat details after update", - "tags": Array [ - "webhooks", - ], - }, - }, - }, - "requestBodies": Object { - "Pet": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - "description": "My Pet", - "title": "Pettie", - }, - }, - "application/xml": Object { - "schema": Object { - "properties": Object { - "name": Object { - "description": "hooray", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - "description": "Pet object that needs to be added to the store", - "required": true, - }, - "UserArray": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/User", - }, - "type": "array", - }, - }, - }, - "description": "List of user object", - "required": true, - }, - }, - "schemas": Object { - "ApiResponse": Object { - "patternProperties": Object { - "^O_\\\\\\\\w+\\\\\\\\.[1-9]{2,4}$": Object { - "properties": Object { - "nestedProperty": Object { - "default": "lazy", - "description": "The measured skill for hunting", - "enum": Array [ - "clueless", - "lazy", - "adventurous", - "aggressive", - ], - "example": "adventurous", - "type": Array [ - "string", - "boolean", - ], - }, - }, - "type": "object", - }, - "^S_\\\\\\\\w+\\\\\\\\.[1-9]{2,4}$": Object { - "description": "The measured skill for hunting", - "else": Object { - "maxLength": 10, - "minLength": 1, - }, - "if": Object { - "x-displayName": "fieldName === 'status'", - }, - "then": Object { - "enum": Array [ - "success", - "failed", - ], - "format": "url", - "type": "string", - }, - }, - }, - "properties": Object { - "code": Object { - "format": "int32", - "type": "integer", - }, - "message": Object { - "type": "string", - }, - "type": Object { - "type": "string", - }, - }, - "type": "object", - }, - "Cat": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "huntingSkill": Object { - "default": "lazy", - "description": "The measured skill for hunting", - "enum": Array [ - "clueless", - "lazy", - "adventurous", - "aggressive", - ], - "example": "adventurous", - "type": Array [ - "string", - "boolean", - ], - }, - }, - "required": Array [ - "huntingSkill", - ], - "type": "object", - }, - ], - "description": "A representation of a cat", - }, - "Category": Object { - "properties": Object { - "id": Object { - "$ref": "#/components/schemas/Id", - "description": "Category ID", - }, - "name": Object { - "description": "Category name", - "minLength": 1, - "type": "string", - }, - "sub": Object { - "description": "Test Sub Category", - "properties": Object { - "prop1": Object { - "description": "Dumb Property", - "type": "string", - }, - }, - "type": "object", - }, - }, - "type": "object", - "xml": Object { - "name": "Category", - }, - }, - "Dog": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "packSize": Object { - "default": 1, - "description": "The size of the pack the dog is from", - "format": "int32", - "minimum": 1, - "type": "integer", - }, - }, - "required": Array [ - "packSize", - ], - "type": "object", - }, - ], - "description": "A representation of a dog", - }, - "HoneyBee": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "honeyPerDay": Object { - "description": "Average amount of honey produced per day in ounces", - "example": 3.14, - "multipleOf": 0.01, - "type": "number", - }, - }, - "required": Array [ - "honeyPerDay", - ], - "type": "object", - }, - ], - "description": "A representation of a honey bee", - }, - "Id": Object { - "format": "int64", - "readOnly": true, - "type": "integer", - }, - "Order": Object { - "properties": Object { - "complete": Object { - "default": false, - "description": "Indicates whenever order was completed or not", - "readOnly": true, - "type": "boolean", - }, - "id": Object { - "$ref": "#/components/schemas/Id", - "description": "Order ID", - }, - "petId": Object { - "$ref": "#/components/schemas/Id", - "description": "Pet ID", - }, - "quantity": Object { - "default": 1, - "format": "int32", - "minimum": 1, - "type": "integer", - }, - "requestId": Object { - "description": "Unique Request Id", - "type": "string", - "writeOnly": true, - }, - "shipDate": Object { - "description": "Estimated ship date", - "format": "date-time", - "type": "string", - }, - "status": Object { - "description": "Order Status", - "enum": Array [ - "placed", - "approved", - "delivered", - ], - "type": "string", - }, - }, - "type": "object", - "xml": Object { - "name": "Order", - }, - }, - "Pet": Object { - "discriminator": Object { - "mapping": Object { - "bee": "#/components/schemas/HoneyBee", - "cat": "#/components/schemas/Cat", - "dog": "#/components/schemas/Dog", - }, - "propertyName": "petType", - }, - "properties": Object { - "category": Object { - "$ref": "#/components/schemas/Category", - "description": "Categories this pet belongs to", - }, - "friend": Object { - "$ref": "#/components/schemas/Pet", - }, - "huntingSkill": Object { - "enum": Array [ - 0, - 1, - 2, - ], - "type": Array [ - "integer", - ], - }, - "id": Object { - "$ref": "#/components/schemas/Id", - "description": "Pet ID", - "externalDocs": Object { - "description": "Find more info here", - "url": "https://example.com", - }, - }, - "name": Object { - "description": "The name given to a pet", - "example": "Guru", - "type": "string", - }, - "petType": Object { - "description": "Type of a pet", - "type": "string", - }, - "photoUrls": Object { - "description": "The list of URL to a cute photos featuring pet", - "else": Object { - "maxItems": 20, - "minItems": 1, - "type": Array [ - "integer", - "null", - ], - "x-displayName": "notString", - }, - "if": Object { - "type": "string", - "x-displayName": "isString", - }, - "items": Object { - "format": "url", - "type": "string", - }, - "maxItems": 10, - "minItems": 1, - "then": Object { - "maxItems": 15, - "minItems": 1, - }, - "type": Array [ - "string", - "integer", - "null", - ], - "xml": Object { - "name": "photoUrl", - "wrapped": true, - }, - }, - "status": Object { - "default": "pending", - "description": "Pet status in the store", - "enum": Array [ - "available", - "pending", - "sold", - ], - "type": "string", - }, - "tags": Object { - "description": "Tags attached to the pet", - "exclusiveMaximum": 100, - "exclusiveMinimum": 0, - "items": Object { - "$ref": "#/components/schemas/Tag", - }, - "type": "array", - "xml": Object { - "name": "tag", - "wrapped": true, - }, - }, - }, - "required": Array [ - "name", - "photoUrls", - ], - "type": "object", - "xml": Object { - "name": "Pet", - }, - }, - "Tag": Object { - "properties": Object { - "id": Object { - "$ref": "#/components/schemas/Id", - "description": "Tag ID", - "type": "number", - }, - "name": Object { - "description": "Tag name", - "minLength": 1, - "type": "string", - }, - }, - "type": "object", - "xml": Object { - "name": "Tag", - }, - }, - "User": Object { - "else": Object { - "required": Array [], - }, - "if": Object { - "properties": Object { - "userStatus": Object { - "enum": Array [ - 10, - ], - }, - }, - "title": "userStatus === 10", - }, - "properties": Object { - "addresses": Object { - "items": Object { - "type": "string", - }, - "maxLength": 10, - "minItems": 0, - "prefixItems": Array [ - Object { - "properties": Object { - "city": Object { - "minLength": 0, - "type": "string", - }, - "country": Object { - "minLength": 0, - "type": "string", - }, - "street": Object { - "description": "includes build/apartment number", - "minLength": 0, - "type": "string", - }, - }, - "type": "object", - }, - Object { - "type": "number", - }, - ], - "type": "array", - }, - "email": Object { - "description": "User email address", - "example": "john.smith@example.com", - "format": "email", - "type": "string", - }, - "firstName": Object { - "description": "User first name", - "example": "John", - "minLength": 1, - "type": "string", - }, - "id": Object { - "$ref": "#/components/schemas/Id", - }, - "image": Object { - "contentEncoding": "base64", - "contentMediaType": "image/png", - "description": "User image", - "type": "string", - }, - "lastName": Object { - "description": "User last name", - "example": "Smith", - "minLength": 1, - "type": "string", - }, - "password": Object { - "description": "User password, MUST contain a mix of upper and lower case letters, as well as digits", - "example": "drowssaP123", - "format": "password", - "minLength": 8, - "pattern": "/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/", - "type": "string", - }, - "pet": Object { - "oneOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - "title": "Pettie", - }, - Object { - "$ref": "#/components/schemas/Tag", - }, - ], - }, - "phone": Object { - "description": "User phone number in international format", - "example": "+1-202-555-0192", - "pattern": "/^\\\\+(?:[0-9]-?){6,14}[0-9]$/", - "type": "string", - }, - "userStatus": Object { - "description": "User status", - "format": "int32", - "type": "integer", - }, - "username": Object { - "description": "User supplied username", - "example": "John78", - "minLength": 4, - "type": "string", - }, - }, - "then": Object { - "required": Array [ - "phone", - ], - }, - "type": "object", - "xml": Object { - "name": "User", - }, - }, - }, - "securitySchemes": Object { - "api_key": Object { - "description": "For this sample, you can use the api key \`special-key\` to test the authorization filters. -", - "in": "header", - "name": "api_key", - "type": "apiKey", - }, - "petstore_auth": Object { - "description": "Get access to data while protecting your account credentials. -OAuth2 is also a safer and more secure way to give you access. -", - "flows": Object { - "implicit": Object { - "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog", - "scopes": Object { - "read:pets": "read your pets", - "write:pets": "modify pets in your account", - }, - }, - }, - "type": "oauth2", - }, - }, - }, - "externalDocs": Object { - "description": "Find out how to create Github repo for your OpenAPI spec.", - "url": "https://github.com/Rebilly/generator-openapi-repo", - }, - "info": Object { - "contact": Object { - "email": "apiteam@swagger.io", - "name": "API Support", - "url": "https://github.com/Redocly/redoc", - }, - "description": "This is a sample server Petstore server. -You can find out more about Swagger at -[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). -For this sample, you can use the api key \`special-key\` to test the authorization filters. - -# Introduction -This API is documented in **OpenAPI format** and is based on -[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. -It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) -tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard -OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). - -# OpenAPI Specification -This API is documented in **OpenAPI format** and is based on -[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. -It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) -tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard -OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). - -# Cross-Origin Resource Sharing -This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). -And that allows cross-domain communication from the browser. -All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. - -# Authentication - -Petstore offers two forms of authentication: - - API Key - - OAuth2 -OAuth2 - an open protocol to allow secure authorization in a simple -and standard method from web, mobile and desktop applications. - - -", - "license": Object { - "identifier": "Apache 2.0", - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html", - }, - "summary": "My lovely API", - "termsOfService": "http://swagger.io/terms/", - "title": "Swagger Petstore", - "version": "1.0.0", - "x-logo": Object { - "altText": "Petstore logo", - "url": "https://redocly.github.io/redoc/petstore-logo.png", - }, - }, - "openapi": "3.1.0", - "paths": Object { - "/pet": Object { - "delete": Object { - "operationId": "deletePetBy\\"Id", - "summary": "OperationId with quotes", - "tags": Array [ - "pet", - ], - }, - "get": Object { - "operationId": "delete\\\\PetById", - "summary": "OperationId with backslash", - "tags": Array [ - "pet", - ], - }, - "parameters": Array [ - Object { - "description": "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US", - "example": "en-US", - "in": "header", - "name": "Accept-Language", - "required": false, - "schema": Object { - "default": "en-AU", - "type": "string", - }, - }, - Object { - "description": "Some cookie", - "in": "cookie", - "name": "cookieParam", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "post": Object { - "description": "Add new pet to the store inventory.", - "operationId": "addPet", - "requestBody": Object { - "$ref": "#/components/requestBodies/Pet", - }, - "responses": Object { - "405": Object { - "description": "Invalid input", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Add a new pet to the store", - "tags": Array [ - "pet", - ], - "x-codeSamples": Array [ - Object { - "lang": "C#", - "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); -pet.setApiKey(\\"your api key\\"); -pet.petType = PetStore.v1.Pet.TYPE_DOG; -pet.name = \\"Rex\\"; -// set other fields -PetStoreResponse response = pet.create(); -if (response.statusCode == HttpStatusCode.Created) -{ - // Successfully created -} -else -{ - // Something wrong -- check response for errors - Console.WriteLine(response.getRawResponse()); -} -", - }, - Object { - "lang": "PHP", - "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); -$form->setPetType(\\"Dog\\"); -$form->setName(\\"Rex\\"); -// set other fields -try { - $pet = $client->pets()->create($form); -} catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); -} -", - }, - ], - }, - "put": Object { - "description": "", - "operationId": "updatePet", - "requestBody": Object { - "$ref": "#/components/requestBodies/Pet", - }, - "responses": Object { - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Pet not found", - }, - "405": Object { - "description": "Validation exception", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Update an existing pet", - "tags": Array [ - "pet", - ], - "x-codeSamples": Array [ - Object { - "lang": "PHP", - "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); -$form->setPetId(1); -$form->setPetType(\\"Dog\\"); -$form->setName(\\"Rex\\"); -// set other fields -try { - $pet = $client->pets()->update($form); -} catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); -} -", - }, - ], - }, - }, - "/pet/findByStatus": Object { - "get": Object { - "description": "Multiple status values can be provided with comma separated strings", - "operationId": "findPetsByStatus", - "parameters": Array [ - Object { - "description": "Status values that need to be considered for filter", - "in": "query", - "name": "status", - "required": true, - "schema": Object { - "items": Object { - "default": "available", - "enum": Array [ - "available", - "pending", - "sold", - ], - "type": "string", - }, - "maxItems": 3, - "minItems": 1, - "type": "array", - }, - "style": "form", - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - "application/xml": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid status value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Finds Pets by status", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/findByTags": Object { - "get": Object { - "deprecated": true, - "description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", - "operationId": "findPetsByTags", - "parameters": Array [ - Object { - "description": "Tags to filter by", - "in": "query", - "name": "tags", - "required": true, - "schema": Object { - "items": Object { - "type": "string", - }, - "type": "array", - }, - "style": "form", - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - "application/xml": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid tag value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Finds Pets by tags", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/{petId}": Object { - "delete": Object { - "description": "", - "operationId": "deletePet", - "parameters": Array [ - Object { - "example": "Bearer ", - "in": "header", - "name": "api_key", - "required": false, - "schema": Object { - "type": "string", - }, - }, - Object { - "description": "Pet id to delete", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "responses": Object { - "400": Object { - "description": "Invalid pet value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Deletes a pet", - "tags": Array [ - "pet", - ], - }, - "get": Object { - "description": "Returns a single pet", - "operationId": "getPetById", - "parameters": Array [ - Object { - "deprecated": true, - "description": "ID of pet to return", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Pet not found", - }, - }, - "security": Array [ - Object { - "api_key": Array [], - }, - ], - "summary": "Find pet by ID", - "tags": Array [ - "pet", - ], - }, - "post": Object { - "description": "", - "operationId": "updatePetWithForm", - "parameters": Array [ - Object { - "description": "ID of pet that needs to be updated", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "requestBody": Object { - "content": Object { - "application/x-www-form-urlencoded": Object { - "schema": Object { - "properties": Object { - "name": Object { - "description": "Updated name of the pet", - "type": "string", - }, - "status": Object { - "description": "Updated status of the pet", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "405": Object { - "description": "Invalid input", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Updates a pet in the store with form data", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/{petId}/uploadImage": Object { - "post": Object { - "description": "", - "operationId": "uploadFile", - "parameters": Array [ - Object { - "description": "ID of pet to update", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "requestBody": Object { - "content": Object { - "application/octet-stream": Object { - "schema": Object { - "format": "binary", - "type": "string", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/ApiResponse", - "unevaluatedProperties": Object { - "format": "int32", - "type": "integer", - }, - }, - }, - }, - "description": "successful operation", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "uploads an image", - "tags": Array [ - "pet", - ], - }, - }, - "/store/inventory": Object { - "get": Object { - "description": "Returns a map of status codes to quantities", - "operationId": "getInventory", - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "additionalProperties": Object { - "format": "int32", - "type": "integer", - }, - "type": "object", - }, - }, - }, - "description": "successful operation", - }, - }, - "security": Array [ - Object { - "api_key": Array [], - }, - ], - "summary": "Returns pet inventories by status", - "tags": Array [ - "store", - ], - }, - }, - "/store/order": Object { - "post": Object { - "description": "", - "operationId": "placeOrder", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "order placed for purchasing the pet", - "required": true, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "content": Object { - "application/json": Object { - "example": Object { - "message": "Invalid Order", - "status": 400, - }, - }, - }, - "description": "Invalid Order", - }, - }, - "summary": "Place an order for a pet", - "tags": Array [ - "store", - ], - }, - }, - "/store/order/{orderId}": Object { - "delete": Object { - "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", - "operationId": "deleteOrder", - "parameters": Array [ - Object { - "description": "ID of the order that needs to be deleted", - "in": "path", - "name": "orderId", - "required": true, - "schema": Object { - "minimum": 1, - "type": "string", - }, - }, - ], - "responses": Object { - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Order not found", - }, - }, - "summary": "Delete purchase order by ID", - "tags": Array [ - "store", - ], - }, - "get": Object { - "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", - "operationId": "getOrderById", - "parameters": Array [ - Object { - "description": "ID of pet that needs to be fetched", - "in": "path", - "name": "orderId", - "required": true, - "schema": Object { - "format": "int64", - "maximum": 5, - "minimum": 1, - "type": "integer", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Order not found", - }, - }, - "summary": "Find purchase order by ID", - "tags": Array [ - "store", - ], - }, - }, - "/store/subscribe": Object { - "post": Object { - "callbacks": Object { - "orderDelivered": Object { - "http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}": Object { - "post": Object { - "deprecated": true, - "description": "A callback triggered every time an Order is delivered to the recipient", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - "timestamp": Object { - "example": "2018-10-19T16:46:45Z", - "format": "date-time", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "description": "Callback successfully processed and no retries will be performed", - }, - }, - "summary": "Order delivered", - }, - }, - }, - "orderInProgress": Object { - "{$request.body#/callbackUrl}?event={$request.body#/eventName}": Object { - "post": Object { - "description": "A callback triggered every time an Order is updated status to \\"inProgress\\" (Description)", - "externalDocs": Object { - "description": "Find out more", - "url": "https://more-details.com/demo", - }, - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - "status": Object { - "example": "inProgress", - "type": "string", - }, - "timestamp": Object { - "example": "2018-10-19T16:46:45Z", - "format": "date-time", - "type": "string", - }, - }, - "type": "object", - }, - }, - "application/xml": Object { - "example": " - - 123 - inProgress - 2018-10-19T16:46:45Z - -", - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "someProp": Object { - "example": "123", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - "description": "Callback successfully processed and no retries will be performed", - }, - "299": Object { - "description": "Response for cancelling subscription", - }, - "500": Object { - "description": "Callback processing failed and retries will be performed", - }, - }, - "summary": "Order in Progress (Summary)", - "x-codeSamples": Array [ - Object { - "lang": "C#", - "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); -pet.setApiKey(\\"your api key\\"); -pet.petType = PetStore.v1.Pet.TYPE_DOG; -pet.name = \\"Rex\\"; -// set other fields -PetStoreResponse response = pet.create(); -if (response.statusCode == HttpStatusCode.Created) -{ - // Successfully created -} -else -{ - // Something wrong -- check response for errors - Console.WriteLine(response.getRawResponse()); -} -", - }, - Object { - "lang": "PHP", - "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); -$form->setPetType(\\"Dog\\"); -$form->setName(\\"Rex\\"); -// set other fields -try { - $pet = $client->pets()->create($form); -} catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); -} -", - }, - ], - }, - "put": Object { - "description": "Order in Progress (Only Description)", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - "status": Object { - "example": "inProgress", - "type": "string", - }, - "timestamp": Object { - "example": "2018-10-19T16:46:45Z", - "format": "date-time", - "type": "string", - }, - }, - "type": "object", - }, - }, - "application/xml": Object { - "example": " - - 123 - inProgress - 2018-10-19T16:46:45Z - -", - "schema": Object { - "properties": Object { - "orderId": Object { - "example": "123", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "someProp": Object { - "example": "123", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - "description": "Callback successfully processed and no retries will be performed", - }, - }, - "servers": Array [ - Object { - "description": "Operation level server 1 (Operation override)", - "url": "//callback-url.operation-level/v1", - }, - Object { - "description": "Operation level server 2 (Operation override)", - "url": "//callback-url.operation-level/v2", - }, - ], - }, - "servers": Array [ - Object { - "description": "Path level server 1", - "url": "//callback-url.path-level/v1", - }, - Object { - "description": "Path level server 2", - "url": "//callback-url.path-level/v2", - }, - ], - }, - }, - "orderShipped": Object { - "{$request.body#/callbackUrl}?event={$request.body#/eventName}": Object { - "post": Object { - "description": "Very long description -Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor -incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis -nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. -Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu -fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in -culpa qui officia deserunt mollit anim id est laborum. -", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "estimatedDeliveryDate": Object { - "example": "2018-11-11T16:00:00Z", - "format": "date-time", - "type": "string", - }, - "orderId": Object { - "example": "123", - "type": "string", - }, - "timestamp": Object { - "example": "2018-10-19T16:46:45Z", - "format": "date-time", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "description": "Callback successfully processed and no retries will be performed", - }, - }, - }, - }, - }, - }, - "description": "Add subscription for a store events", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "callbackUrl": Object { - "description": "This URL will be called by the server when the desired event will occur", - "example": "https://myserver.com/send/callback/here", - "format": "uri", - "type": "string", - }, - "eventName": Object { - "description": "Event name for the subscription", - "enum": Array [ - "orderInProgress", - "orderShipped", - "orderDelivered", - ], - "example": "orderInProgress", - "type": "string", - }, - }, - "required": Array [ - "callbackUrl", - "eventName", - ], - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "items": Object { - "type": "number", - }, - "maxItems": 777, - "minItems": 111, - "type": "array", - }, - "maxItems": 999, - "minItems": 0, - "type": "array", - }, - }, - }, - "description": "Successful operation", - }, - "201": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "properties": Object { - "subscriptionId": Object { - "example": "AAA-123-BBB-456", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - "description": "Subscription added", - }, - }, - "summary": "Subscribe to the Store events", - "tags": Array [ - "store", - ], - }, - }, - "/user": Object { - "post": Object { - "description": "This can only be done by the logged in user.", - "operationId": "createUser", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "Created user object", - "required": true, - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Create user", - "tags": Array [ - "user", - ], - }, - }, - "/user/createWithArray": Object { - "post": Object { - "description": "", - "operationId": "createUsersWithArrayInput", - "requestBody": Object { - "$ref": "#/components/requestBodies/UserArray", - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Creates list of users with given input array", - "tags": Array [ - "user", - ], - }, - }, - "/user/createWithList": Object { - "post": Object { - "description": "", - "operationId": "createUsersWithListInput", - "requestBody": Object { - "$ref": "#/components/requestBodies/UserArray", - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Creates list of users with given input array", - "tags": Array [ - "user", - ], - }, - }, - "/user/login": Object { - "get": Object { - "description": "", - "operationId": "loginUser", - "parameters": Array [ - Object { - "description": "The user name for login", - "in": "query", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - Object { - "description": "The password for login in clear text", - "in": "query", - "name": "password", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "examples": Object { - "response": Object { - "value": "OK", - }, - }, - "schema": Object { - "type": "string", - }, - }, - "application/xml": Object { - "examples": Object { - "response": Object { - "value": " OK ", - }, - }, - "schema": Object { - "type": "string", - }, - }, - "text/plain": Object { - "examples": Object { - "response": Object { - "value": "OK", - }, - }, - }, - }, - "description": "successful operation", - "headers": Object { - "X-Expires-After": Object { - "description": "date in UTC when token expires", - "schema": Object { - "format": "date-time", - "type": "string", - }, - }, - "X-Rate-Limit": Object { - "description": "calls per hour allowed by the user", - "schema": Object { - "format": "int32", - "type": "integer", - }, - }, - }, - }, - "400": Object { - "description": "Invalid username/password supplied", - }, - }, - "summary": "Logs user into the system", - "tags": Array [ - "user", - ], - }, - }, - "/user/logout": Object { - "get": Object { - "description": "", - "operationId": "logoutUser", - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Logs out current logged in user session", - "tags": Array [ - "user", - ], - }, - }, - "/user/{username}": Object { - "delete": Object { - "description": "This can only be done by the logged in user.", - "operationId": "deleteUser", - "parameters": Array [ - Object { - "description": "The name that needs to be deleted", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "204": Object { - "description": "User is deleted", - }, - "400": Object { - "description": "Invalid username supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Delete user", - "tags": Array [ - "user", - ], - }, - "get": Object { - "description": "", - "operationId": "getUserByName", - "parameters": Array [ - Object { - "description": "The name that needs to be fetched. Use user1 for testing. ", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid username supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Get user by user name", - "tags": Array [ - "user", - ], - }, - "put": Object { - "description": "This can only be done by the logged in user.", - "operationId": "updateUser", - "parameters": Array [ - Object { - "description": "name that need to be updated", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "Updated user object", - "required": true, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "User is updated successfully", - }, - "400": Object { - "description": "Invalid user supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Updated user", - "tags": Array [ - "user", - ], - }, - }, - }, - "security": Array [ - Object {}, - ], - "servers": Array [ - Object { - "description": "Default server", - "url": "//petstore.swagger.io/v2", - }, - Object { - "description": "Sandbox server", - "url": "//petstore.swagger.io/sandbox", - }, - ], - "tags": Array [ - Object { - "description": "Everything about your Pets", - "name": "pet", - }, - Object { - "description": "Access to Petstore orders", - "name": "store", - }, - Object { - "description": "Operations about user", - "name": "user", - }, - Object { - "description": "Everything about your Webhooks", - "name": "webhooks", - }, - Object { - "description": " -", - "name": "pet_model", - "x-displayName": "The Pet Model", - }, - Object { - "description": " -", - "name": "store_model", - "x-displayName": "The Order Model", - }, - ], - "webhooks": Object { - "myWebhook": Object { - "$ref": "#/components/pathItems/webhooks", - "description": "Overriding description", - "summary": "Overriding summary", - }, - "newPet": Object { - "post": Object { - "description": "Information about a new pet in the systems", - "operationId": "newPet", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "description": "Return a 200 status to indicate that the data was received successfully", - }, - }, - "summary": "New pet", - "tags": Array [ - "webhooks", - ], - }, - }, - }, - "x-tagGroups": Array [ - Object { - "name": "General", - "tags": Array [ - "pet", - "store", - "webhooks", - ], - }, - Object { - "name": "User Management", - "tags": Array [ - "user", - ], - }, - Object { - "name": "Models", - "tags": Array [ - "pet_model", - "store_model", - ], - }, - ], -} -`; - -exports[`#loadAndBundleSpec should load And Bundle Spec demo/swagger.yaml 1`] = ` -Object { - "components": Object { - "requestBodies": Object { - "Pet": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - }, - "description": "Pet object that needs to be added to the store", - "required": true, - }, - "UserArray": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/User", - }, - "type": "array", - }, - }, - }, - "description": "List of user object", - "required": true, - }, - }, - "schemas": Object { - "ApiResponse": Object { - "properties": Object { - "code": Object { - "format": "int32", - "type": "integer", - }, - "message": Object { - "type": "string", - }, - "type": Object { - "type": "string", - }, - }, - "type": "object", - }, - "Cat": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "huntingSkill": Object { - "default": "lazy", - "description": "The measured skill for hunting", - "enum": Array [ - "clueless", - "lazy", - "adventurous", - "aggressive", - ], - "type": "string", - }, - }, - "required": Array [ - "huntingSkill", - ], - "type": "object", - }, - ], - "description": "A representation of a cat", - }, - "Category": Object { - "properties": Object { - "id": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Category ID", - }, - "name": Object { - "description": "Category name", - "minLength": 1, - "type": "string", - }, - "sub": Object { - "description": "Test Sub Category", - "properties": Object { - "prop1": Object { - "description": "Dumb Property", - "type": "string", - }, - }, - "type": "object", - }, - }, - "type": "object", - "xml": Object { - "name": "Category", - }, - }, - "Dog": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "packSize": Object { - "default": 1, - "description": "The size of the pack the dog is from", - "format": "int32", - "minimum": 1, - "type": "integer", - }, - }, - "required": Array [ - "packSize", - ], - "type": "object", - }, - ], - "description": "A representation of a dog", - }, - "HoneyBee": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Pet", - }, - Object { - "properties": Object { - "honeyPerDay": Object { - "description": "Average amount of honey produced per day in ounces", - "example": 3.14, - "type": "number", - }, - }, - "required": Array [ - "honeyPerDay", - ], - "type": "object", - }, - ], - "description": "A representation of a honey bee", - }, - "Id": Object { - "format": "int64", - "type": "integer", - }, - "Order": Object { - "properties": Object { - "complete": Object { - "default": false, - "description": "Indicates whenever order was completed or not", - "type": "boolean", - }, - "id": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Order ID", - }, - "petId": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Pet ID", - }, - "quantity": Object { - "default": 1, - "format": "int32", - "minimum": 1, - "type": "integer", - }, - "shipDate": Object { - "description": "Estimated ship date", - "format": "date-time", - "type": "string", - }, - "status": Object { - "description": "Order Status", - "enum": Array [ - "placed", - "approved", - "delivered", - ], - "type": "string", - }, - }, - "type": "object", - "xml": Object { - "name": "Order", - }, - }, - "Pet": Object { - "discriminator": Object { - "propertyName": "petType", - }, - "properties": Object { - "category": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Category", - }, - ], - "description": "Categories this pet belongs to", - }, - "id": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Pet ID", - }, - "name": Object { - "description": "The name given to a pet", - "example": "Guru", - "type": "string", - }, - "petType": Object { - "description": "Type of a pet", - "type": "string", - }, - "photoUrls": Object { - "description": "The list of URL to a cute photos featuring pet", - "items": Object { - "format": "url", - "type": "string", - }, - "type": "array", - "xml": Object { - "name": "photoUrl", - "wrapped": true, - }, - }, - "status": Object { - "description": "Pet status in the store", - "enum": Array [ - "available", - "pending", - "sold", - ], - "type": "string", - }, - "tags": Object { - "description": "Tags attached to the pet", - "items": Object { - "$ref": "#/components/schemas/Tag", - }, - "type": "array", - "xml": Object { - "name": "tag", - "wrapped": true, - }, - }, - }, - "required": Array [ - "name", - "photoUrls", - ], - "type": "object", - "xml": Object { - "name": "Pet", - }, - }, - "Tag": Object { - "properties": Object { - "id": Object { - "allOf": Array [ - Object { - "$ref": "#/components/schemas/Id", - }, - ], - "description": "Tag ID", - }, - "name": Object { - "description": "Tag name", - "minLength": 1, - "type": "string", - }, - }, - "type": "object", - "xml": Object { - "name": "Tag", - }, - }, - "User": Object { - "properties": Object { - "email": Object { - "description": "User email address", - "example": "john.smith@example.com", - "format": "email", - "type": "string", - }, - "firstName": Object { - "description": "User first name", - "example": "John", - "minLength": 1, - "type": "string", - }, - "id": Object { - "$ref": "#/components/schemas/Id", - }, - "lastName": Object { - "description": "User last name", - "example": "Smith", - "minLength": 1, - "type": "string", - }, - "password": Object { - "description": "User password, MUST contain a mix of upper and lower case letters, as well as digits", - "example": "drowssaP123", - "format": "password", - "minLength": 8, - "pattern": "(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])", - "type": "string", - }, - "phone": Object { - "description": "User phone number in international format", - "example": "+1-202-555-0192", - "nullable": true, - "pattern": "^\\\\+(?:[0-9]-?){6,14}[0-9]$", - "type": "string", - }, - "userStatus": Object { - "description": "User status", - "format": "int32", - "type": "integer", - }, - "username": Object { - "description": "User supplied username", - "example": "John78", - "minLength": 4, - "type": "string", - }, - }, - "type": "object", - "xml": Object { - "name": "User", - }, - }, - }, - "securitySchemes": Object { - "api_key": Object { - "description": "For this sample, you can use the api key \`special-key\` to test the authorization filters. -", - "in": "header", - "name": "api_key", - "type": "apiKey", - }, - "petstore_auth": Object { - "description": "Get access to data while protecting your account credentials. -OAuth2 is also a safer and more secure way to give you access. -", - "flows": Object { - "implicit": Object { - "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog", - "scopes": Object { - "read:pets": "read your pets", - "write:pets": "modify pets in your account", - }, - }, - }, - "type": "oauth2", - }, - }, - }, - "externalDocs": Object { - "description": "Find out how to create Github repo for your OpenAPI spec.", - "url": "https://github.com/Rebilly/generator-openapi-repo", - }, - "info": Object { - "contact": Object { - "email": "apiteam@swagger.io", - "url": "https://github.com/Redocly/redoc", - }, - "description": "This is a sample server Petstore server. -You can find out more about Swagger at -[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). -For this sample, you can use the api key \`special-key\` to test the authorization filters. -# Introduction -This API is documented in **OpenAPI format** and is based on -[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. -It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) -tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard -OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). -# OpenAPI Specification -This API is documented in **OpenAPI format** and is based on -[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. -It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) -tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard -OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). -# Cross-Origin Resource Sharing -This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). -And that allows cross-domain communication from the browser. -All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. -# Authentication -Petstore offers two forms of authentication: - - API Key - - OAuth2 - -OAuth2 - an open protocol to allow secure authorization in a simple -and standard method from web, mobile and desktop applications. - -", - "license": Object { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html", - }, - "termsOfService": "http://swagger.io/terms/", - "title": "Swagger Petstore", - "version": "1.0.0", - "x-logo": Object { - "altText": "Petstore logo", - "url": "https://redocly.github.io/redoc/petstore-logo.png", - }, - }, - "openapi": "3.0.0", - "paths": Object { - "/pet": Object { - "post": Object { - "description": "Add new pet to the store inventory.", - "operationId": "addPet", - "requestBody": Object { - "$ref": "#/components/requestBodies/Pet", - }, - "responses": Object { - "405": Object { - "description": "Invalid input", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Add a new pet to the store", - "tags": Array [ - "pet", - ], - "x-code-samples": Array [ - Object { - "lang": "C#", - "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); -pet.setApiKey(\\"your api key\\"); -pet.petType = PetStore.v1.Pet.TYPE_DOG; -pet.name = \\"Rex\\"; -// set other fields -PetStoreResponse response = pet.create(); -if (response.statusCode == HttpStatusCode.Created) -{ - // Successfully created -} -else -{ - // Something wrong -- check response for errors - Console.WriteLine(response.getRawResponse()); -} -", - }, - Object { - "lang": "PHP", - "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); -$form->setPetType(\\"Dog\\"); -$form->setName(\\"Rex\\"); -// set other fields -try { - $pet = $client->pets()->create($form); -} catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); -} -", - }, - ], - }, - "put": Object { - "description": "", - "operationId": "updatePet", - "requestBody": Object { - "$ref": "#/components/requestBodies/Pet", - }, - "responses": Object { - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Pet not found", - }, - "405": Object { - "description": "Validation exception", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Update an existing pet", - "tags": Array [ - "pet", - ], - "x-code-samples": Array [ - Object { - "lang": "PHP", - "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); -$form->setPetId(1); -$form->setPetType(\\"Dog\\"); -$form->setName(\\"Rex\\"); -// set other fields -try { - $pet = $client->pets()->update($form); -} catch (UnprocessableEntityException $e) { - var_dump($e->getErrors()); -} -", - }, - ], - }, - }, - "/pet/findByStatus": Object { - "get": Object { - "description": "Multiple status values can be provided with comma separated strings", - "operationId": "findPetsByStatus", - "parameters": Array [ - Object { - "description": "Status values that need to be considered for filter", - "explode": false, - "in": "query", - "name": "status", - "required": true, - "schema": Object { - "items": Object { - "default": "available", - "enum": Array [ - "available", - "pending", - "sold", - ], - "type": "string", - }, - "type": "array", - }, - "style": "form", - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - "application/xml": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid status value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Finds Pets by status", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/findByTags": Object { - "get": Object { - "deprecated": true, - "description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", - "operationId": "findPetsByTags", - "parameters": Array [ - Object { - "description": "Tags to filter by", - "explode": false, - "in": "query", - "name": "tags", - "required": true, - "schema": Object { - "items": Object { - "type": "string", - }, - "type": "array", - }, - "style": "form", - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - "application/xml": Object { - "schema": Object { - "items": Object { - "$ref": "#/components/schemas/Pet", - }, - "type": "array", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid tag value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Finds Pets by tags", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/{petId}": Object { - "delete": Object { - "description": "", - "operationId": "deletePet", - "parameters": Array [ - Object { - "example": "Bearer ", - "in": "header", - "name": "api_key", - "required": false, - "schema": Object { - "type": "string", - }, - }, - Object { - "description": "Pet id to delete", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "responses": Object { - "400": Object { - "description": "Invalid pet value", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Deletes a pet", - "tags": Array [ - "pet", - ], - }, - "get": Object { - "description": "Returns a single pet", - "operationId": "getPetById", - "parameters": Array [ - Object { - "description": "ID of pet to return", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Pet", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Pet not found", - }, - }, - "security": Array [ - Object { - "api_key": Array [], - }, - ], - "summary": "Find pet by ID", - "tags": Array [ - "pet", - ], - }, - "post": Object { - "description": "", - "operationId": "updatePetWithForm", - "parameters": Array [ - Object { - "description": "ID of pet that needs to be updated", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "requestBody": Object { - "content": Object { - "application/x-www-form-urlencoded": Object { - "schema": Object { - "properties": Object { - "name": Object { - "description": "Updated name of the pet", - "type": "string", - }, - "status": Object { - "description": "Updated status of the pet", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "405": Object { - "description": "Invalid input", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "Updates a pet in the store with form data", - "tags": Array [ - "pet", - ], - }, - }, - "/pet/{petId}/uploadImage": Object { - "post": Object { - "description": "", - "operationId": "uploadFile", - "parameters": Array [ - Object { - "description": "ID of pet to update", - "in": "path", - "name": "petId", - "required": true, - "schema": Object { - "format": "int64", - "type": "integer", - }, - }, - ], - "requestBody": Object { - "content": Object { - "multipart/form-data": Object { - "schema": Object { - "properties": Object { - "additionalMetadata": Object { - "description": "Additional data to pass to server", - "type": "string", - }, - "file": Object { - "description": "file to upload", - "format": "binary", - "type": "string", - }, - }, - "type": "object", - }, - }, - }, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/ApiResponse", - }, - }, - }, - "description": "successful operation", - }, - }, - "security": Array [ - Object { - "petstore_auth": Array [ - "write:pets", - "read:pets", - ], - }, - ], - "summary": "uploads an image", - "tags": Array [ - "pet", - ], - }, - }, - "/store/inventory": Object { - "get": Object { - "description": "Returns a map of status codes to quantities", - "operationId": "getInventory", - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "additionalProperties": Object { - "format": "int32", - "type": "integer", - }, - "type": "object", - }, - }, - }, - "description": "successful operation", - }, - }, - "security": Array [ - Object { - "api_key": Array [], - }, - ], - "summary": "Returns pet inventories by status", - "tags": Array [ - "store", - ], - }, - }, - "/store/order": Object { - "post": Object { - "description": "", - "operationId": "placeOrder", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "order placed for purchasing the pet", - "required": true, - }, - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid Order", - }, - }, - "summary": "Place an order for a pet", - "tags": Array [ - "store", - ], - }, - }, - "/store/order/{orderId}": Object { - "delete": Object { - "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", - "operationId": "deleteOrder", - "parameters": Array [ - Object { - "description": "ID of the order that needs to be deleted", - "in": "path", - "name": "orderId", - "required": true, - "schema": Object { - "minimum": 1, - "type": "string", - }, - }, - ], - "responses": Object { - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Order not found", - }, - }, - "summary": "Delete purchase order by ID", - "tags": Array [ - "store", - ], - }, - "get": Object { - "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", - "operationId": "getOrderById", - "parameters": Array [ - Object { - "description": "ID of pet that needs to be fetched", - "in": "path", - "name": "orderId", - "required": true, - "schema": Object { - "format": "int64", - "maximum": 5, - "minimum": 1, - "type": "integer", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/Order", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid ID supplied", - }, - "404": Object { - "description": "Order not found", - }, - }, - "summary": "Find purchase order by ID", - "tags": Array [ - "store", - ], - }, - }, - "/user": Object { - "post": Object { - "description": "This can only be done by the logged in user.", - "operationId": "createUser", - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "Created user object", - "required": true, - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Create user", - "tags": Array [ - "user", - ], - }, - }, - "/user/createWithArray": Object { - "post": Object { - "description": "", - "operationId": "createUsersWithArrayInput", - "requestBody": Object { - "$ref": "#/components/requestBodies/UserArray", - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Creates list of users with given input array", - "tags": Array [ - "user", - ], - }, - }, - "/user/createWithList": Object { - "post": Object { - "description": "", - "operationId": "createUsersWithListInput", - "requestBody": Object { - "$ref": "#/components/requestBodies/UserArray", - }, - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Creates list of users with given input array", - "tags": Array [ - "user", - ], - }, - }, - "/user/login": Object { - "get": Object { - "description": "", - "operationId": "loginUser", - "parameters": Array [ - Object { - "description": "The user name for login", - "in": "query", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - Object { - "description": "The password for login in clear text", - "in": "query", - "name": "password", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "examples": Object { - "response": Object { - "value": "OK", - }, - }, - "schema": Object { - "type": "string", - }, - }, - "application/xml": Object { - "examples": Object { - "response": Object { - "value": " OK ", - }, - }, - "schema": Object { - "type": "string", - }, - }, - "text/plain": Object { - "examples": Object { - "response": Object { - "value": "OK", - }, - }, - }, - }, - "description": "successful operation", - "headers": Object { - "X-Expires-After": Object { - "description": "date in UTC when token expires", - "schema": Object { - "format": "date-time", - "type": "string", - }, - }, - "X-Rate-Limit": Object { - "description": "calls per hour allowed by the user", - "schema": Object { - "format": "int32", - "type": "integer", - }, - }, - }, - }, - "400": Object { - "description": "Invalid username/password supplied", - }, - }, - "summary": "Logs user into the system", - "tags": Array [ - "user", - ], - }, - }, - "/user/logout": Object { - "get": Object { - "description": "", - "operationId": "logoutUser", - "responses": Object { - "default": Object { - "description": "successful operation", - }, - }, - "summary": "Logs out current logged in user session", - "tags": Array [ - "user", - ], - }, - }, - "/user/{username}": Object { - "delete": Object { - "description": "This can only be done by the logged in user.", - "operationId": "deleteUser", - "parameters": Array [ - Object { - "description": "The name that needs to be deleted", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "400": Object { - "description": "Invalid username supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Delete user", - "tags": Array [ - "user", - ], - }, - "get": Object { - "description": "", - "operationId": "getUserByName", - "parameters": Array [ - Object { - "description": "The name that needs to be fetched. Use user1 for testing. ", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "responses": Object { - "200": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - "application/xml": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "successful operation", - }, - "400": Object { - "description": "Invalid username supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Get user by user name", - "tags": Array [ - "user", - ], - }, - "put": Object { - "description": "This can only be done by the logged in user.", - "operationId": "updateUser", - "parameters": Array [ - Object { - "description": "name that need to be deleted", - "in": "path", - "name": "username", - "required": true, - "schema": Object { - "type": "string", - }, - }, - ], - "requestBody": Object { - "content": Object { - "application/json": Object { - "schema": Object { - "$ref": "#/components/schemas/User", - }, - }, - }, - "description": "Updated user object", - "required": true, - }, - "responses": Object { - "400": Object { - "description": "Invalid user supplied", - }, - "404": Object { - "description": "User not found", - }, - }, - "summary": "Updated user", - "tags": Array [ - "user", - ], - }, - }, - }, - "servers": Array [ - Object { - "description": "Default server", - "url": "//petstore.swagger.io/v2", - }, - Object { - "description": "Sandbox server", - "url": "//petstore.swagger.io/sandbox", - }, - ], - "tags": Array [ - Object { - "description": "Everything about your Pets", - "name": "pet", - }, - Object { - "description": "Access to Petstore orders", - "name": "store", - }, - Object { - "description": "Operations about user", - "name": "user", - }, - ], - "x-tagGroups": Array [ - Object { - "name": "General", - "tags": Array [ - "pet", - "store", - ], - }, - Object { - "name": "User Management", - "tags": Array [ - "user", - ], - }, - ], -} -`; +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`#loadAndBundleSpec should load And Bundle Spec demo/openapi.yaml 1`] = ` +Object { + "components": Object { + "examples": Object { + "Order": Object { + "value": Object { + "complete": false, + "quantity": 1, + "shipDate": "2018-10-19T16:46:45Z", + "status": "placed", + }, + }, + }, + "requestBodies": Object { + "Pet": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "allOf": Array [ + Object { + "description": "My Pet", + "title": "Pettie", + }, + Object { + "$ref": "#/components/schemas/Pet", + }, + ], + }, + }, + "application/xml": Object { + "schema": Object { + "properties": Object { + "name": Object { + "description": "hooray", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + "description": "Pet object that needs to be added to the store", + "required": true, + }, + "UserArray": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/User", + }, + "type": "array", + }, + }, + }, + "description": "List of user object", + "required": true, + }, + }, + "schemas": Object { + "ApiResponse": Object { + "properties": Object { + "code": Object { + "format": "int32", + "type": "integer", + }, + "message": Object { + "type": "string", + }, + "type": Object { + "type": "string", + }, + }, + "type": "object", + }, + "Cat": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "huntingSkill": Object { + "default": "lazy", + "description": "The measured skill for hunting", + "enum": Array [ + "clueless", + "lazy", + "adventurous", + "aggressive", + ], + "example": "adventurous", + "type": "string", + }, + }, + "required": Array [ + "huntingSkill", + ], + "type": "object", + }, + ], + "description": "A representation of a cat", + }, + "Category": Object { + "properties": Object { + "id": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Category ID", + }, + "name": Object { + "description": "Category name", + "minLength": 1, + "type": "string", + }, + "sub": Object { + "description": "Test Sub Category", + "properties": Object { + "prop1": Object { + "description": "Dumb Property", + "type": "string", + }, + }, + "type": "object", + }, + }, + "type": "object", + "xml": Object { + "name": "Category", + }, + }, + "Dog": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "packSize": Object { + "default": 1, + "description": "The size of the pack the dog is from", + "format": "int32", + "minimum": 1, + "type": "integer", + }, + }, + "required": Array [ + "packSize", + ], + "type": "object", + }, + ], + "description": "A representation of a dog", + }, + "HoneyBee": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "honeyPerDay": Object { + "description": "Average amount of honey produced per day in ounces", + "example": 3.14, + "multipleOf": 0.01, + "type": "number", + }, + }, + "required": Array [ + "honeyPerDay", + ], + "type": "object", + }, + ], + "description": "A representation of a honey bee", + }, + "Id": Object { + "format": "int64", + "readOnly": true, + "type": "integer", + }, + "Order": Object { + "properties": Object { + "complete": Object { + "default": false, + "description": "Indicates whenever order was completed or not", + "readOnly": true, + "type": "boolean", + }, + "id": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Order ID", + }, + "petId": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Pet ID", + }, + "quantity": Object { + "default": 1, + "format": "int32", + "minimum": 1, + "type": "integer", + }, + "requestId": Object { + "description": "Unique Request Id", + "type": "string", + "writeOnly": true, + }, + "shipDate": Object { + "description": "Estimated ship date", + "format": "date-time", + "type": "string", + }, + "status": Object { + "description": "Order Status", + "enum": Array [ + "placed", + "approved", + "delivered", + ], + "type": "string", + }, + }, + "type": "object", + "xml": Object { + "name": "Order", + }, + }, + "Pet": Object { + "discriminator": Object { + "mapping": Object { + "bee": "#/components/schemas/HoneyBee", + "cat": "#/components/schemas/Cat", + "dog": "#/components/schemas/Dog", + }, + "propertyName": "petType", + }, + "properties": Object { + "category": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Category", + }, + ], + "description": "Categories this pet belongs to", + }, + "friend": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + ], + }, + "id": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Pet ID", + "externalDocs": Object { + "description": "Find more info here", + "url": "https://example.com", + }, + }, + "name": Object { + "description": "The name given to a pet", + "example": "Guru", + "type": "string", + }, + "petType": Object { + "description": "Type of a pet", + "type": "string", + }, + "photoUrls": Object { + "description": "The list of URL to a cute photos featuring pet", + "items": Object { + "format": "url", + "type": "string", + }, + "maxItems": 20, + "type": "array", + "xml": Object { + "name": "photoUrl", + "wrapped": true, + }, + }, + "status": Object { + "description": "Pet status in the store", + "enum": Array [ + "available", + "pending", + "sold", + ], + "type": "string", + }, + "tags": Object { + "description": "Tags attached to the pet", + "items": Object { + "$ref": "#/components/schemas/Tag", + }, + "minItems": 1, + "type": "array", + "xml": Object { + "name": "tag", + "wrapped": true, + }, + }, + }, + "required": Array [ + "name", + "photoUrls", + ], + "type": "object", + "xml": Object { + "name": "Pet", + }, + }, + "Tag": Object { + "properties": Object { + "id": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Tag ID", + }, + "name": Object { + "description": "Tag name", + "minLength": 1, + "type": "string", + }, + }, + "type": "object", + "xml": Object { + "name": "Tag", + }, + }, + "User": Object { + "properties": Object { + "addresses": Object { + "additionalItems": Object { + "type": "string", + }, + "items": Array [ + Object { + "properties": Object { + "city": Object { + "minLength": 0, + "type": "string", + }, + "country": Object { + "minLength": 0, + "type": "string", + }, + "street": Object { + "description": "includes build/apartment number", + "minLength": 0, + "type": "string", + }, + }, + "type": "object", + }, + Object { + "type": "number", + }, + ], + "maxLength": 10, + "minItems": 0, + "type": "array", + }, + "email": Object { + "description": "User email address", + "example": "john.smith@example.com", + "format": "email", + "type": "string", + }, + "firstName": Object { + "description": "User first name", + "example": "John", + "minLength": 1, + "type": "string", + }, + "id": Object { + "$ref": "#/components/schemas/Id", + }, + "lastName": Object { + "description": "User last name", + "example": "Smith", + "minLength": 1, + "type": "string", + }, + "password": Object { + "description": "User password, MUST contain a mix of upper and lower case letters, as well as digits", + "example": "drowssaP123", + "format": "password", + "minLength": 8, + "pattern": "/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/", + "type": "string", + }, + "pet": Object { + "oneOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "$ref": "#/components/schemas/Tag", + }, + ], + }, + "phone": Object { + "description": "User phone number in international format", + "example": "+1-202-555-0192", + "pattern": "/^\\\\+(?:[0-9]-?){6,14}[0-9]$/", + "type": "string", + }, + "userStatus": Object { + "description": "User status", + "format": "int32", + "type": "integer", + }, + "username": Object { + "description": "User supplied username", + "example": "John78", + "minLength": 4, + "type": "string", + }, + }, + "type": "object", + "xml": Object { + "name": "User", + }, + }, + }, + "securitySchemes": Object { + "api_key": Object { + "description": "For this sample, you can use the api key \`special-key\` to test the authorization filters. +", + "in": "header", + "name": "api_key", + "type": "apiKey", + }, + "petstore_auth": Object { + "description": "Get access to data while protecting your account credentials. +OAuth2 is also a safer and more secure way to give you access. +", + "flows": Object { + "implicit": Object { + "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog", + "scopes": Object { + "read:pets": "read your pets", + "write:pets": "modify pets in your account", + }, + }, + }, + "type": "oauth2", + }, + }, + }, + "externalDocs": Object { + "description": "Find out how to create Github repo for your OpenAPI spec.", + "url": "https://github.com/Rebilly/generator-openapi-repo", + }, + "info": Object { + "contact": Object { + "email": "apiteam@swagger.io", + "name": "API Support", + "url": "https://github.com/Redocly/redoc", + }, + "description": "This is a sample server Petstore server. +You can find out more about Swagger at +[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). +For this sample, you can use the api key \`special-key\` to test the authorization filters. + +# Introduction +This API is documented in **OpenAPI format** and is based on +[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. +It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) +tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard +OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). + +# OpenAPI Specification +This API is documented in **OpenAPI format** and is based on +[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. +It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) +tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard +OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). + +# Cross-Origin Resource Sharing +This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). +And that allows cross-domain communication from the browser. +All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. + +# Authentication + +Petstore offers two forms of authentication: + - API Key + - OAuth2 +OAuth2 - an open protocol to allow secure authorization in a simple +and standard method from web, mobile and desktop applications. + + +", + "license": Object { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html", + }, + "termsOfService": "http://swagger.io/terms/", + "title": "Swagger Petstore", + "version": "1.0.0", + "x-logo": Object { + "altText": "Petstore logo", + "url": "https://redocly.github.io/redoc/petstore-logo.png", + }, + }, + "openapi": "3.0.0", + "paths": Object { + "/pet": Object { + "parameters": Array [ + Object { + "description": "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US", + "example": "en-US", + "in": "header", + "name": "Accept-Language", + "required": false, + "schema": Object { + "default": "en-AU", + "type": "string", + }, + }, + Object { + "description": "Some cookie", + "in": "cookie", + "name": "cookieParam", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "post": Object { + "description": "Add new pet to the store inventory.", + "operationId": "addPet", + "requestBody": Object { + "$ref": "#/components/requestBodies/Pet", + }, + "responses": Object { + "405": Object { + "description": "Invalid input", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Add a new pet to the store", + "tags": Array [ + "pet", + ], + "x-codeSamples": Array [ + Object { + "lang": "C#", + "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); +pet.setApiKey(\\"your api key\\"); +pet.petType = PetStore.v1.Pet.TYPE_DOG; +pet.name = \\"Rex\\"; +// set other fields +PetStoreResponse response = pet.create(); +if (response.statusCode == HttpStatusCode.Created) +{ + // Successfully created +} +else +{ + // Something wrong -- check response for errors + Console.WriteLine(response.getRawResponse()); +} +", + }, + Object { + "lang": "PHP", + "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); +$form->setPetType(\\"Dog\\"); +$form->setName(\\"Rex\\"); +// set other fields +try { + $pet = $client->pets()->create($form); +} catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); +} +", + }, + ], + }, + "put": Object { + "description": "", + "operationId": "updatePet", + "requestBody": Object { + "$ref": "#/components/requestBodies/Pet", + }, + "responses": Object { + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Pet not found", + }, + "405": Object { + "description": "Validation exception", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Update an existing pet", + "tags": Array [ + "pet", + ], + "x-codeSamples": Array [ + Object { + "lang": "PHP", + "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); +$form->setPetId(1); +$form->setPetType(\\"Dog\\"); +$form->setName(\\"Rex\\"); +// set other fields +try { + $pet = $client->pets()->update($form); +} catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); +} +", + }, + ], + }, + }, + "/pet/findByStatus": Object { + "get": Object { + "description": "Multiple status values can be provided with comma separated strings", + "operationId": "findPetsByStatus", + "parameters": Array [ + Object { + "description": "Status values that need to be considered for filter", + "in": "query", + "name": "status", + "required": true, + "schema": Object { + "items": Object { + "default": "available", + "enum": Array [ + "available", + "pending", + "sold", + ], + "type": "string", + }, + "maxItems": 3, + "minItems": 1, + "type": "array", + }, + "style": "form", + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + "application/xml": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid status value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Finds Pets by status", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/findByTags": Object { + "get": Object { + "deprecated": true, + "description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + "operationId": "findPetsByTags", + "parameters": Array [ + Object { + "description": "Tags to filter by", + "in": "query", + "name": "tags", + "required": true, + "schema": Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + "style": "form", + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + "application/xml": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + "maxItems": 111, + }, + "maxItems": 999, + "type": "array", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid tag value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Finds Pets by tags", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/{petId}": Object { + "delete": Object { + "description": "", + "operationId": "deletePet", + "parameters": Array [ + Object { + "example": "Bearer ", + "in": "header", + "name": "api_key", + "required": false, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "Pet id to delete", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "responses": Object { + "400": Object { + "description": "Invalid pet value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Deletes a pet", + "tags": Array [ + "pet", + ], + }, + "get": Object { + "description": "Returns a single pet", + "operationId": "getPetById", + "parameters": Array [ + Object { + "deprecated": true, + "description": "ID of pet to return", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Pet not found", + }, + }, + "security": Array [ + Object { + "api_key": Array [], + }, + ], + "summary": "Find pet by ID", + "tags": Array [ + "pet", + ], + }, + "post": Object { + "description": "", + "operationId": "updatePetWithForm", + "parameters": Array [ + Object { + "description": "ID of pet that needs to be updated", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/x-www-form-urlencoded": Object { + "schema": Object { + "properties": Object { + "name": Object { + "description": "Updated name of the pet", + "type": "string", + }, + "status": Object { + "description": "Updated status of the pet", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "405": Object { + "description": "Invalid input", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Updates a pet in the store with form data", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/{petId}/uploadImage": Object { + "post": Object { + "description": "", + "operationId": "uploadFile", + "parameters": Array [ + Object { + "description": "ID of pet to update", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/octet-stream": Object { + "schema": Object { + "format": "binary", + "type": "string", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/ApiResponse", + }, + }, + }, + "description": "successful operation", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "uploads an image", + "tags": Array [ + "pet", + ], + }, + }, + "/store/inventory": Object { + "get": Object { + "description": "Returns a map of status codes to quantities", + "operationId": "getInventory", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "additionalProperties": Object { + "format": "int32", + "type": "integer", + }, + "minProperties": 2, + "type": "object", + }, + }, + }, + "description": "successful operation", + }, + }, + "security": Array [ + Object { + "api_key": Array [], + }, + ], + "summary": "Returns pet inventories by status", + "tags": Array [ + "store", + ], + }, + }, + "/store/order": Object { + "post": Object { + "description": "", + "operationId": "placeOrder", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "order placed for purchasing the pet", + "required": true, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "content": Object { + "application/json": Object { + "example": Object { + "message": "Invalid Order", + "status": 400, + }, + }, + }, + "description": "Invalid Order", + }, + }, + "summary": "Place an order for a pet", + "tags": Array [ + "store", + ], + }, + }, + "/store/order/{orderId}": Object { + "delete": Object { + "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "operationId": "deleteOrder", + "parameters": Array [ + Object { + "description": "ID of the order that needs to be deleted", + "in": "path", + "name": "orderId", + "required": true, + "schema": Object { + "minimum": 1, + "type": "string", + }, + }, + ], + "responses": Object { + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Order not found", + }, + }, + "summary": "Delete purchase order by ID", + "tags": Array [ + "store", + ], + }, + "get": Object { + "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + "operationId": "getOrderById", + "parameters": Array [ + Object { + "description": "ID of pet that needs to be fetched", + "in": "path", + "name": "orderId", + "required": true, + "schema": Object { + "format": "int64", + "maximum": 5, + "minimum": 1, + "type": "integer", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Order not found", + }, + }, + "summary": "Find purchase order by ID", + "tags": Array [ + "store", + ], + }, + }, + "/store/subscribe": Object { + "post": Object { + "callbacks": Object { + "orderDelivered": Object { + "http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}": Object { + "post": Object { + "deprecated": true, + "description": "A callback triggered every time an Order is delivered to the recipient", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + "timestamp": Object { + "example": "2018-10-19T16:46:45Z", + "format": "date-time", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "description": "Callback successfully processed and no retries will be performed", + }, + }, + "summary": "Order delivered", + }, + }, + }, + "orderInProgress": Object { + "{$request.body#/callbackUrl}?event={$request.body#/eventName}": Object { + "post": Object { + "description": "A callback triggered every time an Order is updated status to \\"inProgress\\" (Description)", + "externalDocs": Object { + "description": "Find out more", + "url": "https://more-details.com/demo", + }, + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + "status": Object { + "example": "inProgress", + "type": "string", + }, + "timestamp": Object { + "example": "2018-10-19T16:46:45Z", + "format": "date-time", + "type": "string", + }, + }, + "type": "object", + }, + }, + "application/xml": Object { + "example": " + + 123 + inProgress + 2018-10-19T16:46:45Z + +", + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "someProp": Object { + "example": "123", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + "description": "Callback successfully processed and no retries will be performed", + }, + "299": Object { + "description": "Response for cancelling subscription", + }, + "500": Object { + "description": "Callback processing failed and retries will be performed", + }, + }, + "summary": "Order in Progress (Summary)", + "x-codeSamples": Array [ + Object { + "lang": "C#", + "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); +pet.setApiKey(\\"your api key\\"); +pet.petType = PetStore.v1.Pet.TYPE_DOG; +pet.name = \\"Rex\\"; +// set other fields +PetStoreResponse response = pet.create(); +if (response.statusCode == HttpStatusCode.Created) +{ + // Successfully created +} +else +{ + // Something wrong -- check response for errors + Console.WriteLine(response.getRawResponse()); +} +", + }, + Object { + "lang": "PHP", + "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); +$form->setPetType(\\"Dog\\"); +$form->setName(\\"Rex\\"); +// set other fields +try { + $pet = $client->pets()->create($form); +} catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); +} +", + }, + ], + }, + "put": Object { + "description": "Order in Progress (Only Description)", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + "status": Object { + "example": "inProgress", + "type": "string", + }, + "timestamp": Object { + "example": "2018-10-19T16:46:45Z", + "format": "date-time", + "type": "string", + }, + }, + "type": "object", + }, + }, + "application/xml": Object { + "example": " + + 123 + inProgress + 2018-10-19T16:46:45Z + +", + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "someProp": Object { + "example": "123", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + "description": "Callback successfully processed and no retries will be performed", + }, + }, + "servers": Array [ + Object { + "description": "Operation level server 1 (Operation override)", + "url": "//callback-url.operation-level/v1", + }, + Object { + "description": "Operation level server 2 (Operation override)", + "url": "//callback-url.operation-level/v2", + }, + ], + }, + "servers": Array [ + Object { + "description": "Path level server 1", + "url": "//callback-url.path-level/v1", + }, + Object { + "description": "Path level server 2", + "url": "//callback-url.path-level/v2", + }, + ], + }, + }, + "orderShipped": Object { + "{$request.body#/callbackUrl}?event={$request.body#/eventName}": Object { + "post": Object { + "description": "Very long description +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor +incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis +nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu +fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in +culpa qui officia deserunt mollit anim id est laborum. +", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "estimatedDeliveryDate": Object { + "example": "2018-11-11T16:00:00Z", + "format": "date-time", + "type": "string", + }, + "orderId": Object { + "example": "123", + "type": "string", + }, + "timestamp": Object { + "example": "2018-10-19T16:46:45Z", + "format": "date-time", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "description": "Callback successfully processed and no retries will be performed", + }, + }, + }, + }, + }, + }, + "description": "Add subscription for a store events", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "callbackUrl": Object { + "description": "This URL will be called by the server when the desired event will occur", + "example": "https://myserver.com/send/callback/here", + "format": "uri", + "type": "string", + }, + "eventName": Object { + "description": "Event name for the subscription", + "enum": Array [ + "orderInProgress", + "orderShipped", + "orderDelivered", + ], + "example": "orderInProgress", + "type": "string", + }, + }, + "required": Array [ + "callbackUrl", + "eventName", + ], + "type": "object", + }, + }, + }, + }, + "responses": Object { + "201": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "subscriptionId": Object { + "example": "AAA-123-BBB-456", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + "description": "Subscription added", + }, + }, + "summary": "Subscribe to the Store events", + "tags": Array [ + "store", + ], + }, + }, + "/user": Object { + "post": Object { + "description": "This can only be done by the logged in user.", + "operationId": "createUser", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "Created user object", + "required": true, + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Create user", + "tags": Array [ + "user", + ], + }, + }, + "/user/createWithArray": Object { + "post": Object { + "description": "", + "operationId": "createUsersWithArrayInput", + "requestBody": Object { + "$ref": "#/components/requestBodies/UserArray", + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Creates list of users with given input array", + "tags": Array [ + "user", + ], + }, + }, + "/user/createWithList": Object { + "post": Object { + "description": "", + "operationId": "createUsersWithListInput", + "requestBody": Object { + "$ref": "#/components/requestBodies/UserArray", + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Creates list of users with given input array", + "tags": Array [ + "user", + ], + }, + }, + "/user/login": Object { + "get": Object { + "description": "", + "operationId": "loginUser", + "parameters": Array [ + Object { + "description": "The user name for login", + "in": "query", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "The password for login in clear text", + "in": "query", + "name": "password", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "examples": Object { + "response": Object { + "value": "OK", + }, + }, + "schema": Object { + "type": "string", + }, + }, + "application/xml": Object { + "examples": Object { + "response": Object { + "value": " OK ", + }, + }, + "schema": Object { + "type": "string", + }, + }, + "text/plain": Object { + "examples": Object { + "response": Object { + "value": "OK", + }, + }, + }, + }, + "description": "successful operation", + "headers": Object { + "X-Expires-After": Object { + "description": "date in UTC when token expires", + "schema": Object { + "format": "date-time", + "type": "string", + }, + }, + "X-Rate-Limit": Object { + "description": "calls per hour allowed by the user", + "schema": Object { + "format": "int32", + "type": "integer", + }, + }, + }, + }, + "400": Object { + "description": "Invalid username/password supplied", + }, + }, + "summary": "Logs user into the system", + "tags": Array [ + "user", + ], + }, + }, + "/user/logout": Object { + "get": Object { + "description": "", + "operationId": "logoutUser", + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Logs out current logged in user session", + "tags": Array [ + "user", + ], + }, + }, + "/user/{username}": Object { + "delete": Object { + "description": "This can only be done by the logged in user.", + "operationId": "deleteUser", + "parameters": Array [ + Object { + "description": "The name that needs to be deleted", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "400": Object { + "description": "Invalid username supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Delete user", + "tags": Array [ + "user", + ], + }, + "get": Object { + "description": "", + "operationId": "getUserByName", + "parameters": Array [ + Object { + "description": "The name that needs to be fetched. Use user1 for testing. ", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid username supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Get user by user name", + "tags": Array [ + "user", + ], + }, + "put": Object { + "description": "This can only be done by the logged in user.", + "operationId": "updateUser", + "parameters": Array [ + Object { + "description": "name that need to be deleted", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "Updated user object", + "required": true, + }, + "responses": Object { + "400": Object { + "description": "Invalid user supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Updated user", + "tags": Array [ + "user", + ], + }, + }, + }, + "security": Array [ + Object {}, + ], + "servers": Array [ + Object { + "description": "Default server", + "url": "//petstore.swagger.io/v2", + }, + Object { + "description": "Sandbox server", + "url": "//petstore.swagger.io/sandbox", + }, + ], + "tags": Array [ + Object { + "description": "Everything about your Pets", + "name": "pet", + }, + Object { + "description": "Access to Petstore orders", + "name": "store", + }, + Object { + "description": "Operations about user", + "name": "user", + }, + Object { + "description": " +", + "name": "pet_model", + "x-displayName": "The Pet Model", + }, + Object { + "description": " +", + "name": "store_model", + "x-displayName": "The Order Model", + }, + ], + "x-tagGroups": Array [ + Object { + "name": "General", + "tags": Array [ + "pet", + "store", + ], + }, + Object { + "name": "User Management", + "tags": Array [ + "user", + ], + }, + Object { + "name": "Models", + "tags": Array [ + "pet_model", + "store_model", + ], + }, + ], + "x-webhooks": Object { + "newPet": Object { + "post": Object { + "description": "Information about a new pet in the systems", + "operationId": "newPet", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "description": "Return a 200 status to indicate that the data was received successfully", + }, + }, + "summary": "New pet", + "tags": Array [ + "pet", + ], + }, + }, + }, +} +`; + +exports[`#loadAndBundleSpec should load And Bundle Spec demo/openapi-3-1.yaml 1`] = ` +Object { + "components": Object { + "examples": Object { + "Order": Object { + "value": Object { + "complete": false, + "quantity": 1, + "shipDate": "2018-10-19T16:46:45Z", + "status": "placed", + }, + }, + }, + "pathItems": Object { + "webhooks": Object { + "post": Object { + "description": "Info about new cat", + "operationId": "createdCat", + "requestBody": Object { + "content": Object { + "multipart/form-data": Object { + "schema": Object { + "$ref": "#/components/schemas/Cat", + }, + }, + }, + "description": "Information about cat in the system", + }, + "responses": Object { + "200": Object { + "description": "create Cat details", + }, + }, + "summary": "Create new cat", + "tags": Array [ + "webhooks", + ], + }, + "put": Object { + "description": "Get a cat details after update", + "operationId": "updatedCat", + "requestBody": Object { + "content": Object { + "multipart/form-data": Object { + "schema": Object { + "$ref": "#/components/schemas/Cat", + }, + }, + }, + "description": "Information about cat in the system", + }, + "responses": Object { + "200": Object { + "description": "update Cat details", + }, + }, + "summary": "Get a cat details after update", + "tags": Array [ + "webhooks", + ], + }, + }, + }, + "requestBodies": Object { + "Pet": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + "description": "My Pet", + "title": "Pettie", + }, + }, + "application/xml": Object { + "schema": Object { + "properties": Object { + "name": Object { + "description": "hooray", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + "description": "Pet object that needs to be added to the store", + "required": true, + }, + "UserArray": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/User", + }, + "type": "array", + }, + }, + }, + "description": "List of user object", + "required": true, + }, + }, + "schemas": Object { + "ApiResponse": Object { + "patternProperties": Object { + "^O_\\\\\\\\w+\\\\\\\\.[1-9]{2,4}$": Object { + "properties": Object { + "nestedProperty": Object { + "default": "lazy", + "description": "The measured skill for hunting", + "enum": Array [ + "clueless", + "lazy", + "adventurous", + "aggressive", + ], + "example": "adventurous", + "type": Array [ + "string", + "boolean", + ], + }, + }, + "type": "object", + }, + "^S_\\\\\\\\w+\\\\\\\\.[1-9]{2,4}$": Object { + "description": "The measured skill for hunting", + "else": Object { + "maxLength": 10, + "minLength": 1, + }, + "if": Object { + "x-displayName": "fieldName === 'status'", + }, + "then": Object { + "enum": Array [ + "success", + "failed", + ], + "format": "url", + "type": "string", + }, + }, + }, + "properties": Object { + "code": Object { + "format": "int32", + "type": "integer", + }, + "message": Object { + "type": "string", + }, + "type": Object { + "type": "string", + }, + }, + "type": "object", + }, + "Cat": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "huntingSkill": Object { + "default": "lazy", + "description": "The measured skill for hunting", + "enum": Array [ + "clueless", + "lazy", + "adventurous", + "aggressive", + ], + "example": "adventurous", + "type": Array [ + "string", + "boolean", + ], + }, + }, + "required": Array [ + "huntingSkill", + ], + "type": "object", + }, + ], + "description": "A representation of a cat", + }, + "Category": Object { + "properties": Object { + "id": Object { + "$ref": "#/components/schemas/Id", + "description": "Category ID", + }, + "name": Object { + "description": "Category name", + "minLength": 1, + "type": "string", + }, + "sub": Object { + "description": "Test Sub Category", + "properties": Object { + "prop1": Object { + "description": "Dumb Property", + "type": "string", + }, + }, + "type": "object", + }, + }, + "type": "object", + "xml": Object { + "name": "Category", + }, + }, + "Dog": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "packSize": Object { + "default": 1, + "description": "The size of the pack the dog is from", + "format": "int32", + "minimum": 1, + "type": "integer", + }, + }, + "required": Array [ + "packSize", + ], + "type": "object", + }, + ], + "description": "A representation of a dog", + }, + "HoneyBee": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "honeyPerDay": Object { + "description": "Average amount of honey produced per day in ounces", + "example": 3.14, + "multipleOf": 0.01, + "type": "number", + }, + }, + "required": Array [ + "honeyPerDay", + ], + "type": "object", + }, + ], + "description": "A representation of a honey bee", + }, + "Id": Object { + "format": "int64", + "readOnly": true, + "type": "integer", + }, + "Order": Object { + "properties": Object { + "complete": Object { + "default": false, + "description": "Indicates whenever order was completed or not", + "readOnly": true, + "type": "boolean", + }, + "id": Object { + "$ref": "#/components/schemas/Id", + "description": "Order ID", + }, + "petId": Object { + "$ref": "#/components/schemas/Id", + "description": "Pet ID", + }, + "quantity": Object { + "default": 1, + "format": "int32", + "minimum": 1, + "type": "integer", + }, + "requestId": Object { + "description": "Unique Request Id", + "type": "string", + "writeOnly": true, + }, + "shipDate": Object { + "description": "Estimated ship date", + "format": "date-time", + "type": "string", + }, + "status": Object { + "description": "Order Status", + "enum": Array [ + "placed", + "approved", + "delivered", + ], + "type": "string", + }, + }, + "type": "object", + "xml": Object { + "name": "Order", + }, + }, + "Pet": Object { + "discriminator": Object { + "mapping": Object { + "bee": "#/components/schemas/HoneyBee", + "cat": "#/components/schemas/Cat", + "dog": "#/components/schemas/Dog", + }, + "propertyName": "petType", + }, + "properties": Object { + "category": Object { + "$ref": "#/components/schemas/Category", + "description": "Categories this pet belongs to", + }, + "friend": Object { + "$ref": "#/components/schemas/Pet", + }, + "huntingSkill": Object { + "enum": Array [ + 0, + 1, + 2, + ], + "type": Array [ + "integer", + ], + }, + "id": Object { + "$ref": "#/components/schemas/Id", + "description": "Pet ID", + "externalDocs": Object { + "description": "Find more info here", + "url": "https://example.com", + }, + }, + "name": Object { + "description": "The name given to a pet", + "example": "Guru", + "type": "string", + }, + "petType": Object { + "description": "Type of a pet", + "type": "string", + }, + "photoUrls": Object { + "description": "The list of URL to a cute photos featuring pet", + "else": Object { + "maxItems": 20, + "minItems": 1, + "type": Array [ + "integer", + "null", + ], + "x-displayName": "notString", + }, + "if": Object { + "type": "string", + "x-displayName": "isString", + }, + "items": Object { + "format": "url", + "type": "string", + }, + "maxItems": 10, + "minItems": 1, + "then": Object { + "maxItems": 15, + "minItems": 1, + }, + "type": Array [ + "string", + "integer", + "null", + ], + "xml": Object { + "name": "photoUrl", + "wrapped": true, + }, + }, + "status": Object { + "default": "pending", + "description": "Pet status in the store", + "enum": Array [ + "available", + "pending", + "sold", + ], + "type": "string", + }, + "tags": Object { + "description": "Tags attached to the pet", + "exclusiveMaximum": 100, + "exclusiveMinimum": 0, + "items": Object { + "$ref": "#/components/schemas/Tag", + }, + "type": "array", + "xml": Object { + "name": "tag", + "wrapped": true, + }, + }, + }, + "required": Array [ + "name", + "photoUrls", + ], + "type": "object", + "xml": Object { + "name": "Pet", + }, + }, + "Tag": Object { + "properties": Object { + "id": Object { + "$ref": "#/components/schemas/Id", + "description": "Tag ID", + "type": "number", + }, + "name": Object { + "description": "Tag name", + "minLength": 1, + "type": "string", + }, + }, + "type": "object", + "xml": Object { + "name": "Tag", + }, + }, + "User": Object { + "else": Object { + "required": Array [], + }, + "if": Object { + "properties": Object { + "userStatus": Object { + "enum": Array [ + 10, + ], + }, + }, + "title": "userStatus === 10", + }, + "properties": Object { + "addresses": Object { + "items": Object { + "type": "string", + }, + "maxLength": 10, + "minItems": 0, + "prefixItems": Array [ + Object { + "properties": Object { + "city": Object { + "minLength": 0, + "type": "string", + }, + "country": Object { + "minLength": 0, + "type": "string", + }, + "street": Object { + "description": "includes build/apartment number", + "minLength": 0, + "type": "string", + }, + }, + "type": "object", + }, + Object { + "type": "number", + }, + ], + "type": "array", + }, + "email": Object { + "description": "User email address", + "example": "john.smith@example.com", + "format": "email", + "type": "string", + }, + "firstName": Object { + "description": "User first name", + "example": "John", + "minLength": 1, + "type": "string", + }, + "id": Object { + "$ref": "#/components/schemas/Id", + }, + "image": Object { + "contentEncoding": "base64", + "contentMediaType": "image/png", + "description": "User image", + "type": "string", + }, + "lastName": Object { + "description": "User last name", + "example": "Smith", + "minLength": 1, + "type": "string", + }, + "password": Object { + "description": "User password, MUST contain a mix of upper and lower case letters, as well as digits", + "example": "drowssaP123", + "format": "password", + "minLength": 8, + "pattern": "/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/", + "type": "string", + }, + "pet": Object { + "oneOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + "title": "Pettie", + }, + Object { + "$ref": "#/components/schemas/Tag", + }, + ], + }, + "phone": Object { + "description": "User phone number in international format", + "example": "+1-202-555-0192", + "pattern": "/^\\\\+(?:[0-9]-?){6,14}[0-9]$/", + "type": "string", + }, + "userStatus": Object { + "description": "User status", + "format": "int32", + "type": "integer", + }, + "username": Object { + "description": "User supplied username", + "example": "John78", + "minLength": 4, + "type": "string", + }, + }, + "then": Object { + "required": Array [ + "phone", + ], + }, + "type": "object", + "xml": Object { + "name": "User", + }, + }, + }, + "securitySchemes": Object { + "api_key": Object { + "description": "For this sample, you can use the api key \`special-key\` to test the authorization filters. +", + "in": "header", + "name": "api_key", + "type": "apiKey", + }, + "petstore_auth": Object { + "description": "Get access to data while protecting your account credentials. +OAuth2 is also a safer and more secure way to give you access. +", + "flows": Object { + "implicit": Object { + "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog", + "scopes": Object { + "read:pets": "read your pets", + "write:pets": "modify pets in your account", + }, + }, + }, + "type": "oauth2", + }, + }, + }, + "externalDocs": Object { + "description": "Find out how to create Github repo for your OpenAPI spec.", + "url": "https://github.com/Rebilly/generator-openapi-repo", + }, + "info": Object { + "contact": Object { + "email": "apiteam@swagger.io", + "name": "API Support", + "url": "https://github.com/Redocly/redoc", + }, + "description": "This is a sample server Petstore server. +You can find out more about Swagger at +[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). +For this sample, you can use the api key \`special-key\` to test the authorization filters. + +# Introduction +This API is documented in **OpenAPI format** and is based on +[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. +It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) +tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard +OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). + +# OpenAPI Specification +This API is documented in **OpenAPI format** and is based on +[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. +It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) +tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard +OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). + +# Cross-Origin Resource Sharing +This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). +And that allows cross-domain communication from the browser. +All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. + +# Authentication + +Petstore offers two forms of authentication: + - API Key + - OAuth2 +OAuth2 - an open protocol to allow secure authorization in a simple +and standard method from web, mobile and desktop applications. + + +", + "license": Object { + "identifier": "Apache 2.0", + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html", + }, + "summary": "My lovely API", + "termsOfService": "http://swagger.io/terms/", + "title": "Swagger Petstore", + "version": "1.0.0", + "x-logo": Object { + "altText": "Petstore logo", + "url": "https://redocly.github.io/redoc/petstore-logo.png", + }, + }, + "openapi": "3.1.0", + "paths": Object { + "/pet": Object { + "delete": Object { + "operationId": "deletePetBy\\"Id", + "summary": "OperationId with quotes", + "tags": Array [ + "pet", + ], + }, + "get": Object { + "operationId": "delete\\\\PetById", + "summary": "OperationId with backslash", + "tags": Array [ + "pet", + ], + }, + "parameters": Array [ + Object { + "description": "The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US", + "example": "en-US", + "in": "header", + "name": "Accept-Language", + "required": false, + "schema": Object { + "default": "en-AU", + "type": "string", + }, + }, + Object { + "description": "Some cookie", + "in": "cookie", + "name": "cookieParam", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "post": Object { + "description": "Add new pet to the store inventory.", + "operationId": "addPet", + "requestBody": Object { + "$ref": "#/components/requestBodies/Pet", + }, + "responses": Object { + "405": Object { + "description": "Invalid input", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Add a new pet to the store", + "tags": Array [ + "pet", + ], + "x-codeSamples": Array [ + Object { + "lang": "C#", + "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); +pet.setApiKey(\\"your api key\\"); +pet.petType = PetStore.v1.Pet.TYPE_DOG; +pet.name = \\"Rex\\"; +// set other fields +PetStoreResponse response = pet.create(); +if (response.statusCode == HttpStatusCode.Created) +{ + // Successfully created +} +else +{ + // Something wrong -- check response for errors + Console.WriteLine(response.getRawResponse()); +} +", + }, + Object { + "lang": "PHP", + "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); +$form->setPetType(\\"Dog\\"); +$form->setName(\\"Rex\\"); +// set other fields +try { + $pet = $client->pets()->create($form); +} catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); +} +", + }, + ], + }, + "put": Object { + "description": "", + "operationId": "updatePet", + "requestBody": Object { + "$ref": "#/components/requestBodies/Pet", + }, + "responses": Object { + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Pet not found", + }, + "405": Object { + "description": "Validation exception", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Update an existing pet", + "tags": Array [ + "pet", + ], + "x-codeSamples": Array [ + Object { + "lang": "PHP", + "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); +$form->setPetId(1); +$form->setPetType(\\"Dog\\"); +$form->setName(\\"Rex\\"); +// set other fields +try { + $pet = $client->pets()->update($form); +} catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); +} +", + }, + ], + }, + }, + "/pet/findByStatus": Object { + "get": Object { + "description": "Multiple status values can be provided with comma separated strings", + "operationId": "findPetsByStatus", + "parameters": Array [ + Object { + "description": "Status values that need to be considered for filter", + "in": "query", + "name": "status", + "required": true, + "schema": Object { + "items": Object { + "default": "available", + "enum": Array [ + "available", + "pending", + "sold", + ], + "type": "string", + }, + "maxItems": 3, + "minItems": 1, + "type": "array", + }, + "style": "form", + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + "application/xml": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid status value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Finds Pets by status", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/findByTags": Object { + "get": Object { + "deprecated": true, + "description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + "operationId": "findPetsByTags", + "parameters": Array [ + Object { + "description": "Tags to filter by", + "in": "query", + "name": "tags", + "required": true, + "schema": Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + "style": "form", + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + "application/xml": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid tag value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Finds Pets by tags", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/{petId}": Object { + "delete": Object { + "description": "", + "operationId": "deletePet", + "parameters": Array [ + Object { + "example": "Bearer ", + "in": "header", + "name": "api_key", + "required": false, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "Pet id to delete", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "responses": Object { + "400": Object { + "description": "Invalid pet value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Deletes a pet", + "tags": Array [ + "pet", + ], + }, + "get": Object { + "description": "Returns a single pet", + "operationId": "getPetById", + "parameters": Array [ + Object { + "deprecated": true, + "description": "ID of pet to return", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Pet not found", + }, + }, + "security": Array [ + Object { + "api_key": Array [], + }, + ], + "summary": "Find pet by ID", + "tags": Array [ + "pet", + ], + }, + "post": Object { + "description": "", + "operationId": "updatePetWithForm", + "parameters": Array [ + Object { + "description": "ID of pet that needs to be updated", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/x-www-form-urlencoded": Object { + "schema": Object { + "properties": Object { + "name": Object { + "description": "Updated name of the pet", + "type": "string", + }, + "status": Object { + "description": "Updated status of the pet", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "405": Object { + "description": "Invalid input", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Updates a pet in the store with form data", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/{petId}/uploadImage": Object { + "post": Object { + "description": "", + "operationId": "uploadFile", + "parameters": Array [ + Object { + "description": "ID of pet to update", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/octet-stream": Object { + "schema": Object { + "format": "binary", + "type": "string", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/ApiResponse", + "unevaluatedProperties": Object { + "format": "int32", + "type": "integer", + }, + }, + }, + }, + "description": "successful operation", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "uploads an image", + "tags": Array [ + "pet", + ], + }, + }, + "/store/inventory": Object { + "get": Object { + "description": "Returns a map of status codes to quantities", + "operationId": "getInventory", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "additionalProperties": Object { + "format": "int32", + "type": "integer", + }, + "type": "object", + }, + }, + }, + "description": "successful operation", + }, + }, + "security": Array [ + Object { + "api_key": Array [], + }, + ], + "summary": "Returns pet inventories by status", + "tags": Array [ + "store", + ], + }, + }, + "/store/order": Object { + "post": Object { + "description": "", + "operationId": "placeOrder", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "order placed for purchasing the pet", + "required": true, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "content": Object { + "application/json": Object { + "example": Object { + "message": "Invalid Order", + "status": 400, + }, + }, + }, + "description": "Invalid Order", + }, + }, + "summary": "Place an order for a pet", + "tags": Array [ + "store", + ], + }, + }, + "/store/order/{orderId}": Object { + "delete": Object { + "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "operationId": "deleteOrder", + "parameters": Array [ + Object { + "description": "ID of the order that needs to be deleted", + "in": "path", + "name": "orderId", + "required": true, + "schema": Object { + "minimum": 1, + "type": "string", + }, + }, + ], + "responses": Object { + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Order not found", + }, + }, + "summary": "Delete purchase order by ID", + "tags": Array [ + "store", + ], + }, + "get": Object { + "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + "operationId": "getOrderById", + "parameters": Array [ + Object { + "description": "ID of pet that needs to be fetched", + "in": "path", + "name": "orderId", + "required": true, + "schema": Object { + "format": "int64", + "maximum": 5, + "minimum": 1, + "type": "integer", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Order not found", + }, + }, + "summary": "Find purchase order by ID", + "tags": Array [ + "store", + ], + }, + }, + "/store/subscribe": Object { + "post": Object { + "callbacks": Object { + "orderDelivered": Object { + "http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}": Object { + "post": Object { + "deprecated": true, + "description": "A callback triggered every time an Order is delivered to the recipient", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + "timestamp": Object { + "example": "2018-10-19T16:46:45Z", + "format": "date-time", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "description": "Callback successfully processed and no retries will be performed", + }, + }, + "summary": "Order delivered", + }, + }, + }, + "orderInProgress": Object { + "{$request.body#/callbackUrl}?event={$request.body#/eventName}": Object { + "post": Object { + "description": "A callback triggered every time an Order is updated status to \\"inProgress\\" (Description)", + "externalDocs": Object { + "description": "Find out more", + "url": "https://more-details.com/demo", + }, + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + "status": Object { + "example": "inProgress", + "type": "string", + }, + "timestamp": Object { + "example": "2018-10-19T16:46:45Z", + "format": "date-time", + "type": "string", + }, + }, + "type": "object", + }, + }, + "application/xml": Object { + "example": " + + 123 + inProgress + 2018-10-19T16:46:45Z + +", + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "someProp": Object { + "example": "123", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + "description": "Callback successfully processed and no retries will be performed", + }, + "299": Object { + "description": "Response for cancelling subscription", + }, + "500": Object { + "description": "Callback processing failed and retries will be performed", + }, + }, + "summary": "Order in Progress (Summary)", + "x-codeSamples": Array [ + Object { + "lang": "C#", + "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); +pet.setApiKey(\\"your api key\\"); +pet.petType = PetStore.v1.Pet.TYPE_DOG; +pet.name = \\"Rex\\"; +// set other fields +PetStoreResponse response = pet.create(); +if (response.statusCode == HttpStatusCode.Created) +{ + // Successfully created +} +else +{ + // Something wrong -- check response for errors + Console.WriteLine(response.getRawResponse()); +} +", + }, + Object { + "lang": "PHP", + "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); +$form->setPetType(\\"Dog\\"); +$form->setName(\\"Rex\\"); +// set other fields +try { + $pet = $client->pets()->create($form); +} catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); +} +", + }, + ], + }, + "put": Object { + "description": "Order in Progress (Only Description)", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + "status": Object { + "example": "inProgress", + "type": "string", + }, + "timestamp": Object { + "example": "2018-10-19T16:46:45Z", + "format": "date-time", + "type": "string", + }, + }, + "type": "object", + }, + }, + "application/xml": Object { + "example": " + + 123 + inProgress + 2018-10-19T16:46:45Z + +", + "schema": Object { + "properties": Object { + "orderId": Object { + "example": "123", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "someProp": Object { + "example": "123", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + "description": "Callback successfully processed and no retries will be performed", + }, + }, + "servers": Array [ + Object { + "description": "Operation level server 1 (Operation override)", + "url": "//callback-url.operation-level/v1", + }, + Object { + "description": "Operation level server 2 (Operation override)", + "url": "//callback-url.operation-level/v2", + }, + ], + }, + "servers": Array [ + Object { + "description": "Path level server 1", + "url": "//callback-url.path-level/v1", + }, + Object { + "description": "Path level server 2", + "url": "//callback-url.path-level/v2", + }, + ], + }, + }, + "orderShipped": Object { + "{$request.body#/callbackUrl}?event={$request.body#/eventName}": Object { + "post": Object { + "description": "Very long description +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor +incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis +nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu +fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in +culpa qui officia deserunt mollit anim id est laborum. +", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "estimatedDeliveryDate": Object { + "example": "2018-11-11T16:00:00Z", + "format": "date-time", + "type": "string", + }, + "orderId": Object { + "example": "123", + "type": "string", + }, + "timestamp": Object { + "example": "2018-10-19T16:46:45Z", + "format": "date-time", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "description": "Callback successfully processed and no retries will be performed", + }, + }, + }, + }, + }, + }, + "description": "Add subscription for a store events", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "callbackUrl": Object { + "description": "This URL will be called by the server when the desired event will occur", + "example": "https://myserver.com/send/callback/here", + "format": "uri", + "type": "string", + }, + "eventName": Object { + "description": "Event name for the subscription", + "enum": Array [ + "orderInProgress", + "orderShipped", + "orderDelivered", + ], + "example": "orderInProgress", + "type": "string", + }, + }, + "required": Array [ + "callbackUrl", + "eventName", + ], + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "items": Object { + "type": "number", + }, + "maxItems": 777, + "minItems": 111, + "type": "array", + }, + "maxItems": 999, + "minItems": 0, + "type": "array", + }, + }, + }, + "description": "Successful operation", + }, + "201": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "properties": Object { + "subscriptionId": Object { + "example": "AAA-123-BBB-456", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + "description": "Subscription added", + }, + }, + "summary": "Subscribe to the Store events", + "tags": Array [ + "store", + ], + }, + }, + "/user": Object { + "post": Object { + "description": "This can only be done by the logged in user.", + "operationId": "createUser", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "Created user object", + "required": true, + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Create user", + "tags": Array [ + "user", + ], + }, + }, + "/user/createWithArray": Object { + "post": Object { + "description": "", + "operationId": "createUsersWithArrayInput", + "requestBody": Object { + "$ref": "#/components/requestBodies/UserArray", + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Creates list of users with given input array", + "tags": Array [ + "user", + ], + }, + }, + "/user/createWithList": Object { + "post": Object { + "description": "", + "operationId": "createUsersWithListInput", + "requestBody": Object { + "$ref": "#/components/requestBodies/UserArray", + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Creates list of users with given input array", + "tags": Array [ + "user", + ], + }, + }, + "/user/login": Object { + "get": Object { + "description": "", + "operationId": "loginUser", + "parameters": Array [ + Object { + "description": "The user name for login", + "in": "query", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "The password for login in clear text", + "in": "query", + "name": "password", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "examples": Object { + "response": Object { + "value": "OK", + }, + }, + "schema": Object { + "type": "string", + }, + }, + "application/xml": Object { + "examples": Object { + "response": Object { + "value": " OK ", + }, + }, + "schema": Object { + "type": "string", + }, + }, + "text/plain": Object { + "examples": Object { + "response": Object { + "value": "OK", + }, + }, + }, + }, + "description": "successful operation", + "headers": Object { + "X-Expires-After": Object { + "description": "date in UTC when token expires", + "schema": Object { + "format": "date-time", + "type": "string", + }, + }, + "X-Rate-Limit": Object { + "description": "calls per hour allowed by the user", + "schema": Object { + "format": "int32", + "type": "integer", + }, + }, + }, + }, + "400": Object { + "description": "Invalid username/password supplied", + }, + }, + "summary": "Logs user into the system", + "tags": Array [ + "user", + ], + }, + }, + "/user/logout": Object { + "get": Object { + "description": "", + "operationId": "logoutUser", + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Logs out current logged in user session", + "tags": Array [ + "user", + ], + }, + }, + "/user/{username}": Object { + "delete": Object { + "description": "This can only be done by the logged in user.", + "operationId": "deleteUser", + "parameters": Array [ + Object { + "description": "The name that needs to be deleted", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "204": Object { + "description": "User is deleted", + }, + "400": Object { + "description": "Invalid username supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Delete user", + "tags": Array [ + "user", + ], + }, + "get": Object { + "description": "", + "operationId": "getUserByName", + "parameters": Array [ + Object { + "description": "The name that needs to be fetched. Use user1 for testing. ", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid username supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Get user by user name", + "tags": Array [ + "user", + ], + }, + "put": Object { + "description": "This can only be done by the logged in user.", + "operationId": "updateUser", + "parameters": Array [ + Object { + "description": "name that need to be updated", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "Updated user object", + "required": true, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "User is updated successfully", + }, + "400": Object { + "description": "Invalid user supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Updated user", + "tags": Array [ + "user", + ], + }, + }, + }, + "security": Array [ + Object {}, + ], + "servers": Array [ + Object { + "description": "Default server", + "url": "//petstore.swagger.io/v2", + }, + Object { + "description": "Sandbox server", + "url": "//petstore.swagger.io/sandbox", + }, + ], + "tags": Array [ + Object { + "description": "Everything about your Pets", + "name": "pet", + }, + Object { + "description": "Access to Petstore orders", + "name": "store", + }, + Object { + "description": "Operations about user", + "name": "user", + }, + Object { + "description": "Everything about your Webhooks", + "name": "webhooks", + }, + Object { + "description": " +", + "name": "pet_model", + "x-displayName": "The Pet Model", + }, + Object { + "description": " +", + "name": "store_model", + "x-displayName": "The Order Model", + }, + ], + "webhooks": Object { + "myWebhook": Object { + "$ref": "#/components/pathItems/webhooks", + "description": "Overriding description", + "summary": "Overriding summary", + }, + "newPet": Object { + "post": Object { + "description": "Information about a new pet in the systems", + "operationId": "newPet", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "description": "Return a 200 status to indicate that the data was received successfully", + }, + }, + "summary": "New pet", + "tags": Array [ + "webhooks", + ], + }, + }, + }, + "x-tagGroups": Array [ + Object { + "name": "General", + "tags": Array [ + "pet", + "store", + "webhooks", + ], + }, + Object { + "name": "User Management", + "tags": Array [ + "user", + ], + }, + Object { + "name": "Models", + "tags": Array [ + "pet_model", + "store_model", + ], + }, + ], +} +`; + +exports[`#loadAndBundleSpec should load And Bundle Spec demo/swagger.yaml 1`] = ` +Object { + "components": Object { + "requestBodies": Object { + "Pet": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + }, + "description": "Pet object that needs to be added to the store", + "required": true, + }, + "UserArray": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/User", + }, + "type": "array", + }, + }, + }, + "description": "List of user object", + "required": true, + }, + }, + "schemas": Object { + "ApiResponse": Object { + "properties": Object { + "code": Object { + "format": "int32", + "type": "integer", + }, + "message": Object { + "type": "string", + }, + "type": Object { + "type": "string", + }, + }, + "type": "object", + }, + "Cat": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "huntingSkill": Object { + "default": "lazy", + "description": "The measured skill for hunting", + "enum": Array [ + "clueless", + "lazy", + "adventurous", + "aggressive", + ], + "type": "string", + }, + }, + "required": Array [ + "huntingSkill", + ], + "type": "object", + }, + ], + "description": "A representation of a cat", + }, + "Category": Object { + "properties": Object { + "id": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Category ID", + }, + "name": Object { + "description": "Category name", + "minLength": 1, + "type": "string", + }, + "sub": Object { + "description": "Test Sub Category", + "properties": Object { + "prop1": Object { + "description": "Dumb Property", + "type": "string", + }, + }, + "type": "object", + }, + }, + "type": "object", + "xml": Object { + "name": "Category", + }, + }, + "Dog": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "packSize": Object { + "default": 1, + "description": "The size of the pack the dog is from", + "format": "int32", + "minimum": 1, + "type": "integer", + }, + }, + "required": Array [ + "packSize", + ], + "type": "object", + }, + ], + "description": "A representation of a dog", + }, + "HoneyBee": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Pet", + }, + Object { + "properties": Object { + "honeyPerDay": Object { + "description": "Average amount of honey produced per day in ounces", + "example": 3.14, + "type": "number", + }, + }, + "required": Array [ + "honeyPerDay", + ], + "type": "object", + }, + ], + "description": "A representation of a honey bee", + }, + "Id": Object { + "format": "int64", + "type": "integer", + }, + "Order": Object { + "properties": Object { + "complete": Object { + "default": false, + "description": "Indicates whenever order was completed or not", + "type": "boolean", + }, + "id": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Order ID", + }, + "petId": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Pet ID", + }, + "quantity": Object { + "default": 1, + "format": "int32", + "minimum": 1, + "type": "integer", + }, + "shipDate": Object { + "description": "Estimated ship date", + "format": "date-time", + "type": "string", + }, + "status": Object { + "description": "Order Status", + "enum": Array [ + "placed", + "approved", + "delivered", + ], + "type": "string", + }, + }, + "type": "object", + "xml": Object { + "name": "Order", + }, + }, + "Pet": Object { + "discriminator": Object { + "propertyName": "petType", + }, + "properties": Object { + "category": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Category", + }, + ], + "description": "Categories this pet belongs to", + }, + "id": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Pet ID", + }, + "name": Object { + "description": "The name given to a pet", + "example": "Guru", + "type": "string", + }, + "petType": Object { + "description": "Type of a pet", + "type": "string", + }, + "photoUrls": Object { + "description": "The list of URL to a cute photos featuring pet", + "items": Object { + "format": "url", + "type": "string", + }, + "type": "array", + "xml": Object { + "name": "photoUrl", + "wrapped": true, + }, + }, + "status": Object { + "description": "Pet status in the store", + "enum": Array [ + "available", + "pending", + "sold", + ], + "type": "string", + }, + "tags": Object { + "description": "Tags attached to the pet", + "items": Object { + "$ref": "#/components/schemas/Tag", + }, + "type": "array", + "xml": Object { + "name": "tag", + "wrapped": true, + }, + }, + }, + "required": Array [ + "name", + "photoUrls", + ], + "type": "object", + "xml": Object { + "name": "Pet", + }, + }, + "Tag": Object { + "properties": Object { + "id": Object { + "allOf": Array [ + Object { + "$ref": "#/components/schemas/Id", + }, + ], + "description": "Tag ID", + }, + "name": Object { + "description": "Tag name", + "minLength": 1, + "type": "string", + }, + }, + "type": "object", + "xml": Object { + "name": "Tag", + }, + }, + "User": Object { + "properties": Object { + "email": Object { + "description": "User email address", + "example": "john.smith@example.com", + "format": "email", + "type": "string", + }, + "firstName": Object { + "description": "User first name", + "example": "John", + "minLength": 1, + "type": "string", + }, + "id": Object { + "$ref": "#/components/schemas/Id", + }, + "lastName": Object { + "description": "User last name", + "example": "Smith", + "minLength": 1, + "type": "string", + }, + "password": Object { + "description": "User password, MUST contain a mix of upper and lower case letters, as well as digits", + "example": "drowssaP123", + "format": "password", + "minLength": 8, + "pattern": "(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])", + "type": "string", + }, + "phone": Object { + "description": "User phone number in international format", + "example": "+1-202-555-0192", + "nullable": true, + "pattern": "^\\\\+(?:[0-9]-?){6,14}[0-9]$", + "type": "string", + }, + "userStatus": Object { + "description": "User status", + "format": "int32", + "type": "integer", + }, + "username": Object { + "description": "User supplied username", + "example": "John78", + "minLength": 4, + "type": "string", + }, + }, + "type": "object", + "xml": Object { + "name": "User", + }, + }, + }, + "securitySchemes": Object { + "api_key": Object { + "description": "For this sample, you can use the api key \`special-key\` to test the authorization filters. +", + "in": "header", + "name": "api_key", + "type": "apiKey", + }, + "petstore_auth": Object { + "description": "Get access to data while protecting your account credentials. +OAuth2 is also a safer and more secure way to give you access. +", + "flows": Object { + "implicit": Object { + "authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog", + "scopes": Object { + "read:pets": "read your pets", + "write:pets": "modify pets in your account", + }, + }, + }, + "type": "oauth2", + }, + }, + }, + "externalDocs": Object { + "description": "Find out how to create Github repo for your OpenAPI spec.", + "url": "https://github.com/Rebilly/generator-openapi-repo", + }, + "info": Object { + "contact": Object { + "email": "apiteam@swagger.io", + "url": "https://github.com/Redocly/redoc", + }, + "description": "This is a sample server Petstore server. +You can find out more about Swagger at +[http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). +For this sample, you can use the api key \`special-key\` to test the authorization filters. +# Introduction +This API is documented in **OpenAPI format** and is based on +[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. +It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) +tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard +OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). +# OpenAPI Specification +This API is documented in **OpenAPI format** and is based on +[Petstore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. +It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) +tool and [ReDoc](https://github.com/Redocly/redoc) documentation. In addition to standard +OpenAPI syntax we use a few [vendor extensions](https://github.com/Redocly/redoc/blob/main/docs/redoc-vendor-extensions.md). +# Cross-Origin Resource Sharing +This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). +And that allows cross-domain communication from the browser. +All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site. +# Authentication +Petstore offers two forms of authentication: + - API Key + - OAuth2 + +OAuth2 - an open protocol to allow secure authorization in a simple +and standard method from web, mobile and desktop applications. + +", + "license": Object { + "name": "Apache 2.0", + "url": "http://www.apache.org/licenses/LICENSE-2.0.html", + }, + "termsOfService": "http://swagger.io/terms/", + "title": "Swagger Petstore", + "version": "1.0.0", + "x-logo": Object { + "altText": "Petstore logo", + "url": "https://redocly.github.io/redoc/petstore-logo.png", + }, + }, + "openapi": "3.0.0", + "paths": Object { + "/pet": Object { + "post": Object { + "description": "Add new pet to the store inventory.", + "operationId": "addPet", + "requestBody": Object { + "$ref": "#/components/requestBodies/Pet", + }, + "responses": Object { + "405": Object { + "description": "Invalid input", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Add a new pet to the store", + "tags": Array [ + "pet", + ], + "x-code-samples": Array [ + Object { + "lang": "C#", + "source": "PetStore.v1.Pet pet = new PetStore.v1.Pet(); +pet.setApiKey(\\"your api key\\"); +pet.petType = PetStore.v1.Pet.TYPE_DOG; +pet.name = \\"Rex\\"; +// set other fields +PetStoreResponse response = pet.create(); +if (response.statusCode == HttpStatusCode.Created) +{ + // Successfully created +} +else +{ + // Something wrong -- check response for errors + Console.WriteLine(response.getRawResponse()); +} +", + }, + Object { + "lang": "PHP", + "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); +$form->setPetType(\\"Dog\\"); +$form->setName(\\"Rex\\"); +// set other fields +try { + $pet = $client->pets()->create($form); +} catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); +} +", + }, + ], + }, + "put": Object { + "description": "", + "operationId": "updatePet", + "requestBody": Object { + "$ref": "#/components/requestBodies/Pet", + }, + "responses": Object { + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Pet not found", + }, + "405": Object { + "description": "Validation exception", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Update an existing pet", + "tags": Array [ + "pet", + ], + "x-code-samples": Array [ + Object { + "lang": "PHP", + "source": "$form = new \\\\PetStore\\\\Entities\\\\Pet(); +$form->setPetId(1); +$form->setPetType(\\"Dog\\"); +$form->setName(\\"Rex\\"); +// set other fields +try { + $pet = $client->pets()->update($form); +} catch (UnprocessableEntityException $e) { + var_dump($e->getErrors()); +} +", + }, + ], + }, + }, + "/pet/findByStatus": Object { + "get": Object { + "description": "Multiple status values can be provided with comma separated strings", + "operationId": "findPetsByStatus", + "parameters": Array [ + Object { + "description": "Status values that need to be considered for filter", + "explode": false, + "in": "query", + "name": "status", + "required": true, + "schema": Object { + "items": Object { + "default": "available", + "enum": Array [ + "available", + "pending", + "sold", + ], + "type": "string", + }, + "type": "array", + }, + "style": "form", + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + "application/xml": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid status value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Finds Pets by status", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/findByTags": Object { + "get": Object { + "deprecated": true, + "description": "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + "operationId": "findPetsByTags", + "parameters": Array [ + Object { + "description": "Tags to filter by", + "explode": false, + "in": "query", + "name": "tags", + "required": true, + "schema": Object { + "items": Object { + "type": "string", + }, + "type": "array", + }, + "style": "form", + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + "application/xml": Object { + "schema": Object { + "items": Object { + "$ref": "#/components/schemas/Pet", + }, + "type": "array", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid tag value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Finds Pets by tags", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/{petId}": Object { + "delete": Object { + "description": "", + "operationId": "deletePet", + "parameters": Array [ + Object { + "example": "Bearer ", + "in": "header", + "name": "api_key", + "required": false, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "Pet id to delete", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "responses": Object { + "400": Object { + "description": "Invalid pet value", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Deletes a pet", + "tags": Array [ + "pet", + ], + }, + "get": Object { + "description": "Returns a single pet", + "operationId": "getPetById", + "parameters": Array [ + Object { + "description": "ID of pet to return", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Pet", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Pet not found", + }, + }, + "security": Array [ + Object { + "api_key": Array [], + }, + ], + "summary": "Find pet by ID", + "tags": Array [ + "pet", + ], + }, + "post": Object { + "description": "", + "operationId": "updatePetWithForm", + "parameters": Array [ + Object { + "description": "ID of pet that needs to be updated", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/x-www-form-urlencoded": Object { + "schema": Object { + "properties": Object { + "name": Object { + "description": "Updated name of the pet", + "type": "string", + }, + "status": Object { + "description": "Updated status of the pet", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "405": Object { + "description": "Invalid input", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "Updates a pet in the store with form data", + "tags": Array [ + "pet", + ], + }, + }, + "/pet/{petId}/uploadImage": Object { + "post": Object { + "description": "", + "operationId": "uploadFile", + "parameters": Array [ + Object { + "description": "ID of pet to update", + "in": "path", + "name": "petId", + "required": true, + "schema": Object { + "format": "int64", + "type": "integer", + }, + }, + ], + "requestBody": Object { + "content": Object { + "multipart/form-data": Object { + "schema": Object { + "properties": Object { + "additionalMetadata": Object { + "description": "Additional data to pass to server", + "type": "string", + }, + "file": Object { + "description": "file to upload", + "format": "binary", + "type": "string", + }, + }, + "type": "object", + }, + }, + }, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/ApiResponse", + }, + }, + }, + "description": "successful operation", + }, + }, + "security": Array [ + Object { + "petstore_auth": Array [ + "write:pets", + "read:pets", + ], + }, + ], + "summary": "uploads an image", + "tags": Array [ + "pet", + ], + }, + }, + "/store/inventory": Object { + "get": Object { + "description": "Returns a map of status codes to quantities", + "operationId": "getInventory", + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "additionalProperties": Object { + "format": "int32", + "type": "integer", + }, + "type": "object", + }, + }, + }, + "description": "successful operation", + }, + }, + "security": Array [ + Object { + "api_key": Array [], + }, + ], + "summary": "Returns pet inventories by status", + "tags": Array [ + "store", + ], + }, + }, + "/store/order": Object { + "post": Object { + "description": "", + "operationId": "placeOrder", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "order placed for purchasing the pet", + "required": true, + }, + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid Order", + }, + }, + "summary": "Place an order for a pet", + "tags": Array [ + "store", + ], + }, + }, + "/store/order/{orderId}": Object { + "delete": Object { + "description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", + "operationId": "deleteOrder", + "parameters": Array [ + Object { + "description": "ID of the order that needs to be deleted", + "in": "path", + "name": "orderId", + "required": true, + "schema": Object { + "minimum": 1, + "type": "string", + }, + }, + ], + "responses": Object { + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Order not found", + }, + }, + "summary": "Delete purchase order by ID", + "tags": Array [ + "store", + ], + }, + "get": Object { + "description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + "operationId": "getOrderById", + "parameters": Array [ + Object { + "description": "ID of pet that needs to be fetched", + "in": "path", + "name": "orderId", + "required": true, + "schema": Object { + "format": "int64", + "maximum": 5, + "minimum": 1, + "type": "integer", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/Order", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid ID supplied", + }, + "404": Object { + "description": "Order not found", + }, + }, + "summary": "Find purchase order by ID", + "tags": Array [ + "store", + ], + }, + }, + "/user": Object { + "post": Object { + "description": "This can only be done by the logged in user.", + "operationId": "createUser", + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "Created user object", + "required": true, + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Create user", + "tags": Array [ + "user", + ], + }, + }, + "/user/createWithArray": Object { + "post": Object { + "description": "", + "operationId": "createUsersWithArrayInput", + "requestBody": Object { + "$ref": "#/components/requestBodies/UserArray", + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Creates list of users with given input array", + "tags": Array [ + "user", + ], + }, + }, + "/user/createWithList": Object { + "post": Object { + "description": "", + "operationId": "createUsersWithListInput", + "requestBody": Object { + "$ref": "#/components/requestBodies/UserArray", + }, + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Creates list of users with given input array", + "tags": Array [ + "user", + ], + }, + }, + "/user/login": Object { + "get": Object { + "description": "", + "operationId": "loginUser", + "parameters": Array [ + Object { + "description": "The user name for login", + "in": "query", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + Object { + "description": "The password for login in clear text", + "in": "query", + "name": "password", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "examples": Object { + "response": Object { + "value": "OK", + }, + }, + "schema": Object { + "type": "string", + }, + }, + "application/xml": Object { + "examples": Object { + "response": Object { + "value": " OK ", + }, + }, + "schema": Object { + "type": "string", + }, + }, + "text/plain": Object { + "examples": Object { + "response": Object { + "value": "OK", + }, + }, + }, + }, + "description": "successful operation", + "headers": Object { + "X-Expires-After": Object { + "description": "date in UTC when token expires", + "schema": Object { + "format": "date-time", + "type": "string", + }, + }, + "X-Rate-Limit": Object { + "description": "calls per hour allowed by the user", + "schema": Object { + "format": "int32", + "type": "integer", + }, + }, + }, + }, + "400": Object { + "description": "Invalid username/password supplied", + }, + }, + "summary": "Logs user into the system", + "tags": Array [ + "user", + ], + }, + }, + "/user/logout": Object { + "get": Object { + "description": "", + "operationId": "logoutUser", + "responses": Object { + "default": Object { + "description": "successful operation", + }, + }, + "summary": "Logs out current logged in user session", + "tags": Array [ + "user", + ], + }, + }, + "/user/{username}": Object { + "delete": Object { + "description": "This can only be done by the logged in user.", + "operationId": "deleteUser", + "parameters": Array [ + Object { + "description": "The name that needs to be deleted", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "400": Object { + "description": "Invalid username supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Delete user", + "tags": Array [ + "user", + ], + }, + "get": Object { + "description": "", + "operationId": "getUserByName", + "parameters": Array [ + Object { + "description": "The name that needs to be fetched. Use user1 for testing. ", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "responses": Object { + "200": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + "application/xml": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "successful operation", + }, + "400": Object { + "description": "Invalid username supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Get user by user name", + "tags": Array [ + "user", + ], + }, + "put": Object { + "description": "This can only be done by the logged in user.", + "operationId": "updateUser", + "parameters": Array [ + Object { + "description": "name that need to be deleted", + "in": "path", + "name": "username", + "required": true, + "schema": Object { + "type": "string", + }, + }, + ], + "requestBody": Object { + "content": Object { + "application/json": Object { + "schema": Object { + "$ref": "#/components/schemas/User", + }, + }, + }, + "description": "Updated user object", + "required": true, + }, + "responses": Object { + "400": Object { + "description": "Invalid user supplied", + }, + "404": Object { + "description": "User not found", + }, + }, + "summary": "Updated user", + "tags": Array [ + "user", + ], + }, + }, + }, + "servers": Array [ + Object { + "description": "Default server", + "url": "//petstore.swagger.io/v2", + }, + Object { + "description": "Sandbox server", + "url": "//petstore.swagger.io/sandbox", + }, + ], + "tags": Array [ + Object { + "description": "Everything about your Pets", + "name": "pet", + }, + Object { + "description": "Access to Petstore orders", + "name": "store", + }, + Object { + "description": "Operations about user", + "name": "user", + }, + ], + "x-tagGroups": Array [ + Object { + "name": "General", + "tags": Array [ + "pet", + "store", + ], + }, + Object { + "name": "User Management", + "tags": Array [ + "user", + ], + }, + ], +} +`;