diff --git a/test/oas_examples/v3.0/11_regex.yaml b/test/oas_examples/v3.0/11_regex.yaml new file mode 100644 index 0000000..fe4e24c --- /dev/null +++ b/test/oas_examples/v3.0/11_regex.yaml @@ -0,0 +1,27 @@ +components: + schemas: + StringWithRegexWithThreeFlags: + format: uuid + pattern: /a./sim + type: string + UUID: + format: uuid + pattern: '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}' + type: string +info: + title: Test + version: 1.0.0-SNAPSHOT +openapi: 3.0.3 +paths: + /test: + get: + parameters: + - in: query + name: uuid + schema: + $ref: '#/components/schemas/UUID' + responses: + '200': + description: OK + tags: + - Test Resource diff --git a/test/oas_examples/v3.0/13942_schema_enum_names.yaml b/test/oas_examples/v3.0/13942_schema_enum_names.yaml new file mode 100644 index 0000000..c33389c --- /dev/null +++ b/test/oas_examples/v3.0/13942_schema_enum_names.yaml @@ -0,0 +1,12 @@ +components: + schemas: + StringEnum: + enum: + - '#367B9C' + - '#FFA5A4' + type: string +info: + title: Test + version: 1.0.0-SNAPSHOT +openapi: 3.0.3 +paths: {} diff --git a/test/oas_examples/v3.0/3134-regression.yaml b/test/oas_examples/v3.0/3134-regression.yaml new file mode 100644 index 0000000..3471ce2 --- /dev/null +++ b/test/oas_examples/v3.0/3134-regression.yaml @@ -0,0 +1,22 @@ +info: + description: info + title: info + version: 0.1.0 +openapi: 3.0.2 +paths: + /example/api: + post: + description: description + requestBody: + content: + application/json: + schema: + properties: + name: + type: string + type: object + required: false + responses: + 200: + description: response + summary: summary diff --git a/test/oas_examples/v3.0/3248-regression-dates.yaml b/test/oas_examples/v3.0/3248-regression-dates.yaml new file mode 100644 index 0000000..ecc372f --- /dev/null +++ b/test/oas_examples/v3.0/3248-regression-dates.yaml @@ -0,0 +1,25 @@ +info: + description: info + title: info + version: 0.1.0 +openapi: 3.0.2 +paths: + /example/api: + get: + description: description + parameters: + - description: The start time. + in: query + name: start + required: true + schema: + format: date-time + type: string + responses: + 200: + content: + application/json: + schema: + type: string + description: response + summary: summary diff --git a/test/oas_examples/v3.0/3248-regression.yaml b/test/oas_examples/v3.0/3248-regression.yaml new file mode 100644 index 0000000..6b4de1b --- /dev/null +++ b/test/oas_examples/v3.0/3248-regression.yaml @@ -0,0 +1,44 @@ +components: + parameters: + formatParam: + description: set format + in: query + name: format + required: false + schema: + $ref: '#/components/schemas/format' + requiredQueryParam: + description: set query + in: query + name: query + required: true + schema: + type: string + schemas: + format: + default: json + description: response format + enum: + - json + - csv + type: string +info: + description: info + title: info + version: 0.1.0 +openapi: 3.0.2 +paths: + /example/api: + get: + description: description + parameters: + - $ref: '#/components/parameters/requiredQueryParam' + - $ref: '#/components/parameters/formatParam' + responses: + 200: + content: + application/json: + schema: + type: string + description: response + summary: summary diff --git a/test/oas_examples/v3.0/3_0__arrayRefBody.yaml b/test/oas_examples/v3.0/3_0__arrayRefBody.yaml new file mode 100644 index 0000000..3c4c567 --- /dev/null +++ b/test/oas_examples/v3.0/3_0__arrayRefBody.yaml @@ -0,0 +1,35 @@ +components: + schemas: + Input: + properties: + age: + format: int32 + type: integer + dt: + format: date-time + type: string + id: + type: string + type: object +info: + title: '' + version: '' +openapi: 3.0.0 +paths: + /examples: + post: + operationId: getFilteredTransactions + requestBody: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Input' + type: array + description: subscription payload + responses: + default: + description: successful operation + summary: Get a list of transactions + tags: + - Examples diff --git a/test/oas_examples/v3.0/3_0__elm.yaml b/test/oas_examples/v3.0/3_0__elm.yaml new file mode 100644 index 0000000..c1ee49e --- /dev/null +++ b/test/oas_examples/v3.0/3_0__elm.yaml @@ -0,0 +1,306 @@ +components: + schemas: + Absent: + description: Model having absent and null values + properties: + default: + type: string + nullable: + nullable: true + type: string + required: + type: string + requiredNullable: + nullable: true + type: string + required: + - required + - requiredNullable + Array: + description: Model with arrays + properties: + array: + items: + type: string + type: array + arrayOfArray: + items: + items: + type: string + type: array + type: array + arrayOfEnum: + items: + $ref: '#/components/schemas/Enum' + type: array + arrayOfPrimitive: + items: + $ref: '#/components/schemas/Primitive' + type: array + required: + - array + - arrayOfArray + Composed: + allOf: + - $ref: '#/components/schemas/ComposedBase' + - properties: + value: + type: string + type: object + description: Composed model + ComposedBase: + properties: + base: + type: number + required: + - base + Discriminated: + description: Discriminated model + discriminator: + propertyName: kind + properties: + kind: + type: string + required: + - kind + DiscriminatedA: + allOf: + - $ref: '#/components/schemas/Discriminated' + - properties: + a: + type: string + type: object + DiscriminatedB: + allOf: + - $ref: '#/components/schemas/Discriminated' + - properties: + b: + type: string + type: object + Enum: + enum: + - foo + - bar + - baz + type: string + Enumeric: + enum: + - 1 + - 2 + - 3 + type: number + Maybe: + description: Model using reserved words + properties: + if: + type: boolean + type: + type: string + OneOf: + description: One of two models + oneOf: + - $ref: '#/components/schemas/OneOfA' + - $ref: '#/components/schemas/OneOfB' + OneOfA: + properties: + a: + type: string + OneOfB: + properties: + b: + type: string + Primitive: + description: Model with primitive properties + properties: + boolean: + type: boolean + double: + format: double + type: number + float: + format: float + type: number + integer: + type: integer + long: + format: int64 + type: integer + number: + type: number + short: + format: int32 + type: integer + string: + type: string + Recursion: + properties: + list: + items: + $ref: '#/components/schemas/Recursion' + type: array + maybe: + $ref: '#/components/schemas/Recursion' + ref: + $ref: '#/components/schemas/RecursionLoop' + RecursionLoop: + properties: + ref: + $ref: '#/components/schemas/Recursion' + UnsafeCharacters: + description: Model using unsafe characters + properties: + $prefix: + type: string + _before: + type: string + _both_: + type: string + after_: + type: string + in_the_middle: + type: string + r@nd0m_$t#ff: + type: string + suffix$: + type: string + securitySchemes: + BearerAuth: + bearerFormat: JWT + scheme: bearer + type: http +info: + license: + name: MIT + title: Elm generator test + version: 1.0.0 +openapi: 3.0.0 +paths: + /data: + post: + operationId: update + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Primitive' + description: Request body + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Primitive' + description: Default response + tags: + - primitive + /header: + post: + parameters: + - in: header + name: string + required: true + schema: + type: string + - in: header + name: integer + schema: + type: integer + - in: header + name: headerType + schema: + enum: + - left + - right + type: string + responses: + '200': + content: + application/json: + schema: + type: string + description: Default response + /maybe: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Maybe' + description: Default response + /path/{string}/{integer}/{enumeration}: + get: + parameters: + - in: path + name: string + required: true + schema: + type: string + - in: path + name: integer + required: true + schema: + type: integer + - in: path + name: enumeration + required: true + schema: + enum: + - a + - b + - c + type: string + responses: + '200': + description: Default response + /query: + get: + parameters: + - in: query + name: string + schema: + type: string + - in: query + name: int + schema: + type: integer + - in: query + name: enum + schema: + enum: + - a + - b + - c + type: string + responses: + '200': + description: Default response + /secured: + post: + responses: + '200': + description: Authenticated + '401': + description: Unauthenticated + security: + - BearerAuth: [] + summary: Secured endpoint + /uuid: + get: + parameters: + - in: query + name: value + schema: + format: uuid + type: string + responses: + '200': + content: + application/json: + schema: + format: uuid + type: string + description: Default response +servers: +- url: http://localhost:9000 diff --git a/test/oas_examples/v3.0/3_0__petstore.yaml b/test/oas_examples/v3.0/3_0__petstore.yaml new file mode 100644 index 0000000..743a985 --- /dev/null +++ b/test/oas_examples/v3.0/3_0__petstore.yaml @@ -0,0 +1,736 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/Basic.yaml b/test/oas_examples/v3.0/Basic.yaml new file mode 100644 index 0000000..66e0596 --- /dev/null +++ b/test/oas_examples/v3.0/Basic.yaml @@ -0,0 +1,106 @@ +components: + schemas: + User: + description: '' + properties: + createDate: + description: The date that the user was created. + format: date + type: string + dateOfBirth: + example: '1997-10-31' + format: date + type: string + email: + format: email + type: string + emailVerified: + description: Set to true if the user's email has been verified. + type: boolean + firstName: + type: string + id: + description: Unique identifier for the given user. + type: integer + lastName: + type: string + required: + - id + - firstName + - lastName + - email + - emailVerified + title: User + type: object + x-examples: + Alice Smith: + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice + id: 144 + lastName: Smith + signUpDate: '2019-08-24' +info: + description: Sample API + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0 + title: Basic + version: '1.0' +openapi: 3.0.0 +paths: + /users/{userId}: + get: + description: Get User Info by User ID + operationId: get-users-userId + parameters: + - description: Unique identifier of the user + in: path + name: userId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + examples: + Get User Alice Smith (json): + value: + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice + id: 142 + lastName: Smith + signUpDate: '2019-08-24' + schema: + $ref: '#/components/schemas/User' + application/xml: + examples: + Get User Alice Smith (xml): + value: + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice + id: 143 + lastName: Smith + signUpDate: '2019-08-24' + schema: + $ref: '#/components/schemas/User' + description: User Found + '404': + description: User Not Found + summary: Get User + tags: + - basic +servers: +- description: dev server + url: http://localhost:5001 +- description: test server + url: http://localhost:5001 +tags: +- description: Basic tag + name: basic diff --git a/test/oas_examples/v3.0/BasicVariablesInExample.yaml b/test/oas_examples/v3.0/BasicVariablesInExample.yaml new file mode 100644 index 0000000..05092cf --- /dev/null +++ b/test/oas_examples/v3.0/BasicVariablesInExample.yaml @@ -0,0 +1,115 @@ +components: + examples: + patch-user-example: + summary: Example patch user + value: + createDate: '{{UNIQUE_REFERENCE}}' + dateOfBirth: '{{ISO_TIMESTAMP}}' + email: alotta.rotta@gmail.com + emailVerified: true + firstName: '{{MY_VAR_NAME}}' + id: 1 + lastName: '{{MY_VAR_LAST_NAME}}' + schemas: + User: + description: '' + properties: + createDate: + description: The date that the user was created. + format: date + type: string + dateOfBirth: + format: date + type: string + email: + format: email + type: string + emailVerified: + description: Set to true if the user's email has been verified. + type: boolean + firstName: + type: string + id: + description: Unique identifier for the given user. + type: integer + lastName: + type: string + required: + - id + - firstName + - lastName + - email + - emailVerified + title: User + type: object +info: + description: Sample API + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0 + title: BasicExample + version: '1.0' +openapi: 3.0.0 +paths: + /users/{userId}: + patch: + description: Update User Info + operationId: patch-users-userId + parameters: + - description: Unique identifier of the user + in: path + name: userId + required: true + schema: + type: string + requestBody: + content: + application/json: + examples: + patch-user: + $ref: '#/components/examples/patch-user-example' + schema: + $ref: '#/components/schemas/User' + responses: + '200': + content: + application/json: + examples: + Get User Alice Smith (json): + value: + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice + id: 142 + lastName: Smith + signUpDate: '2019-08-24' + schema: + $ref: '#/components/schemas/User' + application/xml: + examples: + Get User Alice Smith (xml): + value: + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice + id: 143 + lastName: Smith + signUpDate: '2019-08-24' + schema: + $ref: '#/components/schemas/User' + description: User Found + '404': + description: User Not Found + summary: Patch User + tags: + - basic +servers: +- description: dev server + url: http://localhost:5001 +- description: test server + url: http://localhost:5001 +tags: +- description: Basic tag + name: basic diff --git a/test/oas_examples/v3.0/SampleProject.yaml b/test/oas_examples/v3.0/SampleProject.yaml new file mode 100644 index 0000000..f4cc0cf --- /dev/null +++ b/test/oas_examples/v3.0/SampleProject.yaml @@ -0,0 +1,357 @@ +components: + examples: + get-user-basic: + summary: Example request for Get User + value: + createDate: '2019-08-24' + dateOfBirth: '1997-10-31' + email: alotta.rotta@gmail.com + emailVerified: true + firstName: Alotta + id: 777 + lastName: Rotta + schemas: + Group: + description: '' + properties: + id: + description: Unique identifier for the given group. + type: integer + name: + example: admin + type: string + required: + - id + - name + title: Group + type: object + User: + description: '' + example: + createDate: '2019-08-24' + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice9 schema example + id: 999 + lastName: Smith9 + properties: + createDate: + description: The date that the user was created. + example: '2019-08-24' + format: date + type: string + dateOfBirth: + example: '1997-10-31' + format: date + type: string + email: + example: alix.smith@gmail.com + format: email + type: string + emailVerified: + description: Set to true if the user's email has been verified. + example: true + type: boolean + firstName: + example: Alix + type: string + id: + description: Unique identifier for the given user. + example: 0 + type: integer + lastName: + example: Smith + type: string + required: + - id + - firstName + - lastName + - email + - emailVerified + title: User + type: object + securitySchemes: + ApiKeyAuth: + in: header + name: X-API-Key + type: apiKey + BasicAuth: + scheme: basic + type: http + BearerAuth: + scheme: bearer + type: http +info: + description: 'Sample API Check "API Key" ' + license: + name: Apache 2.0 + url: https://www.apache.org/licenses/LICENSE-2.0 + title: Sample project + version: '1.0' +openapi: 3.0.0 +paths: + /groups/{groupId}: + get: + description: Get group of users + operationId: get-groups-groupId + parameters: + - description: group Id + in: path + name: groupId + required: true + schema: + default: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Group' + description: Group Found + '404': + description: Group Not Found + summary: Get group by ID + tags: + - advanced + /user: + post: + description: Create a new user. + operationId: post-user + requestBody: + content: + application/json: + examples: + basic: + $ref: '#/components/examples/get-user-basic' + schema: + properties: + dateOfBirth: + format: date + type: string + email: + type: string + firstName: + type: string + lastName: + type: string + required: + - firstName + - lastName + - email + - dateOfBirth + type: object + description: Post the necessary fields for the API to create a new user. + responses: + '200': + content: + application/json: + examples: + basic: + $ref: '#/components/examples/get-user-basic' + schema: + $ref: '#/components/schemas/User' + description: User Created + '400': + description: Missing Required Information + '409': + description: Email Already Taken + summary: Create New User + tags: + - basic + /users/: + get: + description: Retrieve the information of the user with the matching user ID. + operationId: get-users-query-id + parameters: + - description: Query Id. + in: query + name: pUserId + required: true + schema: + example: 888 + type: string + - description: Custom HTTP header + in: header + name: Custom-Header + schema: + type: string + - description: Custom HTTP header with default + in: header + name: Another-Custom-Header + schema: + default: abc + type: string + responses: + '200': + content: + application/json: + examples: + Get User Alice Smith: + value: + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice + id: 142 + lastName: Smith + signUpDate: '2019-08-24' + Get User Phil Smith: + value: + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Phil + id: 143 + lastName: Smith + signUpDate: '2019-08-24' + schema: + $ref: '#/components/schemas/User' + example: + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice + id: schema-example + lastName: Smith333 + signUpDate: '2019-08-24' + description: User Found + '404': + description: User Not Found + summary: Get User Info by Query Param + tags: + - basic + /users/{userId}: + get: + description: Retrieve the information of the user with the matching user ID. + operationId: get-users-userId + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + example: + createDate: '2019-08-24' + dateOfBirth: '1997-10-31' + email: alice.smith@gmail.com + emailVerified: true + firstName: Alice9998 resp example + id: 9998 + lastName: Smith9998 + description: User Found + '404': + description: User Not Found + summary: Get User Info by User ID + tags: + - advanced + parameters: + - description: Id of an existing user. + examples: + a: + summary: a summary + value: a + b: + summary: b summary + value: b + in: path + name: userId + required: true + schema: + type: integer + - description: Code as header + in: header + name: strCode + schema: + default: code_one + type: string + - description: Code as header2 + in: header + name: strCode2 + schema: + type: string + patch: + deprecated: true + description: Update the information of an existing user. + operationId: patch-users-userId + requestBody: + content: + application/json: + examples: + Update Email: + value: + email: rebecca@gmail.com + Update First Name: + value: + firstName: Rebecca + Update Last Name & Date of Birth: + value: + dateOfBirth: '1985-10-02' + lastName: Baker + schema: + properties: + dateOfBirth: + type: string + email: + description: If a new email is given, the user's email verified + property will be set to false. + type: string + firstName: + type: string + lastName: + type: string + type: object + description: Patch user properties to update. + responses: + '200': + content: + application/json: + examples: + Updated User Rebecca Baker: + value: + createDate: '2019-08-24' + dateOfBirth: '1985-10-02' + email: rebecca@gmail.com + emailVerified: false + firstName: Rebecca + id: 13 + lastName: Baker + schema: + $ref: '#/components/schemas/User' + description: User Updated + '404': + description: User Not Found + '409': + description: Email Already Taken + summary: Update User Information +servers: +- description: dev server + url: http://localhost:{port}/{version} + variables: + port: + default: '5000' + description: Port number + enum: + - '5000' + - '8080' + version: + default: v1 + description: API version +- description: test server + url: http://localhost:{port}/{version} + variables: + port: + default: '5000' + description: Port number + enum: + - '5000' + - '8080' + version: + default: v1 + description: API version +tags: +- description: Basic tag + name: basic +- description: Advanced tag + name: advanced diff --git a/test/oas_examples/v3.0/Swift5CodeGenerationBug2.yaml b/test/oas_examples/v3.0/Swift5CodeGenerationBug2.yaml new file mode 100644 index 0000000..c082e1d --- /dev/null +++ b/test/oas_examples/v3.0/Swift5CodeGenerationBug2.yaml @@ -0,0 +1,101 @@ +components: + schemas: + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + catFood: + type: string + type: object + description: Cat + required: + - type + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + dogFood: + type: string + type: object + description: Dog + required: + - type + type: object + Pet: + description: Base Pet + discriminator: + mapping: + Cat: '#/components/schemas/Cat' + Dog: '#/components/schemas/Dog' + propertyName: type + properties: + father: + $ref: '#/components/schemas/Pet' + mother: + $ref: '#/components/schemas/Pet' + name: + description: Name + type: string + store: + $ref: '#/components/schemas/PetStore' + type: + description: Type Diskriminator + type: string + required: + - type + type: object + PetStore: + description: PetStore + properties: + pets: + items: + $ref: '#/components/schemas/Pet' + type: array + type: object +info: + contact: + email: XXX.XXX@XXX.de + description: Das ist jetzt der erste OpenAPI 3.0 Endpoint + title: XXX + version: '1.0' +openapi: 3.0.1 +paths: + /api/v1/petresource/pet: + post: + description: Save a Pet. + operationId: savePet + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Pet' + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: PetResponse + summary: Save a Pet. + tags: + - v1/petresource + /api/v1/petresource/petstore: + post: + description: Save a Petstore. + operationId: savePetStore + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/PetStore' + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/PetStore' + description: PetStore + summary: Save a Petstore. + tags: + - v1/petresource diff --git a/test/oas_examples/v3.0/Swift5CodeGenerationStackOverflow#2966.yaml b/test/oas_examples/v3.0/Swift5CodeGenerationStackOverflow#2966.yaml new file mode 100644 index 0000000..d5fcb3c --- /dev/null +++ b/test/oas_examples/v3.0/Swift5CodeGenerationStackOverflow#2966.yaml @@ -0,0 +1,49 @@ +components: + schemas: + Pet: + properties: + id: + format: int64 + type: integer + x-is-unique: true + name: + example: doggie + type: string + pets: + items: + $ref: '#/components/schemas/Pet' + type: array + required: + - name + type: object +info: + description: This spec is mainly for testing Petstore server + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + '400': + description: Invalid input + summary: Add a new pet to the store + tags: + - pet +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet diff --git a/test/oas_examples/v3.0/ada__petstore.yaml b/test/oas_examples/v3.0/ada__petstore.yaml new file mode 100644 index 0000000..ec25c2c --- /dev/null +++ b/test/oas_examples/v3.0/ada__petstore.yaml @@ -0,0 +1,789 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + AnotherStatus: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PropertyNameMapping: + properties: + _type: + type: string + http_debug_operation: + type: string + type: + type: string + type_: + type: string + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + in: header + name: _type + required: true + schema: + format: int64 + type: integer + - description: type + in: query + name: type + required: true + schema: + type: string + - description: type_ + in: header + name: type_ + required: true + schema: + type: string + - description: http debug option (to test parameter naming option) + in: query + name: http_debug_option + required: true + schema: + type: string + responses: + 200: + description: OK + summary: parameter name mapping test + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/addUnsignedToIntegerWithInvalidMaxValue_test.yaml b/test/oas_examples/v3.0/addUnsignedToIntegerWithInvalidMaxValue_test.yaml new file mode 100644 index 0000000..bda7821 --- /dev/null +++ b/test/oas_examples/v3.0/addUnsignedToIntegerWithInvalidMaxValue_test.yaml @@ -0,0 +1,75 @@ +components: + schemas: + Person: + description: person + properties: + int32: + format: int32 + type: integer + int32_max: + format: int32 + maximum: 4294967295 + minimum: 0 + type: integer + int64: + format: int64 + type: integer + int64_max: + format: int64 + maximum: 18446744073709551615 + minimum: 0 + type: integer + integer: + type: integer + integer_max: + maximum: 4294967295 + minimum: 0 + type: integer + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + delete: + operationId: delete + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK + tags: + - person + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK + tags: + - person + - basic +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/additional-properties-deeply-nested.yaml b/test/oas_examples/v3.0/additional-properties-deeply-nested.yaml new file mode 100644 index 0000000..83b916a --- /dev/null +++ b/test/oas_examples/v3.0/additional-properties-deeply-nested.yaml @@ -0,0 +1,32 @@ +components: + schemas: + Person: + properties: + firstName: + type: string + lastName: + type: string + type: object +info: + title: Test additional properties with ref + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + post: + operationId: pingGet + responses: + default: + content: + application/json: + schema: + additionalProperties: + additionalProperties: + additionalProperties: + $ref: '#/components/schemas/Person' + type: object + type: object + type: object + description: default response +servers: +- url: http://localhost:8000/ diff --git a/test/oas_examples/v3.0/allOf-nullable.yaml b/test/oas_examples/v3.0/allOf-nullable.yaml new file mode 100644 index 0000000..01ff641 --- /dev/null +++ b/test/oas_examples/v3.0/allOf-nullable.yaml @@ -0,0 +1,39 @@ +components: + schemas: + club: + properties: + owner: + allOf: + - $ref: '#/components/schemas/owner' + nullable: true + owner: + properties: + name: + maxLength: 255 + type: string +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/club' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOf-readonly.yaml b/test/oas_examples/v3.0/allOf-readonly.yaml new file mode 100644 index 0000000..59a66c8 --- /dev/null +++ b/test/oas_examples/v3.0/allOf-readonly.yaml @@ -0,0 +1,39 @@ +components: + schemas: + club: + properties: + owner: + allOf: + - $ref: '#/components/schemas/owner' + readOnly: true + owner: + properties: + name: + maxLength: 255 + type: string +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/club' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOf-required-parent.yaml b/test/oas_examples/v3.0/allOf-required-parent.yaml new file mode 100644 index 0000000..8d1259a --- /dev/null +++ b/test/oas_examples/v3.0/allOf-required-parent.yaml @@ -0,0 +1,73 @@ +components: + schemas: + person: + allOf: + - $ref: '#/components/schemas/personForCreation' + - properties: + id: + format: int32 + type: integer + required: + - id + personForCreation: + allOf: + - $ref: '#/components/schemas/personForUpdate' + required: + - firstName + - name + - email + personForUpdate: + properties: + address: + maxLength: 255 + type: string + birthDate: + format: date + type: string + city: + maxLength: 255 + type: string + email: + format: email + type: string + firstName: + maxLength: 255 + type: string + name: + maxLength: 255 + type: string + nationality: + maxLength: 255 + type: string + phoneNumber: + pattern: ^((\+)33|0)[1-9](\d{2}){4}$ + type: string + postalCode: + maxLength: 255 + type: string +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/person' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOf-required.yaml b/test/oas_examples/v3.0/allOf-required.yaml new file mode 100644 index 0000000..4842207 --- /dev/null +++ b/test/oas_examples/v3.0/allOf-required.yaml @@ -0,0 +1,41 @@ +components: + schemas: + clubForCreation: + allOf: + - $ref: '#/components/schemas/clubForUpdate' + required: + - name + clubForUpdate: + properties: + name: + maxLength: 255 + type: string + shortName: + maxLength: 255 + type: string +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/clubForCreation' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOf.yaml b/test/oas_examples/v3.0/allOf.yaml new file mode 100644 index 0000000..701ac5b --- /dev/null +++ b/test/oas_examples/v3.0/allOf.yaml @@ -0,0 +1,64 @@ +components: + schemas: + Adult: + allOf: + - $ref: '#/components/schemas/Person' + - properties: + children: + items: + $ref: '#/components/schemas/Child' + type: array + type: object + description: A representation of an adult + Child: + allOf: + - properties: + age: + format: int32 + type: integer + type: object + - $ref: '#/components/schemas/Person' + description: A representation of a child + properties: + boosterSeat: + type: boolean + Person: + discriminator: + mapping: + a: '#/components/schemas/Adult' + c: Child + propertyName: $_type + properties: + $_type: + type: string + firstName: + type: string + lastName: + type: string + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOfDuplicatedProperties.yaml b/test/oas_examples/v3.0/allOfDuplicatedProperties.yaml new file mode 100644 index 0000000..ff3b27a --- /dev/null +++ b/test/oas_examples/v3.0/allOfDuplicatedProperties.yaml @@ -0,0 +1,46 @@ +components: + schemas: + ModelA: + properties: + duplicated_optional: + type: string + duplicated_required: + type: string + foo: + type: string + required: + - duplicated_required + ModelB: + properties: + bar: + type: string + duplicated_optional: + type: integer + duplicated_required: + type: integer + required: + - duplicated_required + ModelC: + allOf: + - $ref: '#/components/schemas/ModelA' + - $ref: '#/components/schemas/ModelB' + - properties: + baz: + type: string + type: object +info: + title: TestApi + version: 1.0.0 +openapi: 3.0.0 +paths: + /test: + get: + operationId: testApi + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ModelC' + description: Ok + summary: Test diff --git a/test/oas_examples/v3.0/allOfMappingDuplicatedProperties.yaml b/test/oas_examples/v3.0/allOfMappingDuplicatedProperties.yaml new file mode 100644 index 0000000..b22fc72 --- /dev/null +++ b/test/oas_examples/v3.0/allOfMappingDuplicatedProperties.yaml @@ -0,0 +1,91 @@ +components: + schemas: + Adult: + allOf: + - $ref: '#/components/schemas/Person' + - properties: + adult_required: + type: boolean + children: + items: + $ref: '#/components/schemas/Child' + type: array + duplicated_optional: + type: integer + duplicated_required: + type: integer + required: + - duplicated_required + - child_required + type: object + description: A representation of an adult + Child: + allOf: + - properties: + age: + format: int32 + type: integer + firstName: + type: string + type: object + - $ref: '#/components/schemas/Person' + description: A representation of a child + MapOnly: + additionalProperties: + type: string + MapOnlyWithProperties: + additionalProperties: + type: string + properties: + firstName: + type: string + Person: + discriminator: + mapping: + a: '#/components/schemas/Adult' + c: '#/components/schemas/Child' + propertyName: $_type + properties: + $_type: + type: string + duplicated_optional: + type: string + duplicated_required: + type: string + firstName: + type: string + lastName: + type: string + person_required: + format: date-time + type: string + required: + - duplicated_required + - person_required + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOfMultiParent.yaml b/test/oas_examples/v3.0/allOfMultiParent.yaml new file mode 100644 index 0000000..df4cbe1 --- /dev/null +++ b/test/oas_examples/v3.0/allOfMultiParent.yaml @@ -0,0 +1,94 @@ +components: + schemas: + Adult: + allOf: + - $ref: '#/components/schemas/Person' + - $ref: '#/components/schemas/Human' + - properties: + adult_required: + type: boolean + children: + items: + $ref: '#/components/schemas/Child' + type: array + duplicated_optional: + type: integer + duplicated_required: + type: integer + required: + - duplicated_required + - child_required + type: object + description: A representation of an adult + Child: + allOf: + - properties: + age: + format: int32 + type: integer + firstName: + type: string + type: object + - $ref: '#/components/schemas/Person' + description: A representation of a child + Human: + discriminator: + propertyName: $_type + properties: + $_type: + type: string + body: + type: string + required: + - body + type: object + Person: + discriminator: + mapping: + a: '#/components/schemas/Adult' + c: '#/components/schemas/Child' + propertyName: $_type + properties: + $_type: + type: string + duplicated_optional: + type: integer + duplicated_required: + type: integer + firstName: + type: string + lastName: + type: string + person_required: + format: date-time + type: string + required: + - duplicated_required + - person_required + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOf_composition.yaml b/test/oas_examples/v3.0/allOf_composition.yaml new file mode 100644 index 0000000..89a77f4 --- /dev/null +++ b/test/oas_examples/v3.0/allOf_composition.yaml @@ -0,0 +1,84 @@ +components: + schemas: + Hero: + description: Hero + properties: + origin: + type: string + reward: + format: int64 + type: integer + required: + - origin + type: object + Human: + description: Human + properties: + id: + format: int64 + type: integer + name: + example: Tom + type: string + required: + - id + type: object + SuperBaby: + allOf: + - $ref: '#/components/schemas/Human' + - properties: + age: + type: integer + gender: + type: string + required: + - level + SuperBoy: + allOf: + - $ref: '#/components/schemas/Human' + - properties: + category: + type: string + level: + type: integer + required: + - level + type: object + SuperMan: + allOf: + - $ref: '#/components/schemas/Human' + - $ref: '#/components/schemas/Hero' + - properties: + category: + type: string + level: + type: integer + required: + - level + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SuperMan' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOf_composition_discriminator.yaml b/test/oas_examples/v3.0/allOf_composition_discriminator.yaml new file mode 100644 index 0000000..68b4cc3 --- /dev/null +++ b/test/oas_examples/v3.0/allOf_composition_discriminator.yaml @@ -0,0 +1,101 @@ +components: + schemas: + A: + discriminator: + mapping: + b: '#/components/schemas/B' + propertyName: petType + properties: + petType: + type: string + required: + - petType + type: object + B: + allOf: + - $ref: '#/components/schemas/A' + C: + allOf: + - $ref: '#/components/schemas/B' + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + name: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + bark: + type: string + type: object + Lizard: + allOf: + - $ref: '#/components/schemas/Reptile' + - properties: + lovesRocks: + type: boolean + type: object + MyPets: + discriminator: + propertyName: petType + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Lizard' + MyPetsNoDisc: + oneOf: + - $ref: '#/components/schemas/Cat' + - $ref: '#/components/schemas/Lizard' + Pet: + discriminator: + propertyName: petType + properties: + petType: + type: string + required: + - petType + type: object + Reptile: + allOf: + - $ref: '#/components/schemas/Pet' + Snake: + allOf: + - $ref: '#/components/schemas/Reptile' + - properties: + hasLegs: + type: boolean + type: object +info: + title: OAI Specification example for Polymorphism + version: 1.0.0 +openapi: 3.0.2 +paths: + /mypets: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MyPets' + description: desc + /pet: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: desc + /reptile: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Reptile' + description: desc diff --git a/test/oas_examples/v3.0/allOf_composition_discriminator_recursive.yaml b/test/oas_examples/v3.0/allOf_composition_discriminator_recursive.yaml new file mode 100644 index 0000000..eecca8e --- /dev/null +++ b/test/oas_examples/v3.0/allOf_composition_discriminator_recursive.yaml @@ -0,0 +1,47 @@ +components: + schemas: + ExpressionToken: + allOf: + - $ref: '#/components/schemas/Token' + - properties: + tokens: + items: + $ref: '#/components/schemas/Token' + type: array + type: object + StringToken: + allOf: + - $ref: '#/components/schemas/Token' + - properties: + value: + type: string + type: object + Token: + discriminator: + mapping: + expression: '#/components/schemas/ExpressionToken' + string: '#/components/schemas/StringToken' + propertyName: type + properties: + metadata: + $ref: '#/components/schemas/TokenMetadata' + type: + type: string + required: + - type + type: object + TokenMetadata: + properties: + tag1: + type: string + type: object +info: + title: OAI Specification example for Polymorphism + version: 1.0.0 +openapi: 3.0.2 +paths: + /status: + get: + responses: + '201': + description: desc diff --git a/test/oas_examples/v3.0/allOf_extension_parent.yaml b/test/oas_examples/v3.0/allOf_extension_parent.yaml new file mode 100644 index 0000000..4c53203 --- /dev/null +++ b/test/oas_examples/v3.0/allOf_extension_parent.yaml @@ -0,0 +1,104 @@ +components: + schemas: + Adult: + allOf: + - $ref: '#/components/schemas/Person' + - properties: + children: + items: + $ref: '#/components/schemas/Child' + type: array + type: object + description: A representation of an adult + AnotherChild: + allOf: + - properties: + age: + format: int32 + type: integer + type: object + - $ref: '#/components/schemas/AnotherPerson' + description: another child class that does NOT extend/inherit AnotherPerson + AnotherParent: + description: parent object without x-parent extension + properties: + isParent: + type: boolean + mum_or_dad: + type: string + type: object + AnotherPerson: + allOf: + - properties: + $_type: + type: string + firstName: + type: string + lastName: + type: string + - $ref: '#/components/schemas/AnotherParent' + description: person object without x-parent extension + type: object + Child: + allOf: + - properties: + age: + format: int32 + type: integer + type: object + - $ref: '#/components/schemas/Person' + description: A representation of a child + Person: + description: person using x-parent (abstract) to indicate it's a parent class + properties: + $_type: + type: string + firstName: + type: string + lastName: + type: string + type: object + x-parent: abstract + allOfWithProperties: + allOf: + - $ref: '#/components/schemas/AnotherParent' + description: parent object without x-parent extension + properties: + isParent: + type: boolean + mum_or_dad: + type: string + required: + - isParent + type: object + allOfWithSingleItem: + allOf: + - $ref: '#/components/schemas/AnotherParent' + description: allOf with a single item + nullable: true +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOf_no_fields.yaml b/test/oas_examples/v3.0/allOf_no_fields.yaml new file mode 100644 index 0000000..9d2f866 --- /dev/null +++ b/test/oas_examples/v3.0/allOf_no_fields.yaml @@ -0,0 +1,43 @@ +components: + schemas: + BaseClass: + discriminator: + mapping: + WITHOUTPROPS: '#/components/schemas/ChildWithoutProperties' + WITHPROPS: '#/components/schemas/ChildWithProperties' + propertyName: myDiscrim + properties: + myDiscrim: + type: string + type: object + ChildWithProperties: + allOf: + - properties: + childProperty: + type: string + type: object + - $ref: '#/components/schemas/BaseClass' + type: object + ChildWithoutProperties: + allOf: + - $ref: '#/components/schemas/BaseClass' + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /example: + get: + operationId: dummyid + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BaseClass' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allOf_nullable.yaml b/test/oas_examples/v3.0/allOf_nullable.yaml new file mode 100644 index 0000000..c636521 --- /dev/null +++ b/test/oas_examples/v3.0/allOf_nullable.yaml @@ -0,0 +1,33 @@ +components: + schemas: + Child: + properties: + name: + type: string + type: object + Example: + properties: + child: + allOf: + - $ref: '#/components/schemas/Child' + nullable: true + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /example: + get: + operationId: list + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Example' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/allof_primitive.yaml b/test/oas_examples/v3.0/allof_primitive.yaml new file mode 100644 index 0000000..28b8441 --- /dev/null +++ b/test/oas_examples/v3.0/allof_primitive.yaml @@ -0,0 +1,152 @@ +components: + schemas: + AllOfDateTimer: + allOf: + - $ref: '#/components/schemas/DateTimer' + example: '2019-01-01 00:00:00' + Category: + properties: + id: + example: 1 + format: int64 + type: integer + name: + example: Dogs + type: string + type: object + xml: + name: category + DateTimer: + example: '2019-01-01T00:00:00' + format: date-time + type: string + Options: + properties: + a: + format: date-time + nullable: true + type: string + b: + format: date-time + nullable: true + type: string + c: + items: + type: string + type: array + type: object + Payment: + properties: + amount: + example: 625.0 + format: float + type: number + date: + $ref: '#/components/schemas/AllOfDateTimer' + type: object + Pet: + properties: + category: + $ref: '#/components/schemas/Category' + id: + example: 10 + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + xml: + name: photoUrl + type: array + xml: + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + wrapped: true + required: + - name + - photoUrls + type: object + xml: + name: pet + Tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: tag +info: + title: Foo + version: 1.0.0 +openapi: 3.0.0 +paths: + /foo: + get: + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Payment' + type: array + description: example + /test: + get: + operationId: test + parameters: + - explode: true + in: query + name: options + required: false + schema: + $ref: '#/components/schemas/Pet' + style: deepObject + - explode: true + in: query + name: inputOptions + required: false + schema: + $ref: '#/components/schemas/Options' + style: deepObject + responses: + '200': + content: + text/plain: + schema: + type: string + description: OK + post: + operationId: test_post + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: '#/components/schemas/Pet' + style: form + responses: + '200': + content: + text/plain: + schema: + type: string + description: OK diff --git a/test/oas_examples/v3.0/anyOf.yaml b/test/oas_examples/v3.0/anyOf.yaml new file mode 100644 index 0000000..8e44273 --- /dev/null +++ b/test/oas_examples/v3.0/anyOf.yaml @@ -0,0 +1,37 @@ +components: + schemas: + apple: + properties: + kind: + type: string + title: apple + type: object + banana: + properties: + count: + type: number + title: banana + type: object + fruit: + anyOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: + type: string + title: fruit + type: object +info: + title: fruity + version: 0.0.1 +openapi: 3.0.1 +paths: + /: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/fruit' + description: desc diff --git a/test/oas_examples/v3.0/anyOfDiscriminator.yaml b/test/oas_examples/v3.0/anyOfDiscriminator.yaml new file mode 100644 index 0000000..c43c01a --- /dev/null +++ b/test/oas_examples/v3.0/anyOfDiscriminator.yaml @@ -0,0 +1,243 @@ +components: + schemas: + AppleAllOfDisc: + allOf: + - $ref: '#/components/schemas/FruitType' + properties: + seeds: + type: integer + required: + - seeds + type: object + AppleAnyOfDisc: + anyOf: + - $ref: '#/components/schemas/FruitType' + properties: + seeds: + type: integer + required: + - seeds + type: object + AppleGrandparentDisc: + allOf: + - $ref: '#/components/schemas/Parent' + properties: + seeds: + type: integer + required: + - seeds + type: object + AppleReqDisc: + properties: + fruitType: + type: string + seeds: + type: integer + required: + - seeds + - fruitType + type: object + BananaAllOfDisc: + allOf: + - $ref: '#/components/schemas/FruitType' + properties: + length: + type: integer + required: + - length + type: object + BananaAnyOfDisc: + anyOf: + - $ref: '#/components/schemas/FruitType' + properties: + length: + type: integer + required: + - length + type: object + BananaGrandparentDisc: + allOf: + - $ref: '#/components/schemas/Parent' + properties: + length: + type: integer + required: + - length + type: object + BananaReqDisc: + properties: + fruitType: + type: string + length: + type: integer + required: + - length + - fruitType + type: object + ComposedDiscMissingFromProperties: + anyOf: + - $ref: '#/components/schemas/DiscMissingFromProperties' + discriminator: + propertyName: fruitType + ComposedDiscMissingNoProperties: + anyOf: + - $ref: '#/components/schemas/DiscMissingNoProperties' + discriminator: + propertyName: fruitType + ComposedDiscOptionalTypeCorrect: + anyOf: + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + discriminator: + propertyName: fruitType + ComposedDiscOptionalTypeInconsistent: + anyOf: + - $ref: '#/components/schemas/DiscOptionalTypeIncorrect' + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + discriminator: + propertyName: fruitType + ComposedDiscOptionalTypeIncorrect: + anyOf: + - $ref: '#/components/schemas/DiscOptionalTypeIncorrect' + discriminator: + propertyName: fruitType + ComposedDiscRequiredInconsistent: + anyOf: + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + - $ref: '#/components/schemas/FruitType' + discriminator: + propertyName: fruitType + ComposedDiscTypeInconsistent: + anyOf: + - $ref: '#/components/schemas/DiscTypeIncorrect' + - $ref: '#/components/schemas/FruitType' + discriminator: + propertyName: fruitType + ComposedDiscTypeIncorrect: + anyOf: + - $ref: '#/components/schemas/DiscTypeIncorrect' + discriminator: + propertyName: fruitType + DiscMissingFromProperties: + properties: + length: + type: integer + type: object + DiscMissingNoProperties: + type: object + DiscOptionalTypeCorrect: + properties: + fruitType: + type: string + type: object + DiscOptionalTypeIncorrect: + properties: + fruitType: + type: integer + type: object + DiscTypeIncorrect: + properties: + fruitType: + type: integer + required: + - fruitType + type: object + FruitAllOfDisc: + anyOf: + - $ref: '#/components/schemas/AppleAllOfDisc' + - $ref: '#/components/schemas/BananaAllOfDisc' + discriminator: + propertyName: fruitType + FruitAnyOfDisc: + anyOf: + - $ref: '#/components/schemas/AppleAnyOfDisc' + - $ref: '#/components/schemas/BananaAnyOfDisc' + discriminator: + propertyName: fruitType + FruitGrandparentDisc: + anyOf: + - $ref: '#/components/schemas/AppleGrandparentDisc' + - $ref: '#/components/schemas/BananaGrandparentDisc' + discriminator: + propertyName: fruitType + FruitInlineDisc: + anyOf: + - properties: + fruitType: + type: string + seeds: + type: integer + required: + - seeds + - fruitType + type: object + - properties: + fruitType: + type: string + length: + type: integer + required: + - length + - fruitType + type: object + discriminator: + propertyName: fruitType + FruitInlineInlineDisc: + anyOf: + - anyOf: + - properties: + fruitType: + type: string + required: + - fruitType + type: object + properties: + seeds: + type: integer + required: + - seeds + type: object + - anyOf: + - properties: + fruitType: + type: string + required: + - fruitType + type: object + properties: + length: + type: integer + required: + - length + type: object + discriminator: + propertyName: fruitType + FruitReqDisc: + anyOf: + - $ref: '#/components/schemas/AppleReqDisc' + - $ref: '#/components/schemas/BananaReqDisc' + discriminator: + propertyName: fruitType + FruitType: + properties: + fruitType: + type: string + required: + - fruitType + Parent: + allOf: + - $ref: '#/components/schemas/FruitType' + type: object +info: + title: fruity + version: 0.0.1 +openapi: 3.0.1 +paths: + /: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FruitAllOfDisc' + description: desc diff --git a/test/oas_examples/v3.0/any_codable.yaml b/test/oas_examples/v3.0/any_codable.yaml new file mode 100644 index 0000000..5f1d6d6 --- /dev/null +++ b/test/oas_examples/v3.0/any_codable.yaml @@ -0,0 +1,45 @@ +components: + schemas: + Pet: + properties: + testProperty: + type: string + required: + - testProperty + type: object +info: + title: Swagger Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pets: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Expected response to a valid request + tags: + - pets + /pets/{petId}: + get: + operationId: showPetById + parameters: + - description: The id of the pet to retrieve + in: path + name: petId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: object + description: Expected response to a valid request + summary: Info for a specific pet + tags: + - pets diff --git a/test/oas_examples/v3.0/any_type.yaml b/test/oas_examples/v3.0/any_type.yaml new file mode 100644 index 0000000..c7d5bfe --- /dev/null +++ b/test/oas_examples/v3.0/any_type.yaml @@ -0,0 +1,59 @@ +components: + schemas: + AnyValue: {} + AnyValueModel: + description: test any value + properties: + any_value: + $ref: '#/components/schemas/AnyValue' + any_value_nullable: + $ref: '#/components/schemas/AnyValueNullable' + any_value_with_desc: + $ref: '#/components/schemas/AnyValueWithDesc' + type: object + AnyValueModelInline: + description: test any value inline + properties: + any_value: {} + any_value_nullable: + description: inline any value nullable + nullable: true + any_value_with_desc: + description: inline any value + array_any_value: + items: {} + array_any_value_nullable: + items: + description: inline any value nullable + nullable: true + array_any_value_with_desc: + items: + description: inline any value + map_any_value_nullable: + additionalProperties: + description: inline any value nullable + nullable: true + map_any_value_with_desc: + additionalProperties: + description: inline any value + map_free_form_object: + additionalProperties: {} + type: object + AnyValueNullable: + description: Can be any value, including `null`. + nullable: true + AnyValueWithDesc: + description: Can be any value - string, number, boolean, array or object. +info: + title: ping test + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + operationId: pingGet + responses: + '201': + description: OK +servers: +- url: http://localhost:8000/ diff --git a/test/oas_examples/v3.0/api-with-ref-param.yaml b/test/oas_examples/v3.0/api-with-ref-param.yaml new file mode 100644 index 0000000..1b6049d --- /dev/null +++ b/test/oas_examples/v3.0/api-with-ref-param.yaml @@ -0,0 +1,24 @@ +components: + schemas: + Color: + enum: + - RED + - GREEN + - BLUE + type: string +info: + title: Demo + version: 0.0.0 +openapi: 3.0.3 +paths: + /demo/{color}: + get: + parameters: + - in: path + name: color + required: true + schema: + $ref: '#/components/schemas/Color' + responses: + 200: + description: OK diff --git a/test/oas_examples/v3.0/api__openapi.yaml b/test/oas_examples/v3.0/api__openapi.yaml new file mode 100644 index 0000000..6b0dc9c --- /dev/null +++ b/test/oas_examples/v3.0/api__openapi.yaml @@ -0,0 +1,201 @@ +components: + requestBodies: + nested_response: + content: + '*/*': + schema: + properties: + id: + type: string + password: + type: string + required: + - id + type: object + required: true + schemas: + ObjectOfObjects: + description: An object of objects + properties: + inner: + $ref: '#/components/schemas/ObjectOfObjects_inner' + type: object + ObjectOfObjects_inner: + properties: + optional_thing: + type: integer + required_thing: + type: string + required: + - required_thing + type: object + aNullableContainer: + properties: + NullableThing: + nullable: true + type: string + RequiredNullableThing: + nullable: true + type: string + required: + - RequiredNullableThing + type: object + additionalPropertiesObject: + additionalProperties: + type: string + description: An additionalPropertiesObject + example: foo + type: object + allOfObject: + allOf: + - $ref: '#/components/schemas/baseAllOf' + example: + sampleProperty: sampleProperty + properties: + sampleProperty: + type: string + baseAllOf: + properties: + sampleBaseProperty: + type: string + type: object + dummyPut_request: + properties: + id: + type: string + password: + type: string + required: + - id + type: object + get_yaml_response: + description: structured response + properties: + value: + description: Inner string + type: string + type: object +info: + description: This spec is for testing rust-server-specific things + title: rust-server-test + version: 2.3.4 +openapi: 3.0.1 +paths: + /allOf: + get: + description: Test getting an object which uses allOf + operationId: AllOf_Get + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/allOfObject' + description: OK + /dummy: + get: + operationId: dummyGet + responses: + '200': + content: {} + description: Success + summary: A dummy endpoint to make the spec valid. + put: + operationId: dummyPut + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/dummyPut_request' + required: true + responses: + '200': + content: {} + description: Success + x-codegen-request-body-name: nested_response + /file_response: + get: + operationId: file_responseGet + responses: + '200': + content: + application/json: + schema: + format: binary + type: string + description: Success + summary: Get a file + /get-structured-yaml: + get: + description: Test returning arbitrary structured YAML + operationId: getStructuredYaml + responses: + '200': + content: + application/yaml: + schema: + $ref: '#/components/schemas/get_yaml_response' + description: OK + /html: + post: + operationId: htmlPost + requestBody: + content: + text/html: + schema: + type: string + required: true + responses: + '200': + content: + text/html: + schema: + type: string + description: Success + summary: Test HTML handling + x-codegen-request-body-name: body + /post-yaml: + post: + description: Test sending an arbitrary unsupported format - e.g. YAML + operationId: post_yaml + requestBody: + content: + application/yaml: + schema: + type: string + description: The YAML body to test + required: true + responses: + '204': + content: {} + description: OK + x-codegen-request-body-name: value + /raw_json: + get: + operationId: raw_jsonGet + responses: + '200': + content: + '*/*': + schema: + type: object + description: Success + summary: Get an arbitrary JSON blob. + /solo-object: + post: + operationId: solo_objectPost + requestBody: + content: + application/json: + schema: + type: object + required: true + responses: + '204': + content: {} + description: OK + summary: Send an arbitrary JSON blob + x-codegen-request-body-name: value +servers: +- url: / +x-original-swagger-version: '2.0' diff --git a/test/oas_examples/v3.0/aspnetcore__petstore.yaml b/test/oas_examples/v3.0/aspnetcore__petstore.yaml new file mode 100644 index 0000000..5ffb00c --- /dev/null +++ b/test/oas_examples/v3.0/aspnetcore__petstore.yaml @@ -0,0 +1,778 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + Animal: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + DOG: '#/components/schemas/Dog' + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/parameter_example_test: + get: + description: '' + operationId: fake_parameter_example_test + parameters: + - in: query + name: data + required: true + schema: + $ref: '#/components/schemas/Pet' + responses: + default: + description: successful operation + summary: fake endpoint to test parameter example (object) + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/autoset_constant.yaml b/test/oas_examples/v3.0/autoset_constant.yaml new file mode 100644 index 0000000..9ae20ff --- /dev/null +++ b/test/oas_examples/v3.0/autoset_constant.yaml @@ -0,0 +1,42 @@ +components: + schemas: + HelloResponse: + properties: + message: + type: string + type: object +info: + description: '' + title: Example Hello API + version: v1 +openapi: 3.0.3 +paths: + /v1/hello/{name}: + get: + description: Say Hello + operationId: Hello + parameters: + - in: header + name: X-CUSTOM_CONSTANT_HEADER + required: true + schema: + enum: + - CONSTANT_VALUE + type: string + - in: path + name: name + required: true + schema: + type: string + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/HelloResponse' + description: Successful operation + tags: + - hello_example +servers: +- description: Global Endpoint + url: http://localhost diff --git a/test/oas_examples/v3.0/avro-schema__petstore.yaml b/test/oas_examples/v3.0/avro-schema__petstore.yaml new file mode 100644 index 0000000..ad8b1cb --- /dev/null +++ b/test/oas_examples/v3.0/avro-schema__petstore.yaml @@ -0,0 +1,743 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + statuses: + items: + $ref: '#/components/schemas/ApiResponseStatuses' + type: array + type: + type: string + title: An uploaded response + type: object + ApiResponseStatuses: + enum: + - success + - failure + - timeout + type: string + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/callbacks.yaml b/test/oas_examples/v3.0/callbacks.yaml new file mode 100644 index 0000000..65c09cd --- /dev/null +++ b/test/oas_examples/v3.0/callbacks.yaml @@ -0,0 +1,98 @@ +components: + schemas: + DeleteNotificationData: + description: subscription payload + properties: + timestamp: + format: date-time + type: string + NewNotificationData: + description: subscription payload + properties: + timestamp: + format: date-time + type: string + userData: + type: string +info: + title: Callback Example + version: 1.0.0 +openapi: 3.0.0 +paths: + /streams: + post: + callbacks: + dummy: {} + onData: + '{$request.query.callbackUrl}/data': + delete: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteNotificationData' + responses: + '202': + description: 'Your server implementation should return this HTTP + status code + + if the data was received successfully + + ' + '204': + description: 'Your server should return this HTTP status code if + no longer interested + + in further updates + + ' + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NewNotificationData' + responses: + '202': + description: 'Your server implementation should return this HTTP + status code + + if the data was received successfully + + ' + '204': + description: 'Your server should return this HTTP status code if + no longer interested + + in further updates + + ' + '{$request.query.callbackUrl}/test': {} + description: subscribes a client to receive out-of-band data + parameters: + - description: 'the location where data will be sent. Must be network accessible + + by the source server + + ' + in: query + name: callbackUrl + required: true + schema: + example: https://tonys-server.com + format: uri + type: string + responses: + '201': + content: + application/json: + schema: + description: subscription information + properties: + subscriptionId: + description: this unique identifier allows management of the subscription + example: 2531329f-fb09-4ef7-887e-84e648214436 + type: string + required: + - subscriptionId + description: subscription successfully created diff --git a/test/oas_examples/v3.0/composed-oneof.yaml b/test/oas_examples/v3.0/composed-oneof.yaml new file mode 100644 index 0000000..e0696e8 --- /dev/null +++ b/test/oas_examples/v3.0/composed-oneof.yaml @@ -0,0 +1,99 @@ +components: + schemas: + CustomOneOfArraySchema: + items: + discriminator: + mapping: + a-type: '#/components/schemas/ObjA' + b-type: '#/components/schemas/ObjB' + c-type: '#/components/schemas/ObjC' + propertyName: realtype + oneOf: + - $ref: '#/components/schemas/ObjA' + - $ref: '#/components/schemas/ObjB' + - $ref: '#/components/schemas/ObjC' + type: array + CustomOneOfSchema: + discriminator: + mapping: + a-type: '#/components/schemas/ObjA' + b-type: '#/components/schemas/ObjB' + propertyName: realtype + oneOf: + - $ref: '#/components/schemas/ObjA' + - $ref: '#/components/schemas/ObjB' + ObjA: + properties: + message: + type: string + realtype: + type: string + type: object + ObjB: + properties: + code: + format: int32 + type: integer + description: + type: string + realtype: + type: string + type: object + ObjC: + properties: + realtype: + type: string + state: + type: string + type: object + ObjD: + properties: + color: + type: string + realtype: + type: string + type: object +info: + title: oneOf test + version: 1.0.0 +openapi: 3.0.1 +paths: + /state: + get: + operationId: getState + responses: + '200': + content: + application/json: + schema: + discriminator: + mapping: + a-type: '#/components/schemas/ObjA' + b-type: '#/components/schemas/ObjB' + d-type: '#/components/schemas/ObjD' + propertyName: realtype + oneOf: + - $ref: '#/components/schemas/ObjA' + - $ref: '#/components/schemas/ObjB' + - $ref: '#/components/schemas/ObjD' + description: OK + post: + operationId: createState + requestBody: + content: + application/json: + schema: + discriminator: + mapping: + a-type: '#/components/schemas/ObjA' + b-type: '#/components/schemas/ObjB' + propertyName: realtype + oneOf: + - $ref: '#/components/schemas/ObjA' + - $ref: '#/components/schemas/ObjB' + required: true + responses: + '201': + description: OK +servers: +- url: http://localhost:8000/ diff --git a/test/oas_examples/v3.0/conflictingParameter.yaml b/test/oas_examples/v3.0/conflictingParameter.yaml new file mode 100644 index 0000000..88c0ca8 --- /dev/null +++ b/test/oas_examples/v3.0/conflictingParameter.yaml @@ -0,0 +1,54 @@ +info: + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet/{id}: + post: + operationId: create + parameters: + - in: path + name: id + required: true + schema: + format: int32 + type: integer + - in: header + name: id + schema: + format: int32 + type: integer + - in: cookie + name: id + schema: + format: int32 + type: integer + - in: query + name: id + schema: + format: int32 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + cookieId2: + format: int32 + type: integer + headerId2: + format: int32 + type: integer + id: + format: int32 + type: integer + pathid: + format: int32 + type: integer + queryId2: + format: int32 + type: integer + type: object + responses: + '400': + description: Invalid pet value diff --git a/test/oas_examples/v3.0/container-type-import.yaml b/test/oas_examples/v3.0/container-type-import.yaml new file mode 100644 index 0000000..6d17457 --- /dev/null +++ b/test/oas_examples/v3.0/container-type-import.yaml @@ -0,0 +1,64 @@ +components: + schemas: + ModelWithArrayProperty: + properties: + array_property: + items: + $ref: '#/components/schemas/SimpleModel' + type: array + id: + type: string + type: object + ModelWithMapProperty: + properties: + id: + type: string + map_property: + additionalProperties: + $ref: '#/components/schemas/SimpleModel' + type: object + ModelWithSetProperty: + properties: + id: + type: string + set_property: + items: + $ref: '#/components/schemas/SimpleModel' + type: array + uniqueItems: true + type: object + SimpleModel: + example: + id: 1 + name: Puma + properties: + id: + format: int64 + type: integer + name: + type: string + required: + - name + type: object +info: + title: Example API + version: 3.0.0 +openapi: 3.0.0 +paths: + /: + get: + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ModelWithArrayProperty' + type: array + uniqueItems: true + description: Good Request. + '400': + description: Bad Request. + '403': + description: Forbidden. Access denied. + summary: Empty Route diff --git a/test/oas_examples/v3.0/content-type.yaml b/test/oas_examples/v3.0/content-type.yaml new file mode 100644 index 0000000..d9a2c4c --- /dev/null +++ b/test/oas_examples/v3.0/content-type.yaml @@ -0,0 +1,28 @@ +info: + description: info + title: info + version: 0.1.0 +openapi: 3.0.2 +paths: + /example/api: + post: + description: description + requestBody: + content: + application/vnd.oracle.resource+json; type=singular: + schema: + type: object + responses: + 200: + content: + application/vnd.oracle.resource+json; type=collection: + schema: + type: object + description: response + default: + content: + application/vnd.oracle.resource+json; type=error: + schema: + type: object + description: error + summary: summary diff --git a/test/oas_examples/v3.0/convertEnumNullToNullable_test.yaml b/test/oas_examples/v3.0/convertEnumNullToNullable_test.yaml new file mode 100644 index 0000000..b1030e6 --- /dev/null +++ b/test/oas_examples/v3.0/convertEnumNullToNullable_test.yaml @@ -0,0 +1,48 @@ +components: + schemas: + AnyOfTest: + anyOf: + - type: string + - $ref: '#/components/schemas/EnumString' + - $ref: '#/components/schemas/EnumNullString' + - $ref: '#/components/schemas/EnumNull' + description: to test anyOf (string, enum string) + EnumNull: + enum: + - null + type: string + EnumNullString: + enum: + - 'null' + type: string + EnumString: + enum: + - A + - B + type: string +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AnyOfTest' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/cpp-qt__petstore.yaml b/test/oas_examples/v3.0/cpp-qt__petstore.yaml new file mode 100644 index 0000000..1c57870 --- /dev/null +++ b/test/oas_examples/v3.0/cpp-qt__petstore.yaml @@ -0,0 +1,754 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PetArray: + items: + $ref: '#/components/schemas/Pet' + title: An Array of pets + type: array + uniqueItems: true + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + TestAnyType: + description: test any type + properties: + code: + description: any type test + message: + type: string + title: test any type + type: object + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/all: + get: + operationId: allPets + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PetArray' + description: An array of all pets + summary: Get all pets in an array + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /primitives/integer: + post: + requestBody: + content: + text/plain: + examples: + example-1: + value: 123 + schema: + maximum: 4294967295 + minimum: 0 + type: integer + responses: + '200': + description: OK + summary: Post an integer + tags: + - primitives + /primitives/number: + put: + requestBody: + content: + text/plain: + examples: + example-1: + value: 123.192318 + schema: + type: number + responses: + '200': + description: OK + summary: Put a number + tags: + - primitives + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/crystal__petstore.yaml b/test/oas_examples/v3.0/crystal__petstore.yaml new file mode 100644 index 0000000..13843ff --- /dev/null +++ b/test/oas_examples/v3.0/crystal__petstore.yaml @@ -0,0 +1,858 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PropertyNameMapping: + properties: + _type: + type: string + http_debug_operation: + type: string + type: + type: string + type_: + type: string + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + format_test: + properties: + binary: + format: binary + type: string + byte: + format: byte + type: string + date: + example: '2020-02-02' + format: date + type: string + dateTime: + example: '2007-12-03T10:15:30+01:00' + format: date-time + type: string + decimal: + format: number + type: string + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + integer: + maximum: 100 + minimum: 10 + multipleOf: 2 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + multipleOf: 32.5 + type: number + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: ^\d{10}$ + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: /^image_\d{1,3}$/i + type: string + string: + pattern: /[a-z]/i + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + required: + - number + - byte + - date + - password + type: object + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + in: header + name: _type + required: true + schema: + format: int64 + type: integer + - description: type + in: query + name: type + required: true + schema: + type: string + - description: type_ + in: header + name: type_ + required: true + schema: + type: string + - description: type- + in: header + name: type- + required: true + schema: + type: string + - description: http debug option (to test parameter naming option) + in: query + name: http_debug_option + required: true + schema: + type: string + responses: + 200: + description: OK + summary: parameter name mapping test + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/dates-api.yaml b/test/oas_examples/v3.0/dates-api.yaml new file mode 100644 index 0000000..40c54aa --- /dev/null +++ b/test/oas_examples/v3.0/dates-api.yaml @@ -0,0 +1,25 @@ +info: + description: Thic spec contains endpoints with dates in different formats + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Dates + version: 1.0.0 +openapi: 3.0.0 +paths: + /now: + get: + responses: + '200': + content: + application/json: + schema: + properties: + now: + format: date-time + type: string + today: + format: date + type: string + type: object + description: now dates diff --git a/test/oas_examples/v3.0/deepobject-array-with-pattern.yaml b/test/oas_examples/v3.0/deepobject-array-with-pattern.yaml new file mode 100644 index 0000000..46e7c0a --- /dev/null +++ b/test/oas_examples/v3.0/deepobject-array-with-pattern.yaml @@ -0,0 +1,33 @@ +components: + schemas: + Options: + properties: + a: + items: + pattern: ^[A-Z].* + type: string + type: array + type: object +info: + title: deepobject-array-with-pattern-test + version: 1.0.0 +openapi: 3.0.3 +paths: + /test: + get: + operationId: test + parameters: + - explode: true + in: query + name: options + required: false + schema: + $ref: '#/components/schemas/Options' + style: deepObject + responses: + '200': + content: + text/plain: + schema: + type: string + description: OK diff --git a/test/oas_examples/v3.0/deepobject.yaml b/test/oas_examples/v3.0/deepobject.yaml new file mode 100644 index 0000000..553cb55 --- /dev/null +++ b/test/oas_examples/v3.0/deepobject.yaml @@ -0,0 +1,124 @@ +components: + schemas: + Category: + properties: + id: + example: 1 + format: int64 + type: integer + name: + example: Dogs + type: string + type: object + xml: + name: category + Options: + properties: + a: + format: date-time + nullable: true + type: string + b: + format: date-time + nullable: true + type: string + c: + items: + type: string + type: array + type: object + Pet: + properties: + category: + $ref: '#/components/schemas/Category' + id: + example: 10 + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + xml: + name: photoUrl + type: array + xml: + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + wrapped: true + required: + - name + - photoUrls + type: object + xml: + name: pet + Tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: tag +info: + title: deepobject-test + version: 1.0.0 +openapi: 3.0.3 +paths: + /test: + get: + operationId: test + parameters: + - explode: true + in: query + name: options + required: false + schema: + $ref: '#/components/schemas/Pet' + style: deepObject + - explode: true + in: query + name: inputOptions + required: false + schema: + $ref: '#/components/schemas/Options' + style: deepObject + responses: + '200': + content: + text/plain: + schema: + type: string + description: OK + post: + operationId: test_post + parameters: + - explode: true + in: query + name: query_object + required: false + schema: + $ref: '#/components/schemas/Pet' + style: form + responses: + '200': + content: + text/plain: + schema: + type: string + description: OK diff --git a/test/oas_examples/v3.0/deprecated-properties.yaml b/test/oas_examples/v3.0/deprecated-properties.yaml new file mode 100644 index 0000000..d0198aa --- /dev/null +++ b/test/oas_examples/v3.0/deprecated-properties.yaml @@ -0,0 +1,59 @@ +components: + schemas: + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + BigDog: + allOf: + - $ref: '#/components/schemas/Dog' + - discriminator: + propertyName: dogType + required: + - dogType + properties: + declawed: + deprecated: true + type: boolean + dogType: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object +info: + description: API description in Markdown. + title: Sample API + version: 1.0.0 +openapi: 3.0.0 +paths: + /animals: + get: + description: Optional extended description in Markdown. + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Animal' + description: OK + summary: Returns all animals. diff --git a/test/oas_examples/v3.0/dict_query_parameter.yaml b/test/oas_examples/v3.0/dict_query_parameter.yaml new file mode 100644 index 0000000..f5069ca --- /dev/null +++ b/test/oas_examples/v3.0/dict_query_parameter.yaml @@ -0,0 +1,29 @@ +info: + description: for testing query parameter dict + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: test spec + version: 1.0.0 +openapi: 3.0.0 +paths: + /query_parameter_dict: + get: + description: query parameter test + operationId: query_parameter_test + parameters: + - in: query + name: dict_string_integer + schema: + additionalProperties: + type: integer + responses: + '200': + description: successful operation + '400': + description: Invalid status value + summary: query parameter test + tags: + - fake +servers: +- url: http://testspec.org/v2 diff --git a/test/oas_examples/v3.0/dynamic-servers.yaml b/test/oas_examples/v3.0/dynamic-servers.yaml new file mode 100644 index 0000000..16f2bf1 --- /dev/null +++ b/test/oas_examples/v3.0/dynamic-servers.yaml @@ -0,0 +1,92 @@ +info: + description: This specification shows how to use dynamic servers. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Extension with dynamic servers + version: 1.0.0 +openapi: 3.0.0 +paths: + /custom: + get: + description: Use custom server + operationId: customServer + responses: + '200': + content: + application/json: + schema: + type: object + description: successful operation + servers: + - url: https://{server}.swagger.io:{port}/v2 + variables: + port: + default: '8080' + enum: + - '80' + - '8080' + server: + default: custom-petstore + enum: + - custom-petstore + - custom-qa-petstore + - custom-dev-petstore + - description: The local custom server + url: https://localhost:8081/{version} + variables: + version: + default: v2 + enum: + - v1 + - v2 + - v3 + - description: The local custom server + url: https://third.example.com/{prefix} + variables: + prefix: + default: custom + summary: Use custom server + tags: + - usage + /default: + get: + description: Use default server + operationId: defaultServer + responses: + '200': + content: + application/json: + schema: + type: object + description: successful operation + summary: Use default server + tags: + - usage +servers: +- description: petstore server + url: http://{server}.swagger.io:{port}/v2 + variables: + port: + default: '80' + enum: + - '80' + - '8080' + server: + default: petstore + enum: + - petstore + - qa-petstore + - dev-petstore +- description: The local server + url: https://localhost:8080/{version} + variables: + version: + default: v1 + enum: + - v1 + - v2 + - v3 +tags: +- description: Show usage of dynamic servers + name: usage diff --git a/test/oas_examples/v3.0/empty-object.yaml b/test/oas_examples/v3.0/empty-object.yaml new file mode 100644 index 0000000..ed61f4b --- /dev/null +++ b/test/oas_examples/v3.0/empty-object.yaml @@ -0,0 +1,23 @@ +components: + schemas: + EmptyObject: + properties: + emptyObject: + type: object + type: object +info: + description: Ensure rust supports empty objects using serde::Value + title: EmptyObject + version: 1.0.0 +openapi: 3.0.0 +paths: + /endpoint: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/EmptyObject' + description: Successful response + summary: Get endpoint diff --git a/test/oas_examples/v3.0/enableKeepOnlyFirstTagInOperation_test.yaml b/test/oas_examples/v3.0/enableKeepOnlyFirstTagInOperation_test.yaml new file mode 100644 index 0000000..6e04317 --- /dev/null +++ b/test/oas_examples/v3.0/enableKeepOnlyFirstTagInOperation_test.yaml @@ -0,0 +1,85 @@ +components: + schemas: + Dummy: + description: to test x-internal + properties: + test: + type: string + type: object + x-internal: true + Person: + description: person + properties: + $_type: + type: string + firstName: + type: string + lastName: + type: string + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + delete: + operationId: delete + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK + tags: + - person + x-internal: true + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK + tags: + - person + - basic + put: + operationId: put + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK + tags: + - person +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/enum-and-inner-enum-uri.yaml b/test/oas_examples/v3.0/enum-and-inner-enum-uri.yaml new file mode 100644 index 0000000..f811024 --- /dev/null +++ b/test/oas_examples/v3.0/enum-and-inner-enum-uri.yaml @@ -0,0 +1,37 @@ +components: + schemas: + Metadata: + enum: + - https://example.com/v1/metadata.json + - https://example.com/v2/metadata.json + format: uri + type: string +info: + description: '' + title: Example API + version: v1 +openapi: 3.0.3 +paths: + /v1/schemas: + get: + responses: + default: + content: + application/json: + schema: + properties: + data: + default: https://example.com/v1/schema.json + enum: + - https://example.com/v1/schema.json + - https://example.com/v2/schema.json + format: uri + type: string + metadata: + $ref: '#/components/schemas/Metadata' + type: object + description: List of schemas + summary: Get a list of schemas +servers: +- description: Global Endpoint + url: http://localhost diff --git a/test/oas_examples/v3.0/enum.yaml b/test/oas_examples/v3.0/enum.yaml new file mode 100644 index 0000000..dffbc1d --- /dev/null +++ b/test/oas_examples/v3.0/enum.yaml @@ -0,0 +1,32 @@ +components: + schemas: + Pony: + properties: + type: + $ref: '#/components/schemas/Type' + type: object + Type: + enum: + - Earth + - Pegasi + - Unicorn + type: string +info: + description: API description in Markdown. + title: Sample API + version: 1.0.0 +openapi: 3.0.0 +paths: + /ponies: + get: + description: Optional extended description in Markdown. + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pony' + type: array + description: OK + summary: Returns all animals. diff --git a/test/oas_examples/v3.0/explode-query-parameter.yaml b/test/oas_examples/v3.0/explode-query-parameter.yaml new file mode 100644 index 0000000..d5554b2 --- /dev/null +++ b/test/oas_examples/v3.0/explode-query-parameter.yaml @@ -0,0 +1,45 @@ +components: + schemas: + SomeReturnValue: + properties: + someValue: + type: string + required: + - someValue + type: object +info: + description: Explode query params + title: Explode query params + version: 1.0.0 +openapi: 3.0.3 +paths: + /api/search: + get: + operationId: Search + parameters: + - in: query + name: regular-param + required: false + schema: + type: string + - in: query + name: object-param + required: true + schema: + properties: + someBoolean: + type: boolean + someInteger: + type: integer + someString: + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SomeReturnValue' + description: Some description. +servers: +- url: http://localhost:8080 diff --git a/test/oas_examples/v3.0/exploded-query-param-array.yaml b/test/oas_examples/v3.0/exploded-query-param-array.yaml new file mode 100644 index 0000000..15b321b --- /dev/null +++ b/test/oas_examples/v3.0/exploded-query-param-array.yaml @@ -0,0 +1,41 @@ +components: + schemas: + SomeReturnValue: + properties: + someValue: + type: string + required: + - someValue + type: object +info: + description: Exploded query params + title: Exploded query param array + version: 1.0.0 +openapi: 3.0.3 +paths: + /api: + get: + operationId: GetSomeValue + parameters: + - explode: true + in: query + name: QueryObject + schema: + properties: + values: + items: + type: string + type: array + type: object + style: form + responses: + '200': + content: + application/json: + example: + someValue: value + schema: + $ref: '#/components/schemas/SomeReturnValue' + description: Some return value +servers: +- url: localhost:8080 diff --git a/test/oas_examples/v3.0/form-duplicated-parameter.yaml b/test/oas_examples/v3.0/form-duplicated-parameter.yaml new file mode 100644 index 0000000..1c822c2 --- /dev/null +++ b/test/oas_examples/v3.0/form-duplicated-parameter.yaml @@ -0,0 +1,50 @@ +components: + schemas: + FormParameters: + properties: + id: + format: int64 + readOnly: true + type: integer + type: object + securitySchemes: + oAuthConfig: + flows: + implicit: + authorizationUrl: ../backend/login/openid + scopes: {} + type: oauth2 +info: + description: Minimal OpenAPI spec file to showcase duplicated params for formData. + title: FormData Test Api Documentation + version: 0.0.1 +openapi: 3.0.1 +paths: + /form-param-poc/{id}: + put: + operationId: form-param-poc_update + parameters: + - in: path + name: id + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/FormParameters' + responses: + '200': + description: OK. + security: + - oAuthConfig: [] + summary: fullUpdate + tags: + - form-param-poc +servers: +- url: /backend/rest +tags: +- description: File storage resource for Fiscalization France standard + name: form-param-poc diff --git a/test/oas_examples/v3.0/form-multipart-binary-array.yaml b/test/oas_examples/v3.0/form-multipart-binary-array.yaml new file mode 100644 index 0000000..1af10ba --- /dev/null +++ b/test/oas_examples/v3.0/form-multipart-binary-array.yaml @@ -0,0 +1,89 @@ +components: + schemas: + MultipartMixedStatus: + description: additional field as Enum + enum: + - ALLOWED + - IN_PROGRESS + - REJECTED + example: REJECTED + type: string +info: + title: MultipartFile test + version: 1.0.0 +openapi: 3.0.1 +paths: + /multipart-array: + post: + description: MultipartFile array test + operationId: multipartArray + requestBody: + content: + multipart/form-data: + schema: + properties: + files: + description: Many files + items: + format: binary + type: string + type: array + type: object + responses: + '204': + description: Successful operation + tags: + - multipart + /multipart-mixed: + post: + description: Mixed MultipartFile test + operationId: multipartMixed + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + description: a file + format: binary + type: string + marker: + description: additional object + properties: + name: + type: string + type: object + status: + $ref: '#/components/schemas/MultipartMixedStatus' + statusArray: + items: + $ref: '#/components/schemas/MultipartMixedStatus' + type: array + required: + - status + - file + type: object + responses: + '204': + description: Successful operation + tags: + - multipart + /multipart-single: + post: + description: Single MultipartFile test + operationId: multipartSingle + requestBody: + content: + multipart/form-data: + schema: + properties: + file: + description: One file + format: binary + type: string + type: object + responses: + '204': + description: Successful operation + tags: + - multipart diff --git a/test/oas_examples/v3.0/generate-alias-as-model.yaml b/test/oas_examples/v3.0/generate-alias-as-model.yaml new file mode 100644 index 0000000..6344923 --- /dev/null +++ b/test/oas_examples/v3.0/generate-alias-as-model.yaml @@ -0,0 +1,64 @@ +components: + schemas: + ArrayAlias: + items: + type: integer + type: array + MapAlias: + additionalProperties: + type: string + type: object +info: + description: This specification shows how to generate aliases to maps and arrays + as models. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Extension generating aliases to maps and arrays as models + version: 1.0.0 +openapi: 3.0.0 +paths: + /array: + get: + description: Use alias to array + operationId: array + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ArrayAlias' + responses: + '200': + content: + application/json: + schema: + type: object + description: successful operation + summary: Use alias to array + tags: + - usage + /map: + get: + description: Use alias to map + operationId: map + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MapAlias' + responses: + '200': + content: + application/json: + schema: + type: object + description: successful operation + summary: Use alias to map + tags: + - usage +servers: +- description: petstore server + url: http://petstore.swagger.io/v2 +tags: +- description: Show usage of x-generate-alias-as-model extension + name: usage diff --git a/test/oas_examples/v3.0/generic.yaml b/test/oas_examples/v3.0/generic.yaml new file mode 100644 index 0000000..dd0bc8b --- /dev/null +++ b/test/oas_examples/v3.0/generic.yaml @@ -0,0 +1,58 @@ +components: + schemas: + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + BigDog: + allOf: + - $ref: '#/components/schemas/Dog' + - discriminator: + propertyName: dogType + required: + - dogType + properties: + declawed: + type: boolean + dogType: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object +info: + description: API description in Markdown. + title: Sample API + version: 1.0.0 +openapi: 3.0.0 +paths: + /animals: + get: + description: Optional extended description in Markdown. + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Animal' + description: OK + summary: Returns all animals. diff --git a/test/oas_examples/v3.0/haskell__petstore.yaml b/test/oas_examples/v3.0/haskell__petstore.yaml new file mode 100644 index 0000000..233ce03 --- /dev/null +++ b/test/oas_examples/v3.0/haskell__petstore.yaml @@ -0,0 +1,749 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + SpecialCharacters: + description: description + properties: + '"': + description: double quote + type: string + \: + description: backslash + type: string + required: + - '"' + - \ + type: object + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/http-basic-test.yaml b/test/oas_examples/v3.0/http-basic-test.yaml new file mode 100644 index 0000000..fd5ad86 --- /dev/null +++ b/test/oas_examples/v3.0/http-basic-test.yaml @@ -0,0 +1,123 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + schemas: + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + securitySchemes: + http_basic: + scheme: basic + type: http +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - http_basic: [] + summary: Add a new pet to the store + tags: + - pet +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet diff --git a/test/oas_examples/v3.0/inline_model_allof_propertyof_oneof.yaml b/test/oas_examples/v3.0/inline_model_allof_propertyof_oneof.yaml new file mode 100644 index 0000000..cb0c009 --- /dev/null +++ b/test/oas_examples/v3.0/inline_model_allof_propertyof_oneof.yaml @@ -0,0 +1,56 @@ +components: + schemas: + Filter: + description: A tag for a pet + properties: + fid: + format: int64 + type: integer + fname: + type: string + title: Pet Tag + type: object + Order: + allOf: + - $ref: '#/components/schemas/Tag' + - properties: + inline_model: + properties: + something: + type: string + inline_oneof: + oneOf: + - $ref: '#/components/schemas/Tag' + - $ref: '#/components/schemas/Filter' + length: + format: int64 + type: integer + shipDate: + format: date-time + type: string + type: object + description: An order for a pets from the pet store + title: Pet Order + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object +info: + title: ping test + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + operationId: pingGet + responses: + '201': + description: OK +servers: +- url: http://localhost:8000/ diff --git a/test/oas_examples/v3.0/inline_request_body_no_components.yaml b/test/oas_examples/v3.0/inline_request_body_no_components.yaml new file mode 100644 index 0000000..8aa8eba --- /dev/null +++ b/test/oas_examples/v3.0/inline_request_body_no_components.yaml @@ -0,0 +1,24 @@ +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /test1: + post: + operationId: test1 + requestBody: + content: + application/json: + schema: + properties: + name: + type: string + type: object + description: test + responses: + '200': + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/issue-11340.yaml b/test/oas_examples/v3.0/issue-11340.yaml new file mode 100644 index 0000000..a4872df --- /dev/null +++ b/test/oas_examples/v3.0/issue-11340.yaml @@ -0,0 +1,29 @@ +info: + description: With Bean Validation @NotNull and type of parameter must be separated + by space. + title: Issue 11340 - Bean Validation Breaks Generated Java Code + version: 1.0.2 +openapi: 3.0.3 +paths: + /configuration: + put: + description: Operation with required header and required request body + operationId: operation + parameters: + - in: header + name: x-non-null-header-parameter + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + additionalProperties: + type: object + minProperties: 1 + type: object + required: true + responses: + '200': + description: OK diff --git a/test/oas_examples/v3.0/issue-17367.yaml b/test/oas_examples/v3.0/issue-17367.yaml new file mode 100644 index 0000000..a5cd0bf --- /dev/null +++ b/test/oas_examples/v3.0/issue-17367.yaml @@ -0,0 +1,24 @@ +info: + title: Foo API + version: 1.0.0 +openapi: 3.0.0 +paths: + /foo: + post: + requestBody: + content: + multipart/form-data: + schema: + properties: + bar: + format: binary + type: string + type: object + responses: + '200': + description: OK +servers: +- url: http://127.0.0.1:8080/{basePath} + variables: + basePath: + default: v1 diff --git a/test/oas_examples/v3.0/issue-4062.yaml b/test/oas_examples/v3.0/issue-4062.yaml new file mode 100644 index 0000000..8e53e69 --- /dev/null +++ b/test/oas_examples/v3.0/issue-4062.yaml @@ -0,0 +1,33 @@ +components: + schemas: + PetEnum: + description: An enum with complex-ish naming + enum: + - myFirstValue + - MY_SECOND_VALUE + type: string +info: + description: Test for issue 4062 + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /enum: + get: + description: '' + operationId: getEnum + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/PetEnum' + description: success + summary: Get enums + tags: + - enum +servers: +- url: http://petstore.swagger.io/v2 diff --git a/test/oas_examples/v3.0/issue11088-model-mutable-with-containers.yaml b/test/oas_examples/v3.0/issue11088-model-mutable-with-containers.yaml new file mode 100644 index 0000000..9a5d06f --- /dev/null +++ b/test/oas_examples/v3.0/issue11088-model-mutable-with-containers.yaml @@ -0,0 +1,51 @@ +components: + schemas: + MyModel: + description: Model with properties that should be mutable in Kotlin + properties: + myFreeFormObject: + additionalProperties: + type: object + type: object + myFreeFormObjectWithComplexValues: + additionalProperties: + properties: + myArrayOfInts: + items: + type: integer + type: array + mySetOfStrings: + items: + type: string + type: array + uniqueItems: true + type: object + type: object + myFreeFormObjectWithPrimitiveValues: + additionalProperties: + type: integer + type: object + myIntArray: + items: + type: integer + type: array + myStringSet: + items: + type: string + type: array + uniqueItems: true +info: + title: Issue 11088 - modelMutable and Kotlin container types + version: 0.1.0 +openapi: 3.0.3 +paths: + /: + get: + operationId: myOperation + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MyModel' + description: Success diff --git a/test/oas_examples/v3.0/issue11242.yaml b/test/oas_examples/v3.0/issue11242.yaml new file mode 100644 index 0000000..36640f7 --- /dev/null +++ b/test/oas_examples/v3.0/issue11242.yaml @@ -0,0 +1,37 @@ +components: + schemas: + SomeReturnValue: + properties: + someParam: + type: string + required: + - someParam + type: object +info: + description: White space encoding in path parameters + title: Issue 11242 - Path Param encoding + version: 1.0.0 +openapi: 3.0.3 +paths: + /api/{someParam}: + get: + operationId: GetSomeParam + responses: + '200': + content: + application/json: + example: + someParam: someValue + schema: + $ref: '#/components/schemas/SomeReturnValue' + description: Some return value + summary: View some param + parameters: + - description: Some parameter. + in: path + name: someParam + required: true + schema: + type: string +servers: +- url: localhost:8080 diff --git a/test/oas_examples/v3.0/issue12474-multiline-description.yaml b/test/oas_examples/v3.0/issue12474-multiline-description.yaml new file mode 100644 index 0000000..d8b4378 --- /dev/null +++ b/test/oas_examples/v3.0/issue12474-multiline-description.yaml @@ -0,0 +1,34 @@ +info: + title: test + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + description: '# Multi-line descriptions + + + This is an example of a multi-line description. + + + It: + + - has multiple lines + + - uses Markdown (CommonMark) for rich text representation' + operationId: ping + responses: + 200: + description: OK + summary: Multi-line descriptions + tags: + - pingTag +tags: +- description: 'This is a multine tag : + + * tag item 1 + + * tag item 2 + + ' + name: pingTag diff --git a/test/oas_examples/v3.0/issue13146_file_abstraction_response.yaml b/test/oas_examples/v3.0/issue13146_file_abstraction_response.yaml new file mode 100644 index 0000000..8ef76f6 --- /dev/null +++ b/test/oas_examples/v3.0/issue13146_file_abstraction_response.yaml @@ -0,0 +1,19 @@ +info: + title: Response file abstraction test + version: 1.0.0 +openapi: 3.0.1 +paths: + /resource: + get: + description: Response file abstraction + operationId: resourceInResponse + responses: + '200': + content: + application/octet-stream: + schema: + format: binary + type: string + description: Successful operation + tags: + - resource diff --git a/test/oas_examples/v3.0/issue13506-defaultValue-numbers.yaml b/test/oas_examples/v3.0/issue13506-defaultValue-numbers.yaml new file mode 100644 index 0000000..3447d8b --- /dev/null +++ b/test/oas_examples/v3.0/issue13506-defaultValue-numbers.yaml @@ -0,0 +1,51 @@ +components: + schemas: + ModelWithPropertyHavingDefault: + properties: + propertyDouble1: + default: 0 + format: double + type: number + propertyDouble2: + default: 0.0 + format: double + type: number + propertyDouble3: + default: 0.01 + format: double + type: number + propertyFloat1: + default: 0 + format: float + type: number + propertyFloat2: + default: 0.0 + format: float + type: number + propertyFloat3: + default: 0.01 + format: float + type: number + propertyInt: + default: 0 + format: int32 + type: integer + propertyLong: + default: 0 + format: int64 + type: integer +info: + title: Issue X default value number with format + version: latest +openapi: 3.0.0 +paths: + /: + get: + operationId: operation + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ModelWithPropertyHavingDefault' + description: Success diff --git a/test/oas_examples/v3.0/issue14525.yaml b/test/oas_examples/v3.0/issue14525.yaml new file mode 100644 index 0000000..0a7b911 --- /dev/null +++ b/test/oas_examples/v3.0/issue14525.yaml @@ -0,0 +1,18 @@ +info: + title: Demo app + version: 1.0.0 +openapi: 3.0.3 +paths: + /demo: + get: + operationId: demo + responses: + '200': + content: + application/json: + schema: + items: + type: string + type: array + description: Demo response + summary: Demo diff --git a/test/oas_examples/v3.0/issue392.yaml b/test/oas_examples/v3.0/issue392.yaml new file mode 100644 index 0000000..9c4638d --- /dev/null +++ b/test/oas_examples/v3.0/issue392.yaml @@ -0,0 +1,99 @@ +components: + schemas: + Pet: + description: A pet for sale in the pet store + properties: + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +info: + description: Used for verification of AuthorizationScope resolution issue + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + /pet/{petId}: + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - petstore_auth: + - read:pets + summary: Find pet by ID + tags: + - pet +servers: +- url: http://petstore.swagger.io/v2 diff --git a/test/oas_examples/v3.0/issue4111-multiline-operation-description.yaml b/test/oas_examples/v3.0/issue4111-multiline-operation-description.yaml new file mode 100644 index 0000000..7f4dcb3 --- /dev/null +++ b/test/oas_examples/v3.0/issue4111-multiline-operation-description.yaml @@ -0,0 +1,23 @@ +info: + title: test + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + description: '# Multi-line descriptions + + + This is an example of a multi-line description. + + + It: + + - has multiple lines + + - uses Markdown (CommonMark) for rich text representation' + operationId: ping + responses: + 200: + description: OK + summary: Multi-line descriptions diff --git a/test/oas_examples/v3.0/issue4584.yaml b/test/oas_examples/v3.0/issue4584.yaml new file mode 100644 index 0000000..a0fa3d7 --- /dev/null +++ b/test/oas_examples/v3.0/issue4584.yaml @@ -0,0 +1,110 @@ +components: + schemas: + Pet: + description: A pet for sale in the pet store + properties: + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + securitySchemes: + petstore_auth: + flows: + authorizationCode: + authorizationUrl: https://petstore.swagger.io/oauth2/auth + scopes: + read:pets: read your pets + write:pets: modify pets in your account + tokenUrl: https://petstore.swagger.io/oauth2/token + type: oauth2 + petstore_beta_auth: + flows: + authorizationCode: + authorizationUrl: https://petstore.beta.swagger.io/oauth2/auth + scopes: + read:pets: read your pets + write:pets: modify pets in your account + tokenUrl: https://petstore.beta.swagger.io/oauth2/token + type: oauth2 +info: + description: Used for verification of AuthorizationScope resolution issue + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + - petstore_beta_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + /pet/{petId}: + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - petstore_auth: + - read:pets + - petstore_beta_auth: + - read:pets + summary: Find pet by ID + tags: + - pet +servers: +- url: http://petstore.swagger.io/v2 diff --git a/test/oas_examples/v3.0/issue4808.yaml b/test/oas_examples/v3.0/issue4808.yaml new file mode 100644 index 0000000..90372f5 --- /dev/null +++ b/test/oas_examples/v3.0/issue4808.yaml @@ -0,0 +1,45 @@ +components: + schemas: + SomeReturnValue: + properties: + someValue: + type: string + required: + - someValue + type: object +info: + description: Exploded query params + title: Issue 11242 - exploded query params + version: 1.0.0 +openapi: 3.0.3 +paths: + /api: + get: + operationId: GetSomeValue + parameters: + - explode: true + in: query + name: QueryObject + schema: + properties: + maxBuilds: + type: integer + maxWaitSecs: + type: integer + since: + type: string + sinceBuild: + type: string + type: object + style: form + responses: + '200': + content: + application/json: + example: + someValue: value + schema: + $ref: '#/components/schemas/SomeReturnValue' + description: Some return value +servers: +- url: localhost:8080 diff --git a/test/oas_examples/v3.0/issue5497-use-tags-kotlin.yaml b/test/oas_examples/v3.0/issue5497-use-tags-kotlin.yaml new file mode 100644 index 0000000..1344a8a --- /dev/null +++ b/test/oas_examples/v3.0/issue5497-use-tags-kotlin.yaml @@ -0,0 +1,21 @@ +info: + title: test + version: '1.0' +openapi: 3.0.1 +paths: + /api/v1/test: + get: + operationId: test1 + responses: + 200: + description: OK + tags: + - Test v1 + /api/v2/test: + get: + operationId: test2 + responses: + 200: + description: OK + tags: + - Test v2 diff --git a/test/oas_examples/v3.0/issue677.yaml b/test/oas_examples/v3.0/issue677.yaml new file mode 100644 index 0000000..f3aa727 --- /dev/null +++ b/test/oas_examples/v3.0/issue677.yaml @@ -0,0 +1,21 @@ +components: {} +info: + description: API under test + title: My title + version: 1.0.7 +openapi: 3.0.1 +paths: + /issue677: + post: + requestBody: + content: + application/json: + schema: + items: + type: string + type: array + responses: + 201: + description: OK +servers: +- url: https://localhost:9999/root diff --git a/test/oas_examples/v3.0/issue796.yaml b/test/oas_examples/v3.0/issue796.yaml new file mode 100644 index 0000000..4b2f0cd --- /dev/null +++ b/test/oas_examples/v3.0/issue796.yaml @@ -0,0 +1,46 @@ +components: + schemas: + MapObject: + properties: + map_test1: + $ref: '#/components/schemas/MapTest1' + map_test2: + $ref: '#/components/schemas/MapTest2' + map_test3: + $ref: '#/components/schemas/MapTest3' + other_obj: + $ref: '#/components/schemas/OtherObj' + MapTest1: + additionalProperties: {} + description: This type example 1 + type: object + MapTest2: + additionalProperties: true + description: This type example 2 + type: object + MapTest3: + additionalProperties: + type: object + description: This type example 3 + type: object + OtherObj: + additionalProperties: false + description: This type example 4 + type: object +info: + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Issue 796 + version: 1.0.0 +openapi: 3.0.1 +paths: + /test: + get: + responses: + 201: + description: Successful response + tags: + - test +servers: +- url: http://localhost:123/api diff --git a/test/oas_examples/v3.0/issue8352.yaml b/test/oas_examples/v3.0/issue8352.yaml new file mode 100644 index 0000000..4173295 --- /dev/null +++ b/test/oas_examples/v3.0/issue8352.yaml @@ -0,0 +1,18 @@ +info: + title: test handle of free form query parameters + version: 0.0.1 +openapi: 3.0.0 +paths: + /some/endpoint: + get: + parameters: + - in: query + name: free-form + schema: + type: object + style: form + responses: + 200: + description: test +servers: +- url: http://localhost diff --git a/test/oas_examples/v3.0/issue855.yaml b/test/oas_examples/v3.0/issue855.yaml new file mode 100644 index 0000000..bc3d14c --- /dev/null +++ b/test/oas_examples/v3.0/issue855.yaml @@ -0,0 +1,28 @@ +components: + headers: + Request: + description: ID of the request, unique to the call, as determined by the initiating + party. + example: 99391c7e-ad88-49ec-a2ad-99ddcb1f7721 + required: true + schema: + format: uuid + type: string + responses: + OK_200: + description: OK + headers: + Request: + $ref: '#/components/headers/Request' +info: + title: Issue 855 example + version: 1.0.0 +openapi: 3.0.1 +paths: + /ping: + get: + description: Returns the content of a payment object + responses: + '200': + $ref: '#/components/responses/OK_200' + summary: Get Payment Information diff --git a/test/oas_examples/v3.0/issue8792.yaml b/test/oas_examples/v3.0/issue8792.yaml new file mode 100644 index 0000000..b3fdfd3 --- /dev/null +++ b/test/oas_examples/v3.0/issue8792.yaml @@ -0,0 +1,52 @@ +info: + title: test useAbstractionForFiles for jaxrs-cxf + version: 0.0.1 +openapi: 3.0.0 +paths: + /files/upload: + post: + requestBody: + content: + application/octet-stream: + schema: + format: binary + type: string + description: The file content to upload + required: true + responses: + 200: + content: + application/json: + schema: + properties: + id: + type: string + type: object + description: id + /files/{id}: + get: + parameters: + - in: path + name: id + required: true + schema: + type: string + responses: + 200: + content: + application/octet-stream: + schema: + format: binary + type: string + description: File content + 500: + content: + application/json: + schema: + properties: + errormsg: + type: string + type: object + description: error message +servers: +- url: http://localhost diff --git a/test/oas_examples/v3.0/issue_10056.yaml b/test/oas_examples/v3.0/issue_10056.yaml new file mode 100644 index 0000000..7d41911 --- /dev/null +++ b/test/oas_examples/v3.0/issue_10056.yaml @@ -0,0 +1,15 @@ +components: + schemas: {} + securitySchemes: {} +info: + description: sample spec + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: {} +servers: +- url: /relative/url +tags: [] diff --git a/test/oas_examples/v3.0/issue_10244.yaml b/test/oas_examples/v3.0/issue_10244.yaml new file mode 100644 index 0000000..00623e0 --- /dev/null +++ b/test/oas_examples/v3.0/issue_10244.yaml @@ -0,0 +1,26 @@ +components: + schemas: + ModelWithEnumPropertyHavingDefault: + properties: + propertyName: + default: VALUE + enum: + - VALUE + type: string + required: + - propertyName +info: + title: Issue 10224 Enum default value + version: latest +openapi: 3.0.0 +paths: + /: + get: + operationId: operation + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ModelWithEnumPropertyHavingDefault' + description: Success diff --git a/test/oas_examples/v3.0/issue_10278.yaml b/test/oas_examples/v3.0/issue_10278.yaml new file mode 100644 index 0000000..ccdb154 --- /dev/null +++ b/test/oas_examples/v3.0/issue_10278.yaml @@ -0,0 +1,114 @@ +components: + parameters: + TestParameter1: + description: 'Type of token + + ' + in: query + name: testParameter1 + schema: + $ref: '#/components/schemas/TestParameter1' + schemas: + Category: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Category + Tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + TestParameter1: + default: BAR + enum: + - FOO + - BAR + type: string + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + contact: + email: apiteam@swagger.io + 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.' + license: + 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 +openapi: 3.0.1 +paths: + /get: + put: + operationId: getPet + parameters: + - $ref: '#/components/parameters/TestParameter1' + - in: query + name: TestParameter2 + schema: + default: BAR + enum: + - FOO + - BAR + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body +servers: +- url: https://petstore.swagger.io/v2 +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + externalDocs: + description: Find out more + url: http://swagger.io + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + externalDocs: + description: Find out more about our store + url: http://swagger.io + name: user diff --git a/test/oas_examples/v3.0/issue_10725.yaml b/test/oas_examples/v3.0/issue_10725.yaml new file mode 100644 index 0000000..e098fac --- /dev/null +++ b/test/oas_examples/v3.0/issue_10725.yaml @@ -0,0 +1,46 @@ +components: + schemas: + ObjectContainingByteArray: + properties: + byteArray: + format: byte + type: string + type: object +info: + description: byteArray schema isX type checks + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /RxRefObjectContainingByteArray: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ObjectContainingByteArray' + description: ComposedNumber + /TxRxByteArray: + post: + requestBody: + content: + application/json: + schema: + format: byte + type: string + required: true + responses: + '200': + content: + application/json: + schema: + format: byte + type: string + description: ComposedObject +servers: +- url: http://petstore.swagger.io:80/v2 +tags: [] diff --git a/test/oas_examples/v3.0/issue_10792.yaml b/test/oas_examples/v3.0/issue_10792.yaml new file mode 100644 index 0000000..a8d69eb --- /dev/null +++ b/test/oas_examples/v3.0/issue_10792.yaml @@ -0,0 +1,57 @@ +components: + schemas: + animal: + discriminator: + mapping: + BIRD: '#/components/schemas/bird' + propertyName: type + properties: + id: + format: uuid + type: string + required: + - id + title: An animal + type: object + bird: + allOf: + - $ref: '#/components/schemas/animal' + - properties: + featherType: + type: string + required: + - featherType + title: A bird + type: object +info: + contact: + email: contact@example.org + url: https://example.org + description: An example + title: Example + version: '0.1' +openapi: 3.0.1 +paths: + /v1/bird/{id}: + get: + operationId: get-bird + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/bird' + description: OK + tags: + - bird + parameters: + - in: path + name: id + required: true + schema: + format: uuid + type: string +servers: +- url: http://example.org +tags: +- name: bird diff --git a/test/oas_examples/v3.0/issue_10866_bigdecimal_default.yaml b/test/oas_examples/v3.0/issue_10866_bigdecimal_default.yaml new file mode 100644 index 0000000..ec1ffeb --- /dev/null +++ b/test/oas_examples/v3.0/issue_10866_bigdecimal_default.yaml @@ -0,0 +1,46 @@ +components: + schemas: + Apa: + properties: + bepa: + default: 0 + format: long + type: number + cepa: + default: 6.28318 + type: number + depa: + default: 71 + type: number + epa: + default: -71 + nullable: false + type: number + fepa: + default: 100 + deprecated: true + nullable: true + type: number + gepa: + nullable: true + type: number + required: + - bepa + - cepa + type: object +info: + title: Demo + version: 1.0.0 +openapi: 3.0.0 +paths: + /test: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Apa' + required: true + responses: + 200: + description: Successful operation diff --git a/test/oas_examples/v3.0/issue_11304_kotlin_backticks_reserved_words.yaml b/test/oas_examples/v3.0/issue_11304_kotlin_backticks_reserved_words.yaml new file mode 100644 index 0000000..ef242fb --- /dev/null +++ b/test/oas_examples/v3.0/issue_11304_kotlin_backticks_reserved_words.yaml @@ -0,0 +1,21 @@ +info: + title: Kotlin Issue + version: '1.0' +openapi: 3.0.3 +paths: + /test/{value}: + post: + operationId: test + parameters: + - example: something + in: path + name: value + required: true + schema: + type: string + responses: + '200': + description: OK + summary: test +servers: +- url: http://localhost diff --git a/test/oas_examples/v3.0/issue_11464.yaml b/test/oas_examples/v3.0/issue_11464.yaml new file mode 100644 index 0000000..a21cf2a --- /dev/null +++ b/test/oas_examples/v3.0/issue_11464.yaml @@ -0,0 +1,43 @@ +info: + title: Example Api + version: 1.0.0 +openapi: 3.0.3 +paths: + /multiple: + get: + operationId: get_multiple_tags + responses: + '200': + content: + application/json: + schema: + type: string + description: OK + summary: Multiple Tags + tags: + - tag1 + - tag2 + /none: + get: + operationId: get_none + responses: + '200': + content: + application/json: + schema: + type: string + description: OK + summary: No Tag + /single: + get: + operationId: get_single_tag + responses: + '200': + content: + application/json: + schema: + type: string + description: OK + summary: Single Tag + tags: + - tag1 diff --git a/test/oas_examples/v3.0/issue_11521.yaml b/test/oas_examples/v3.0/issue_11521.yaml new file mode 100644 index 0000000..b898d6a --- /dev/null +++ b/test/oas_examples/v3.0/issue_11521.yaml @@ -0,0 +1,17 @@ +components: + schemas: + DateTimeObject: + properties: + datetime: + pattern: '[\d]{4}-[\d]{2}-[\d]{2}T[\d]{1,2}:[\d]{2}Z' + type: string +info: + description: a spec to test free form object models + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: {} +tags: [] diff --git a/test/oas_examples/v3.0/issue_11537.yaml b/test/oas_examples/v3.0/issue_11537.yaml new file mode 100644 index 0000000..cc8dc20 --- /dev/null +++ b/test/oas_examples/v3.0/issue_11537.yaml @@ -0,0 +1,44 @@ +info: + contact: + email: xyz@xyz.com + name: Test Svc + description: Metadata Service + title: metadata-svc + version: 3.1.2 +openapi: 3.0.1 +paths: + /v1/a-path: + get: + description: Get something from somewhere. + operationId: getSomething + responses: + 200: + content: + application/json: + schema: + items: + type: string + type: array + description: List of groups. + summary: A generic getter operation. + tags: + - metadata + /v1/another-path: + post: + description: Insert something somewhere. + operationId: putSomething + responses: + 201: + content: + application/json: + schema: + type: string + description: List of groups. + summary: Insert something. + tags: + - metadata +servers: +- url: https://localhost:8080/ +tags: +- description: APIs to get metadata. + name: metadata diff --git a/test/oas_examples/v3.0/issue_11897.yaml b/test/oas_examples/v3.0/issue_11897.yaml new file mode 100644 index 0000000..c91bca1 --- /dev/null +++ b/test/oas_examples/v3.0/issue_11897.yaml @@ -0,0 +1,130 @@ +components: + schemas: + TestResponse: + description: Object + properties: + enabled: + description: Default value is false. + example: false + type: boolean + required: + - enabled + title: TestResponse + type: object + securitySchemes: + bearerAuth: + in: header + name: Authorization + type: apiKey +info: + contact: + email: xyz@xyz.com + name: Test Svc + description: Metadata Service + title: metadata-svc + version: 3.1.2 +openapi: 3.0.1 +paths: + /v1/array-of-objects: + get: + description: Get the list of groups for this example. + operationId: getWithArrayOfObjects + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TestResponse' + type: array + description: List of groups. + summary: Get groups. + tags: + - metadata + /v1/array-of-string: + get: + description: Get the list of groups for this example. + operationId: getWithArrayOfString + responses: + 200: + content: + application/json: + schema: + items: + type: string + type: array + description: List of groups. + summary: Get groups. + tags: + - metadata + /v1/map-of-objects: + get: + description: Get the map of groups for this example. + operationId: getWithMapOfObjects + responses: + 200: + content: + application/json: + schema: + additionalProperties: + $ref: '#/components/schemas/TestResponse' + type: object + description: Map of groups. + summary: Get groups. + tags: + - metadata + /v1/map-of-strings: + get: + description: Get the map of strings for this example. + operationId: getWithMapOfStrings + responses: + 200: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: Map of strings. + summary: Get groups. + tags: + - metadata + /v1/set-of-objects: + get: + description: Get the set of groups for this example. + operationId: getWithSetOfObjects + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/TestResponse' + type: array + uniqueItems: true + description: Set of groups. + summary: Get groups. + tags: + - metadata + /v1/set-of-strings: + get: + description: Get the set of strings for this example. + operationId: getWithSetOfStrings + responses: + 200: + content: + application/json: + schema: + items: + type: string + type: array + uniqueItems: true + description: Set of strings. + summary: Get groups. + tags: + - metadata +servers: +- url: https://localhost:8080/ +tags: +- description: APIs to get metadata. + name: metadata diff --git a/test/oas_examples/v3.0/issue_11957.yaml b/test/oas_examples/v3.0/issue_11957.yaml new file mode 100644 index 0000000..509e8dd --- /dev/null +++ b/test/oas_examples/v3.0/issue_11957.yaml @@ -0,0 +1,125 @@ +info: + title: Search API + version: '1.0' +openapi: 3.0.2 +paths: + /default-list: + get: + operationId: defaultList + parameters: + - in: query + name: p + schema: + default: 0 + minimum: 0 + type: integer + - in: query + name: orderBy + schema: + default: + - updatedAt:DESC + - createdAt:DESC + items: + enum: + - createdAt:ASC + - createdAt:DESC + - updatedAt:ASC + - updatedAt:DESC + type: string + type: array + responses: + 204: + description: Custom response + tags: + - search + /default-set: + get: + operationId: defaultSet + parameters: + - in: query + name: p + schema: + default: 0 + minimum: 0 + type: integer + - in: query + name: orderBy + schema: + default: + - updatedAt:DESC + - createdAt:DESC + items: + enum: + - createdAt:ASC + - createdAt:DESC + - updatedAt:ASC + - updatedAt:DESC + type: string + type: array + uniqueItems: true + responses: + 204: + description: Custom response + tags: + - search + /empty-default-list: + get: + operationId: emptyDefaultList + parameters: + - description: Page + in: query + name: p + schema: + default: 0 + minimum: 0 + type: integer + - in: query + name: orderBy + schema: + default: [] + items: + enum: + - createdAt:ASC + - createdAt:DESC + - updatedAt:ASC + - updatedAt:DESC + type: string + type: array + responses: + 204: + description: Custom response + tags: + - search + /empty-default-set: + get: + operationId: emptyDefaultSet + parameters: + - description: Page + in: query + name: p + schema: + default: 0 + minimum: 0 + type: integer + - in: query + name: orderBy + schema: + default: [] + items: + enum: + - createdAt:ASC + - createdAt:DESC + - updatedAt:ASC + - updatedAt:DESC + type: string + type: array + uniqueItems: true + responses: + 204: + description: Custom response + tags: + - search +servers: +- url: http://localhost:8080/api/v1 +tags: +- name: search diff --git a/test/oas_examples/v3.0/issue_12196.yaml b/test/oas_examples/v3.0/issue_12196.yaml new file mode 100644 index 0000000..bd8d25d --- /dev/null +++ b/test/oas_examples/v3.0/issue_12196.yaml @@ -0,0 +1,19 @@ +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: {} +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +x-will-cause-the-fail: true diff --git a/test/oas_examples/v3.0/issue_12445.yaml b/test/oas_examples/v3.0/issue_12445.yaml new file mode 100644 index 0000000..9fe8231 --- /dev/null +++ b/test/oas_examples/v3.0/issue_12445.yaml @@ -0,0 +1,64 @@ +components: + schemas: + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + age: + type: integer + hunts: + type: boolean + type: object + Dog: + allOf: + - description: Dog information + - $ref: '#/components/schemas/Pet' + - properties: + bark: + type: boolean + breed: + enum: + - Dingo + - Husky + - Retriever + - Shepherd + type: string + type: object + Pet: + properties: + petType: + $ref: '#/components/schemas/PetByType' + required: + - petType + type: object + PetByType: + enum: + - Cat + - Dog + type: string +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /pets/petType/{type}: + get: + parameters: + - in: path + name: type + required: true + schema: + $ref: '#/components/schemas/PetByType' + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: get by type +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/issue_12457.yaml b/test/oas_examples/v3.0/issue_12457.yaml new file mode 100644 index 0000000..14be1f1 --- /dev/null +++ b/test/oas_examples/v3.0/issue_12457.yaml @@ -0,0 +1,33 @@ +info: + description: sample to vet integer handling + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /request: + get: + operationId: wildcardSubTypeForContentType + requestBody: + content: + application/*: + schema: + format: binary + type: string + application/octet-stream: + schema: + format: binary + type: string + description: The attachment + responses: + '200': + content: + application/*: + schema: + type: string + application/json: + schema: + type: string + description: response + tags: + - users +tags: [] diff --git a/test/oas_examples/v3.0/issue_12494.yaml b/test/oas_examples/v3.0/issue_12494.yaml new file mode 100644 index 0000000..57a527c --- /dev/null +++ b/test/oas_examples/v3.0/issue_12494.yaml @@ -0,0 +1,37 @@ +components: + schemas: + ChildClass: + allOf: + - $ref: '#/components/schemas/ParentClass' + - properties: + objectType: + default: ChildClass + type: string + type: object + type: object + MapClass: + additionalProperties: + type: string + type: object + ParentClass: + discriminator: + propertyName: objectType + properties: + objectType: + default: ParentClass + type: string + someMap: + $ref: '#/components/schemas/MapClass' + type: object +info: + title: Example Api + version: 1.0.0 +openapi: 3.0.3 +paths: + /dummy: + get: + operationId: dummy + responses: + '200': + description: OK + summary: dummy diff --git a/test/oas_examples/v3.0/issue_12790.yaml b/test/oas_examples/v3.0/issue_12790.yaml new file mode 100644 index 0000000..ab53dc0 --- /dev/null +++ b/test/oas_examples/v3.0/issue_12790.yaml @@ -0,0 +1,28 @@ +components: + schemas: + TestObject: + properties: + notNullableProperty: + readOnly: true + type: string + notNullablePropertyNotRO: + type: integer + nullableProperty: + nullable: true + readOnly: true + type: string + type: object +info: + title: Title + version: '1' +openapi: 3.0.3 +paths: + /test: + get: + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/TestObject' + description: Success diff --git a/test/oas_examples/v3.0/issue_12857.yaml b/test/oas_examples/v3.0/issue_12857.yaml new file mode 100644 index 0000000..bf09837 --- /dev/null +++ b/test/oas_examples/v3.0/issue_12857.yaml @@ -0,0 +1,17 @@ +components: + schemas: + FooOptional: + properties: + foo: {} + FooRequired: + properties: + foo: {} + required: + - foo +info: + description: sample spec for testing openapi functionality, built from json schema + tests for draft6 + title: openapi 3.0.3 sample spec + version: 0.0.1 +openapi: 3.0.3 +paths: {} diff --git a/test/oas_examples/v3.0/issue_12929.yaml b/test/oas_examples/v3.0/issue_12929.yaml new file mode 100644 index 0000000..f12c6cf --- /dev/null +++ b/test/oas_examples/v3.0/issue_12929.yaml @@ -0,0 +1,115 @@ +components: + schemas: + AppleSpecificFields: + allOf: + - $ref: '#/components/schemas/SpecificFields' + - properties: + evseType: + enum: + - ONE + - TWO + - THREE + type: string + type: object + type: object + CherrySpecificFields: + allOf: + - $ref: '#/components/schemas/SpecificFields' + - properties: + chargeCapacity: + format: double + type: number + dischargeCapacity: + format: double + type: number + storageCapacity: + format: double + type: number + type: object + type: object + FruitInfo: + properties: + fruitType: + enum: + - CHERRY + - APPLE + - GENERIC + type: string + fruitTypeSpecificFields: + $ref: '#/components/schemas/SpecificFields' + installDate: + format: date-time + type: string + manufacturer: + maxLength: 255 + minLength: 0 + type: string + model: + maxLength: 255 + minLength: 0 + type: string + uuid: + maxLength: 36 + minLength: 0 + type: string + type: object + xml: + name: fruitInfo + GenericFruitFields: + allOf: + - $ref: '#/components/schemas/SpecificFields' + - properties: + category: + maxLength: 255 + minLength: 0 + type: string + type: object + type: object + SpecificFields: + discriminator: + mapping: + AppleSpecificFields: '#/components/schemas/AppleSpecificFields' + CherrySpecificFields: '#/components/schemas/CherrySpecificFields' + GenericFruitFields: '#/components/schemas/GenericFruitFields' + propertyName: name + oneOf: + - $ref: '#/components/schemas/AppleSpecificFields' + - $ref: '#/components/schemas/CherrySpecificFields' + - $ref: '#/components/schemas/GenericFruitFields' + type: object +info: + title: test + version: '1' +openapi: 3.0.1 +paths: + /v1/program/{programId}/enrollment/{sourceAccountNumber}/fruits: + post: + operationId: addFruit + parameters: + - in: path + name: programId + required: true + schema: + pattern: ^[a-z0-9-]*$ + type: string + - in: path + name: sourceAccountNumber + required: true + schema: + pattern: ^[a-z0-9_-]*$ + type: string + requestBody: + content: + application/xml: + schema: + $ref: '#/components/schemas/FruitInfo' + required: true + responses: + '401': + content: + text/plain: + schema: + type: string + description: OK +servers: +- url: / diff --git a/test/oas_examples/v3.0/issue_13025.yaml b/test/oas_examples/v3.0/issue_13025.yaml new file mode 100644 index 0000000..6500f4f --- /dev/null +++ b/test/oas_examples/v3.0/issue_13025.yaml @@ -0,0 +1,44 @@ +components: + schemas: + Body: + properties: + arrayThatIsNull: + items: + type: string + nullable: true + type: array + type: object + BodyWithRequired: + properties: + arrayThatIsNotNull: + items: + type: string + type: array + required: + - arrayThatIsNotNull + type: object + BodyWithRequiredNullable: + properties: + arrayThatIsNull: + items: + type: string + nullable: true + type: array + required: + - arrayThatIsNull + type: object +info: + title: Array Not Null + version: 1.0.0 +openapi: 3.0.3 +paths: + /array/not/null: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Body' + responses: + '200': + description: Success diff --git a/test/oas_examples/v3.0/issue_13043_recursive_model.yaml b/test/oas_examples/v3.0/issue_13043_recursive_model.yaml new file mode 100644 index 0000000..b9502ae --- /dev/null +++ b/test/oas_examples/v3.0/issue_13043_recursive_model.yaml @@ -0,0 +1,103 @@ +components: + schemas: + GeoJsonGeometry: + description: GeoJSON geometry + discriminator: + mapping: + GeometryCollection: '#/components/schemas/GeometryCollection' + Point: '#/components/schemas/Point' + propertyName: type + externalDocs: + url: http://geojson.org/geojson-spec.html#geometry-objects + oneOf: + - $ref: '#/components/schemas/Point' + - $ref: '#/components/schemas/GeometryCollection' + title: GeoJsonGeometry + GeometryCollection: + description: GeoJSon geometry collection + externalDocs: + url: http://geojson.org/geojson-spec.html#geometrycollection + properties: + geometries: + items: + $ref: '#/components/schemas/GeoJsonGeometry' + type: array + type: + default: GeometryCollection + type: string + required: + - type + - geometries + title: GeometryCollection + type: object + Point: + description: GeoJSON geometry + externalDocs: + url: http://geojson.org/geojson-spec.html#id2 + properties: + coordinates: + description: Point in 3D space + externalDocs: + url: http://geojson.org/geojson-spec.html#id2 + items: + format: double + type: number + maxItems: 3 + minItems: 2 + title: Point3D + type: array + type: + default: Point + type: string + required: + - type + title: Point + type: object +info: + termsOfService: http://api.apitest.com/party/tos/ + title: APITest API documentation. + version: 01.01.00 +openapi: 3.0.0 +paths: + /geojson: + post: + operationId: post-geojson + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GeoJsonGeometry' + responses: + '201': + content: + application/json: + schema: + description: GeoJson ID + type: string + description: Created + '400': + description: Bad Request + summary: Add a GeoJson Object + /geojson_geometry_collection: + post: + operationId: post-geojson-geometry-collection + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GeometryCollection' + responses: + '201': + content: + application/json: + schema: + description: GeoJson ID + type: string + description: Created + '400': + description: Bad Request + summary: Add a GeoJson GeometryCollection Object +servers: +- url: https://api.apitest.com/v1 diff --git a/test/oas_examples/v3.0/issue_13150.yaml b/test/oas_examples/v3.0/issue_13150.yaml new file mode 100644 index 0000000..7fca44a --- /dev/null +++ b/test/oas_examples/v3.0/issue_13150.yaml @@ -0,0 +1,59 @@ +components: + responses: + Parent: + content: + application/json: + schema: + $ref: '#/components/schemas/Parent' + description: The saved account definition. + schemas: + Foo: + allOf: + - $ref: '#/components/schemas/Parent' + - properties: + fooType: + type: string + type: object + Parent: + description: Defines an account by name. + discriminator: + mapping: + foo: '#/components/schemas/Foo' + propertyName: type + properties: + name: + description: The account name. + type: string + type: + description: The account type discriminator. + type: string + required: + - name + - type + type: object +info: + title: FooService + version: 1.0.0 +openapi: 3.0.0 +paths: + /parent: + put: + operationId: putParent + parameters: + - description: Name of the account being updated. + in: path + name: name + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Parent' + description: The updated account definition to save. + required: true + responses: + '200': + $ref: '#/components/responses/Parent' + summary: put parent diff --git a/test/oas_examples/v3.0/issue_13917.yaml b/test/oas_examples/v3.0/issue_13917.yaml new file mode 100644 index 0000000..9720250 --- /dev/null +++ b/test/oas_examples/v3.0/issue_13917.yaml @@ -0,0 +1,81 @@ +components: + schemas: + JSONPatchRequestAddReplaceTest: + additionalProperties: false + properties: + path: + description: A JSON Pointer path. + type: string + value: + description: The value to add, replace or test. + required: + - value + - op + - path + type: object + JSONPatchRequestMoveCopy: + additionalProperties: false + properties: + op: + description: The operation to perform. + enum: + - move + - copy + type: string + path: + description: A JSON Pointer path. + type: string + required: + - from + - op + - path + type: object + JSONPatchRequestRemove: + additionalProperties: false + properties: + op: + description: The operation to perform. + enum: + - remove + type: string + path: + description: A JSON Pointer path. + type: string + required: + - op + - path + type: object + PatchRequest: + items: + oneOf: + - $ref: '#/components/schemas/JSONPatchRequestAddReplaceTest' + - $ref: '#/components/schemas/JSONPatchRequestRemove' + - $ref: '#/components/schemas/JSONPatchRequestMoveCopy' + type: array +info: + description: xxx + title: x + version: 0.0.1 + x-audience: company-internal +openapi: 3.0.3 +paths: + /users/{id}: + patch: + description: Returns an organization + operationId: GetOrganization + parameters: + - in: path + name: id + required: true + schema: + format: uuid + type: string + style: simple + requestBody: + content: + application/json-patch+json: + schema: + $ref: '#/components/schemas/PatchRequest' + responses: + '200': + description: Successful response. diff --git a/test/oas_examples/v3.0/issue_14026_kotlin_backticks_reserved_words.yaml b/test/oas_examples/v3.0/issue_14026_kotlin_backticks_reserved_words.yaml new file mode 100644 index 0000000..3c81230 --- /dev/null +++ b/test/oas_examples/v3.0/issue_14026_kotlin_backticks_reserved_words.yaml @@ -0,0 +1,25 @@ +components: + schemas: + Annotation: + properties: + id: + format: uuid + type: string + type: object +info: + title: title + version: 0.0.1 +openapi: 3.0.7 +paths: + /annotations: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Annotation' + required: true + responses: + '200': + description: OK + summary: annotate diff --git a/test/oas_examples/v3.0/issue_14252.yaml b/test/oas_examples/v3.0/issue_14252.yaml new file mode 100644 index 0000000..843ecb4 --- /dev/null +++ b/test/oas_examples/v3.0/issue_14252.yaml @@ -0,0 +1,24 @@ +components: + schemas: + MyResponse: + properties: + myPropTypeNumber: + type: number +info: + description: test bigdecimal as String + title: test bigdecimal as String + version: 1.0.0 +openapi: 3.0.2 +paths: + /test: + get: + operationId: get + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MyResponse' + description: OK +servers: +- url: https://test.org diff --git a/test/oas_examples/v3.0/issue_14418.yaml b/test/oas_examples/v3.0/issue_14418.yaml new file mode 100644 index 0000000..e36c63e --- /dev/null +++ b/test/oas_examples/v3.0/issue_14418.yaml @@ -0,0 +1,23 @@ +info: + title: test + version: 1.0.0 +openapi: 3.0.1 +paths: + /test: + get: + operationId: test + parameters: + - description: Test header + example: 523028ac-2e0e-41ab-b6f7-38c1efdbac45 + in: header + name: testHeader + required: true + schema: + format: uuid + type: string + responses: + 200: + description: ok + summary: test + tags: + - test diff --git a/test/oas_examples/v3.0/issue_14907.yaml b/test/oas_examples/v3.0/issue_14907.yaml new file mode 100644 index 0000000..0438109 --- /dev/null +++ b/test/oas_examples/v3.0/issue_14907.yaml @@ -0,0 +1,50 @@ +components: + parameters: + x-client-ismobile: + description: 'blabla + + ' + in: header + name: x-client-ismobile + required: false + schema: + type: boolean + schemas: + ListResponseResponseAgreement: + properties: + list: + items: + $ref: '#/components/schemas/ResponseAgreement' + type: array + type: object + ResponseAgreement: + properties: + agreementId: + type: string + type: object +info: + description: '## TEST' + title: TEST + version: 1.0.0 +openapi: 3.0.1 +paths: + /agreements: + get: + operationId: readAgreements + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/ListResponseResponseAgreement' + description: OK + tags: + - consent-controller + parameters: + - $ref: '#/components/parameters/x-client-ismobile' +servers: +- description: Major version of service + url: /v3 +tags: +- description: Consent API + name: consent-controller diff --git a/test/oas_examples/v3.0/issue_14917.yaml b/test/oas_examples/v3.0/issue_14917.yaml new file mode 100644 index 0000000..dc85eaa --- /dev/null +++ b/test/oas_examples/v3.0/issue_14917.yaml @@ -0,0 +1,62 @@ +components: + schemas: + AllPets: + properties: + pets: + items: + $ref: '#/components/schemas/Pet' + type: array + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + name: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + bark: + type: string + type: object + Lizard: + allOf: + - $ref: '#/components/schemas/Pet' + - properties: + lovesRocks: + type: boolean + type: object + Pet: + discriminator: + mapping: + cat: '#/components/schemas/Cat' + dog: '#/components/schemas/Dog' + lizard: '#/components/schemas/Lizard' + propertyName: petType + properties: + petType: + type: string + required: + - petType + type: object +info: + description: test schema + title: test + version: 1.0.0 +openapi: 3.0.0 +paths: + /demo: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Success + summary: placeholder summary +servers: +- description: stage + url: http://test.com diff --git a/test/oas_examples/v3.0/issue_15265.yaml b/test/oas_examples/v3.0/issue_15265.yaml new file mode 100644 index 0000000..36ce043 --- /dev/null +++ b/test/oas_examples/v3.0/issue_15265.yaml @@ -0,0 +1,50 @@ +components: + schemas: + ResponseAgreement: + properties: + agreementId: + type: string + type: object +info: + description: '## TEST' + title: TEST + version: 1.0.0 +openapi: 3.0.1 +paths: + /paginated: + get: + operationId: paginated + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAgreement' + description: OK + tags: + - consent-controller + x-spring-paginated: true + /paginated-with-params: + get: + operationId: paginatedWithParams + parameters: + - in: query + name: param1 + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseAgreement' + description: OK + tags: + - consent-controller + x-spring-paginated: true +servers: +- description: Major version of service + url: /v3 +tags: +- description: Consent API + name: consent-controller diff --git a/test/oas_examples/v3.0/issue_15511.yaml b/test/oas_examples/v3.0/issue_15511.yaml new file mode 100644 index 0000000..9aa4db7 --- /dev/null +++ b/test/oas_examples/v3.0/issue_15511.yaml @@ -0,0 +1,149 @@ +components: + schemas: + AuthErrorDescription: + properties: + description: + type: string + type: object + AuthResponseError: + properties: + error: + enum: + - invalid_request + - invalid_client + - invalid_grant + - invalid_scope + - unauthorized_client + - unsupported_grant_type + type: string + x-enum-descriptions: + - Request is missing a parameter or contains an unsupported parameter of + repeats parameters. + - Client authentication fails due to an invalid client id or secret. + - Authorization code or password is invalid or expired. + - Invalid scope for the given access token. + - Client is not authorized for requested grant type. + - Given grant type is unsupported. + x-enum-varnames: + - INVALID_REQUEST + - INVALID_CLIENT + - INVALID_GRANT + - INVALID_SCOPE + - UNAUTHORIZED_CLIENT + - UNSUPPORTED_GRANT_TYPE + error_description: + type: string + errors: + items: + $ref: '#/components/schemas/AuthErrorDescription' + type: array + required: + - error_description + - error + type: object + LoginRequestModel: + properties: + client_id: + type: string + grant_type: + enum: + - refresh_token + - password + type: string + password: + type: string + scope: + type: string + username: + type: string + required: + - client_id + - grant_type + - password + - scope + - username + type: object + LoginResponseModel: + properties: + access_token: + type: string + expires_in: + format: int32 + type: integer + refresh_token: + type: string + token_type: + type: string + required: + - expires_in + - access_token + - refresh_token + type: object + TokenRefreshRequestModel: + properties: + grant_type: + enum: + - refresh_token + - password + type: string + refresh_token: + type: string + required: + - grant_type + - refresh_token + type: object + TokenRefreshResponseModel: + description: Be aware, that we may either receive a new refresh token in the + response or not. In case where we do not receive a new refresh token we must + use the refresh token from the old token for subsequent token refreshs. + properties: + access_token: + type: string + expires_in: + format: int32 + type: integer + refresh_token: + type: string + token_type: + type: string + required: + - expires_in + - access_token + type: object +info: + description: foobarbaz + title: Auth Server Client API + version: 1.0.0 +openapi: 3.0.3 +paths: + /as/token.oauth2: + post: + requestBody: + content: + application/x-www-form-urlencoded; charset=utf-8: + schema: + oneOf: + - $ref: '#/components/schemas/LoginRequestModel' + - $ref: '#/components/schemas/TokenRefreshRequestModel' + required: true + responses: + '200': + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/LoginResponseModel' + - $ref: '#/components/schemas/TokenRefreshResponseModel' + description: Successful operation + default: + content: + application/json: + schema: + $ref: '#/components/schemas/AuthResponseError' + description: An error occured + summary: Obtains a new token from Auth server + tags: + - auth +tags: +- description: Auth Server Client APIs for obtaining, refreshing and revoking a token + name: auth diff --git a/test/oas_examples/v3.0/issue_15796.yaml b/test/oas_examples/v3.0/issue_15796.yaml new file mode 100644 index 0000000..c349723 --- /dev/null +++ b/test/oas_examples/v3.0/issue_15796.yaml @@ -0,0 +1,98 @@ +components: + schemas: + Cat: + allOf: + - $ref: '#/components/schemas/Pet' + discriminator: + mapping: + MAINE_COON: '#/components/schemas/MaineCoon' + PERSIAN: '#/components/schemas/Persian' + propertyName: race + properties: + paws: + type: integer + race: + type: string + required: + - race + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Pet' + discriminator: + mapping: + LABRADOR: '#/components/schemas/Labrador' + POODLE: '#/components/schemas/Poodle' + propertyName: race + properties: + race: + type: string + tails: + type: integer + required: + - race + type: object + Labrador: + allOf: + - $ref: '#/components/schemas/Dog' + properties: + hairColor: + type: string + required: + - race + type: object + MaineCoon: + allOf: + - $ref: '#/components/schemas/Cat' + properties: + hairColor: + type: string + required: + - race + type: object + Persian: + allOf: + - $ref: '#/components/schemas/Cat' + properties: + hairType: + type: string + required: + - race + type: object + Pet: + discriminator: + mapping: + CAT: '#/components/schemas/Cat' + DOG: '#/components/schemas/Dog' + propertyName: type + properties: + name: + type: string + type: + type: string + required: + - type + type: object + Poodle: + allOf: + - $ref: '#/components/schemas/Dog' + properties: + hairType: + type: string + required: + - race + type: object +info: + description: My service + title: My service + version: 1.0.0 +openapi: 3.0.0 +paths: + /generator/test: + get: + responses: + 200: + description: Everything is fine + summary: Get test generator models +servers: +- url: https://localhost diff --git a/test/oas_examples/v3.0/issue_15923.yaml b/test/oas_examples/v3.0/issue_15923.yaml new file mode 100644 index 0000000..9c07f59 --- /dev/null +++ b/test/oas_examples/v3.0/issue_15923.yaml @@ -0,0 +1,45 @@ +components: + schemas: + TestEntity: + additionalProperties: false + properties: + name: + nullable: true + type: string + type: object +info: + description: Web API + title: Bug + version: v1 +openapi: 3.0.1 +paths: + /v1/MyRequest: + put: + operationId: test + requestBody: + content: + application/*+json: + schema: + $ref: '#/components/schemas/TestEntity' + application/json: + schema: + $ref: '#/components/schemas/TestEntity' + text/json: + schema: + $ref: '#/components/schemas/TestEntity' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TestEntity' + text/json: + schema: + $ref: '#/components/schemas/TestEntity' + text/plain: + schema: + $ref: '#/components/schemas/TestEntity' + description: Success + summary: Update the test + tags: + - MyRequest diff --git a/test/oas_examples/v3.0/issue_16496.yaml b/test/oas_examples/v3.0/issue_16496.yaml new file mode 100644 index 0000000..3487835 --- /dev/null +++ b/test/oas_examples/v3.0/issue_16496.yaml @@ -0,0 +1,54 @@ +components: + schemas: + Animal: + discriminator: + propertyName: type + properties: + age: + example: 15 + type: integer + alias: + description: The stripy one + example: Stripy + nullable: true + type: string + name: + example: Marty + type: string + type: + enum: + - zebra + type: string + type: object + Zebra: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + stripePattern: + enum: + - horizontal + - vertical + type: string + type: object +info: + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Zoo + version: 1.0.0 +openapi: 3.0.0 +paths: + /zebras: + get: + operationId: getZebras + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Zebra' + type: array + description: OK +servers: +- url: localhost:8080 diff --git a/test/oas_examples/v3.0/issue_16797.yaml b/test/oas_examples/v3.0/issue_16797.yaml new file mode 100644 index 0000000..687af0b --- /dev/null +++ b/test/oas_examples/v3.0/issue_16797.yaml @@ -0,0 +1,82 @@ +components: + schemas: + Object1: + discriminator: + propertyName: responseType + properties: + requestId: + type: string + responseType: + type: string + success: + default: true + type: boolean + required: + - responseType + - requestId + - success + type: object + Object2: + allOf: + - $ref: '#/components/schemas/Object1' + - type: object + Object3: + allOf: + - $ref: '#/components/schemas/Object2' + properties: + pageInfo: + $ref: '#/components/schemas/Type1' + required: + - pageInfo + Object4: + allOf: + - $ref: '#/components/schemas/Object3' + - properties: + data: + type: string + type: object + Type1: + properties: + pageSize: + format: int32 + minimum: 1 + type: integer + rowCount: + format: int32 + minimum: 0 + type: integer + required: + - pageSize + - rowCount + type: object +info: + title: OpenAPI definition + version: v0 +openapi: 3.0.1 +paths: + /user: + get: + operationId: getUserById + parameters: + - description: Unique Id of an User + in: query + name: id + schema: + default: 10 + type: integer + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Object4' + description: successful operation + summary: Get User By Id + tags: + - user +servers: +- url: / +- url: '{protocolAndBaseURL}' + variables: + protocolAndBaseURL: + default: https://localhost diff --git a/test/oas_examples/v3.0/issue_17150.yaml b/test/oas_examples/v3.0/issue_17150.yaml new file mode 100644 index 0000000..305c20a --- /dev/null +++ b/test/oas_examples/v3.0/issue_17150.yaml @@ -0,0 +1,158 @@ +components: + schemas: + Foo: + properties: + intMax: + items: + maximum: 10 + type: integer + type: array + intMaxNullable: + items: + maximum: 10 + type: integer + nullable: true + type: array + intMin: + items: + minimum: 1 + type: integer + type: array + intMinMax: + items: + maximum: 10 + minimum: 1 + type: integer + type: array + intMinMaxNullable: + items: + maximum: 10 + minimum: 1 + type: integer + nullable: true + type: array + intMinNullable: + items: + minimum: 1 + type: integer + nullable: true + type: array + numberMax: + items: + maximum: 10 + type: number + type: array + numberMaxNullable: + items: + maximum: 10 + type: number + nullable: true + type: array + numberMin: + items: + minimum: 1 + type: number + type: array + numberMinMax: + items: + maximum: 10 + minimum: 1 + type: number + type: array + numberMinMaxNullable: + items: + maximum: 10 + minimum: 1 + type: number + nullable: true + type: array + numberMinNullable: + items: + minimum: 1 + type: number + nullable: true + type: array + stringEmail: + items: + format: email + type: string + type: array + stringEmailNullable: + items: + format: email + type: string + nullable: true + type: array + stringMaxLength: + items: + maxLength: 1 + type: string + maxItems: 10 + type: array + uniqueItems: true + stringMaxLengthNullable: + items: + maxLength: 1 + type: string + maxItems: 10 + nullable: true + type: array + uniqueItems: true + stringMaxMinLength: + items: + maxLength: 10 + minLength: 1 + type: string + maxItems: 10 + type: array + uniqueItems: true + stringMaxMinLengthNullable: + items: + maxLength: 10 + minLength: 1 + type: string + maxItems: 10 + nullable: true + type: array + uniqueItems: true + stringMinLength: + items: + minLength: 1 + type: string + maxItems: 10 + type: array + stringMinLengthNullable: + items: + minLength: 1 + type: string + maxItems: 10 + nullable: true + type: array + stringPattern: + items: + pattern: '[a-z]' + type: string + type: array + uniqueItems: true + stringPatternNullable: + items: + pattern: '[a-z]' + type: string + nullable: true + type: array + uniqueItems: true + type: object +info: + title: Test Issue + version: v1 +openapi: 3.0.3 +paths: + /test: + get: + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/Foo' + description: default response diff --git a/test/oas_examples/v3.0/issue_17555.yaml b/test/oas_examples/v3.0/issue_17555.yaml new file mode 100644 index 0000000..9bf1d4f --- /dev/null +++ b/test/oas_examples/v3.0/issue_17555.yaml @@ -0,0 +1,51 @@ +components: + parameters: + departmentIdParam: + description: ID of the department to search + in: path + name: departmentId + required: true + schema: + type: string + teamQueryParam: + allowEmptyValue: true + description: Fetch teams query + in: query + name: filter + required: false + schema: + $ref: '#/components/schemas/TeamCriteriaDTO' + schemas: + TeamCriteriaDTO: + properties: + key: + type: string + name: + type: string + title: TeamCriteriaDTO + type: object +info: + description: My description + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /api/department/{departmentId}/teams: + get: + description: Find Department Teams + operationId: findDepartmentTeams + parameters: + - $ref: '#/components/parameters/departmentIdParam' + - $ref: '#/components/parameters/teamQueryParam' + responses: + '200': + description: OK + summary: Find Department Teams + tags: + - Department +tags: +- description: Everything about your Department + name: department diff --git a/test/oas_examples/v3.0/issue_241.yaml b/test/oas_examples/v3.0/issue_241.yaml new file mode 100644 index 0000000..7bcfcc3 --- /dev/null +++ b/test/oas_examples/v3.0/issue_241.yaml @@ -0,0 +1,47 @@ +components: + schemas: + User: + allOf: + - $ref: '#/components/schemas/UserDetail' + - description: The User + required: + - userid + - username + type: object + UserDetail: + description: Detail of a User + properties: + name: + description: the name of the user + type: string + type: object +info: + contact: + email: my@mail.com + description: test + title: myTest + version: 1.0.0 +openapi: 3.0.0 +paths: + /users/create/{username}: + post: + operationId: createUser + parameters: + - in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: The User just created + tags: + - user +servers: +- url: http://localhost:9998/v1 +tags: +- name: users diff --git a/test/oas_examples/v3.0/issue_2908.yaml b/test/oas_examples/v3.0/issue_2908.yaml new file mode 100644 index 0000000..b0f8d00 --- /dev/null +++ b/test/oas_examples/v3.0/issue_2908.yaml @@ -0,0 +1,19 @@ +info: + description: Cookie parameters for JAX-RS Spec generator + title: Issue 2908 - Cookie parameters + version: 0.0.1 +openapi: 3.0.1 +paths: + /something: + post: + operationId: withCookieParam + parameters: + - description: cookie param + in: cookie + name: myCookieParam + required: true + schema: + type: string + responses: + 200: + description: success diff --git a/test/oas_examples/v3.0/issue_4832.yaml b/test/oas_examples/v3.0/issue_4832.yaml new file mode 100644 index 0000000..a60dcae --- /dev/null +++ b/test/oas_examples/v3.0/issue_4832.yaml @@ -0,0 +1,32 @@ +info: + title: ping that return primitive types + version: '1.0' +openapi: 3.0.1 +paths: + /pingBoolean: + get: + operationId: pingGetBoolean + responses: + '200': + content: + application/json: + schema: + type: boolean + description: OK + tags: + - Ping + /pingInteger: + get: + operationId: pingGetInteger + responses: + '200': + content: + application/json: + schema: + format: int32 + type: integer + description: OK + tags: + - Ping +servers: +- url: http://localhost:8082/ diff --git a/test/oas_examples/v3.0/issue_4876_format_email.yaml b/test/oas_examples/v3.0/issue_4876_format_email.yaml new file mode 100644 index 0000000..54efee3 --- /dev/null +++ b/test/oas_examples/v3.0/issue_4876_format_email.yaml @@ -0,0 +1,29 @@ +components: + schemas: + personWithEmail: + properties: + email: + format: email + type: string + name: + maxLength: 255 + type: string +info: + license: + name: MIT + title: EmailExample + version: 1.0.0 +openapi: 3.0.1 +paths: + /person: + put: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/personWithEmail' + responses: + '204': + description: No Content +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/issue_4947.yaml b/test/oas_examples/v3.0/issue_4947.yaml new file mode 100644 index 0000000..cbaa961 --- /dev/null +++ b/test/oas_examples/v3.0/issue_4947.yaml @@ -0,0 +1,176 @@ +components: + schemas: + Foo: + properties: + intMax: + items: + maximum: 10 + type: integer + type: array + intMaxNullable: + items: + maximum: 10 + type: integer + nullable: true + type: array + intMin: + items: + minimum: 1 + type: integer + type: array + intMinMax: + items: + maximum: 10 + minimum: 1 + type: integer + type: array + intMinMaxNullable: + items: + maximum: 10 + minimum: 1 + type: integer + nullable: true + type: array + intMinNullable: + items: + minimum: 1 + type: integer + nullable: true + type: array + numberMax: + items: + maximum: 10 + type: number + type: array + numberMaxNullable: + items: + exclusiveMaximum: true + maximum: 10 + type: number + nullable: true + type: array + numberMin: + items: + minimum: 1 + type: number + type: array + numberMinMax: + items: + maximum: 10 + minimum: 1 + type: number + type: array + numberMinMaxNullable: + items: + maximum: 10 + minimum: 1 + type: number + nullable: true + type: array + numberMinNullable: + items: + minimum: 1 + type: number + nullable: true + type: array + stringEmail: + items: + format: email + type: string + type: array + stringEmailNullable: + items: + format: email + type: string + nullable: true + type: array + stringMaxLength: + items: + maxLength: 1 + type: string + maxItems: 10 + type: array + uniqueItems: true + stringMaxLengthNullable: + items: + maxLength: 1 + type: string + maxItems: 10 + nullable: true + type: array + uniqueItems: true + stringMaxMinLength: + items: + maxLength: 10 + minLength: 1 + type: string + maxItems: 10 + type: array + uniqueItems: true + stringMaxMinLengthNullable: + items: + maxLength: 10 + minLength: 1 + type: string + maxItems: 10 + nullable: true + type: array + uniqueItems: true + stringMinLength: + items: + minLength: 1 + type: string + maxItems: 10 + type: array + stringMinLengthNullable: + items: + minLength: 1 + type: string + maxItems: 10 + nullable: true + type: array + stringNumbers: + items: + format: number + maximum: 10 + minimum: 1 + type: string + maxItems: 10 + type: array + uniqueItems: true + stringPattern: + items: + pattern: '[a-z]' + type: string + type: array + uniqueItems: true + stringPatternNullable: + items: + pattern: ^\d{3}-\d{2}-\d{4}$ + type: string + nullable: true + type: array + uniqueItems: true + stringPatternWithMin: + items: + minLength: 10 + pattern: ^\d{3}-\d{2}-\d{4}$ + type: string + nullable: true + type: array + uniqueItems: true + type: object +info: + title: Test Issue + version: v1 +openapi: 3.0.3 +paths: + /test: + get: + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/Foo' + description: default response diff --git a/test/oas_examples/v3.0/issue_5026-b.yaml b/test/oas_examples/v3.0/issue_5026-b.yaml new file mode 100644 index 0000000..dc2d5d4 --- /dev/null +++ b/test/oas_examples/v3.0/issue_5026-b.yaml @@ -0,0 +1,34 @@ +components: + schemas: + Dummy: + properties: + status: + type: string + required: + - status + type: object +info: + title: reactive-spring-boot-request-body-issue + version: 1.0.0 +openapi: 3.0.0 +paths: + /some/dummy/endpoint: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Dummy' + description: request + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Dummy' + description: Successfully created reverse listings for retail + tags: + - ReactiveSpringBootRequestBodyIssue +tags: +- name: ReactiveSpringBootRequestBodyIssue diff --git a/test/oas_examples/v3.0/issue_5026.yaml b/test/oas_examples/v3.0/issue_5026.yaml new file mode 100644 index 0000000..08aecc2 --- /dev/null +++ b/test/oas_examples/v3.0/issue_5026.yaml @@ -0,0 +1,35 @@ +components: + schemas: + Dummy: + properties: + status: + readOnly: true + type: string + required: + - status + type: object +info: + title: reactive-spring-boot-request-body-issue + version: 1.0.0 +openapi: 3.0.0 +paths: + /some/dummy/endpoint: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Dummy' + description: request + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Dummy' + description: Successfully created reverse listings for retail + tags: + - ReactiveSpringBootRequestBodyIssue +tags: +- name: ReactiveSpringBootRequestBodyIssue diff --git a/test/oas_examples/v3.0/issue_5381.yaml b/test/oas_examples/v3.0/issue_5381.yaml new file mode 100644 index 0000000..af31321 --- /dev/null +++ b/test/oas_examples/v3.0/issue_5381.yaml @@ -0,0 +1,127 @@ +components: + requestBodies: + Foo: + content: + application/json;charset=utf-8: + schema: + $ref: '#/components/schemas/Foo' + description: The Foo to be created + responses: + 200FooArray: + content: + application/json;charset=utf-8: + schema: + items: + $ref: '#/components/schemas/FooRefOrValue' + type: array + description: Success + 201Foo: + content: + application/json: + schema: + $ref: '#/components/schemas/FooRefOrValue' + description: Error + '204': + content: {} + description: Deleted + schemas: + Addressable: + description: Base schema for addressable entities + properties: + href: + description: Hyperlink reference + type: string + id: + description: unique identifier + type: string + type: object + Entity: + allOf: + - $ref: '#/components/schemas/Addressable' + - $ref: '#/components/schemas/Extensible' + type: object + EntityRef: + allOf: + - $ref: '#/components/schemas/Addressable' + - $ref: '#/components/schemas/Extensible' + description: Entity reference schema to be use for all entityRef class. + properties: + '@referredType': + description: The actual type of the target instance when needed for disambiguation. + type: string + name: + description: Name of the related entity. + type: string + type: object + Extensible: + properties: + '@baseType': + description: When sub-classing, this defines the super-class + type: string + '@schemaLocation': + description: A URI to a JSON-Schema file that defines additional attributes + and relationships + type: string + '@type': + description: When sub-classing, this defines the sub-class Extensible name + type: string + required: + - '@type' + type: object + Foo: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + fooPropA: + type: string + fooPropB: + type: string + type: object + FooRef: + allOf: + - $ref: '#/components/schemas/EntityRef' + properties: + foorefPropA: + type: string + type: object + FooRefOrValue: + discriminator: + mapping: + Foo: '#/components/schemas/Foo' + FooRef: '#/components/schemas/FooRef' + propertyName: '@type' + oneOf: + - $ref: '#/components/schemas/Foo' + - $ref: '#/components/schemas/FooRef' + type: object +info: + description: 'This tests for a oneOf interface representation + + ' + title: ByRefOrValue + version: 0.0.1 +openapi: 3.0.1 +paths: + /foo: + get: + operationId: getAllFoos + responses: + '200': + $ref: '#/components/responses/200FooArray' + summary: GET all Foos + tags: + - Foo + post: + operationId: createFoo + requestBody: + $ref: '#/components/requestBodies/Foo' + responses: + '201': + $ref: '#/components/responses/201Foo' + summary: Create a Foo + tags: + - Foo +servers: +- url: http://localhost:8080 +tags: +- name: Foo diff --git a/test/oas_examples/v3.0/issue_6096.yaml b/test/oas_examples/v3.0/issue_6096.yaml new file mode 100644 index 0000000..aa6ceb0 --- /dev/null +++ b/test/oas_examples/v3.0/issue_6096.yaml @@ -0,0 +1,143 @@ +components: + schemas: + Object: + additionalProperties: false + properties: + ArrayOfStrings: + items: + example: string + type: string + type: array + BinaryFormat: + format: binary + type: string + Boolean: + example: true + type: boolean + ByteFormat: + example: QG1pY2hhZWxncmFoYW1ldmFucw== + format: byte + type: string + CharFormat: + format: char + type: string + DateFormat: + example: '2021-06-10' + format: date + type: string + DateTimeFormat: + example: '2021-06-10T12:47:27' + format: date-time + type: string + DecimalFormat: + example: '3.14159' + format: decimal + type: string + DoubleFormat: + example: '3.14159' + format: double + type: string + EmailFormat: + example: user@example.com + format: email + type: string + FloatFormat: + example: '3.14159' + format: float + type: string + HostnameFormat: + example: example.com + format: hostname + type: string + InlinedObject: + additionalProperties: false + properties: + String: + example: A string + type: string + type: object + Int32Format: + example: '123' + format: int32 + type: string + Int64Format: + example: '123' + format: int64 + type: string + IntFormat: + example: '123' + format: int + type: string + Integer: + example: 123 + type: integer + IntegerFormat: + example: '123' + format: integer + type: string + Ipv4Format: + example: 127.0.0.1 + format: ipv4 + type: string + Ipv6Format: + example: ::1 + format: ipv4 + type: string + LongFormat: + example: '123' + format: long + type: string + Map: + additionalProperties: true + type: object + Number: + example: 3.14159 + type: number + PasswordFormat: + example: hunter2 + format: password + type: string + ReferencedObject: + $ref: '#/components/schemas/ReferencedObject' + ShortFormat: + example: '123' + format: short + type: string + String: + example: A string + type: string + StringObject: + $ref: '#/components/schemas/String' + UriFormat: + example: https://example.com + format: uri + type: string + UuidFormat: + example: 7db1c07f-8f63-41ff-8f94-056b4a9ce96d + format: uuid + type: string + type: object + ReferencedObject: + additionalProperties: false + properties: + String: + example: A string + type: string + type: object + String: + additionalProperties: false + properties: + String: + example: A string + type: string + type: object +info: + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Example + version: 1.0.0 +openapi: 3.0.0 +paths: {} +servers: +- url: localhost:8080 diff --git a/test/oas_examples/v3.0/issue_7118.yaml b/test/oas_examples/v3.0/issue_7118.yaml new file mode 100644 index 0000000..43291d2 --- /dev/null +++ b/test/oas_examples/v3.0/issue_7118.yaml @@ -0,0 +1,37 @@ +info: + description: sample to get all user id as string list and string set + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /users/id?type=list: + get: + operationId: getUserIdList + responses: + '200': + content: + application/json: + schema: + items: + type: string + type: array + uniqueItems: false + description: response + tags: + - users + /users/id?type=set: + get: + operationId: getUserIdSet + responses: + '200': + content: + application/json: + schema: + items: + type: string + type: array + uniqueItems: true + description: response + tags: + - users +tags: [] diff --git a/test/oas_examples/v3.0/issue_7193.yaml b/test/oas_examples/v3.0/issue_7193.yaml new file mode 100644 index 0000000..6f115b9 --- /dev/null +++ b/test/oas_examples/v3.0/issue_7193.yaml @@ -0,0 +1,45 @@ +components: + securitySchemes: + oauth_auth: + flows: + clientCredentials: + scopes: + import:create: create import + import:process: process import + tokenUrl: ../auth/realms/master/protocol/openid-connect/token + password: + scopes: + import:create: create import + tokenUrl: ../auth/realms/master/protocol/openid-connect/token + type: oauth2 +info: + title: test api + version: 0.0.1 +openapi: 3.0.0 +paths: + /imports: + post: + operationId: createImport + responses: + 201: + description: created + security: + - oauth_auth: + - import:create + summary: Creates import + /imports/{importId}/state: + put: + operationId: changeImportState + parameters: + - in: path + name: importId + required: true + schema: + type: string + responses: + 200: + description: State changed + security: + - oauth_auth: + - import:process + summary: Changes import state diff --git a/test/oas_examples/v3.0/issue_7199_array_simple_string.yaml b/test/oas_examples/v3.0/issue_7199_array_simple_string.yaml new file mode 100644 index 0000000..4bbb39c --- /dev/null +++ b/test/oas_examples/v3.0/issue_7199_array_simple_string.yaml @@ -0,0 +1,19 @@ +info: + title: Demo + version: 1.0.0 +openapi: 3.0.0 +paths: + /{ids}: + get: + parameters: + - in: path + name: ids + required: true + schema: + items: + type: string + type: array + style: simple + responses: + 200: + description: Successful operation diff --git a/test/oas_examples/v3.0/issue_7361.yaml b/test/oas_examples/v3.0/issue_7361.yaml new file mode 100644 index 0000000..1c3bfb3 --- /dev/null +++ b/test/oas_examples/v3.0/issue_7361.yaml @@ -0,0 +1,24 @@ +components: + schemas: + FreeForm: + description: this will not be generated because a map will be used when other + components or endpoints ref this schema + type: object + FreeFormInterface: + type: object + FreeFormWithValidation: + minProperties: 1 + type: object + SomeObject: + allOf: + - $ref: '#/components/schemas/FreeFormInterface' +info: + description: a spec to test free form object models + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: {} +tags: [] diff --git a/test/oas_examples/v3.0/issue_7372.yaml b/test/oas_examples/v3.0/issue_7372.yaml new file mode 100644 index 0000000..0d7bad2 --- /dev/null +++ b/test/oas_examples/v3.0/issue_7372.yaml @@ -0,0 +1,15 @@ +components: + schemas: + A: + additionalProperties: + $ref: '#/components/schemas/B' + type: object + B: + items: + type: object + type: array +info: + title: foo + version: 1.0.0 +openapi: 3.0.0 +paths: {} diff --git a/test/oas_examples/v3.0/issue_7532.yaml b/test/oas_examples/v3.0/issue_7532.yaml new file mode 100644 index 0000000..6a76883 --- /dev/null +++ b/test/oas_examples/v3.0/issue_7532.yaml @@ -0,0 +1,59 @@ +components: + schemas: + Forest: + properties: + trees: + $ref: '#/components/schemas/Tree' + type: object + Tree: + properties: + additional: + additionalProperties: + $ref: '#/components/schemas/Tree' + type: object + children: + items: + $ref: '#/components/schemas/Tree' + type: array + description: + type: string + forest: + $ref: '#/components/schemas/Forest' + id: + type: integer + name: + type: string + parent: + $ref: '#/components/schemas/Tree' + required: + - id + - name + - children + type: object +info: + title: Test swagger file + version: 1.0.0 +openapi: 3.0.0 +paths: + /tree: + post: + description: Create + operationId: createTree + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Tree' + description: The tree to create + required: true + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/Tree' + description: Successfully created the tree + '400': + description: Bad request + tags: + - Test diff --git a/test/oas_examples/v3.0/issue_7533.yaml b/test/oas_examples/v3.0/issue_7533.yaml new file mode 100644 index 0000000..53c687d --- /dev/null +++ b/test/oas_examples/v3.0/issue_7533.yaml @@ -0,0 +1,17 @@ +components: + schemas: {} + securitySchemes: {} +info: + description: sample spec + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: {} +servers: +- url: / +- url: http://trailingshlash.io:80/v1/ +- url: http://notrailingslash.io:80/v2 +tags: [] diff --git a/test/oas_examples/v3.0/issue_7614.yaml b/test/oas_examples/v3.0/issue_7614.yaml new file mode 100644 index 0000000..1505230 --- /dev/null +++ b/test/oas_examples/v3.0/issue_7614.yaml @@ -0,0 +1,62 @@ +components: + securitySchemes: + basic_auth: + scheme: basic + type: http + oauth_auth: + flows: + clientCredentials: + scopes: + something:create: create from client credentials flow + something:process: process from client credentials flow + tokenUrl: ../auth/realms/master/protocol/openid-connect/token + password: + scopes: + something:create: create from password flow + tokenUrl: ../auth/realms/master/protocol/openid-connect/token + type: oauth2 +info: + title: test api + version: 0.0.1 +openapi: 3.0.0 +paths: + /examples/basicauthwithoauth: + get: + operationId: getWithBasicAuthAndOauth + responses: + 200: + description: some result + security: + - basic_auth: [] + - oauth_auth: + - something:create + summary: get with basic auth and oauth + tags: + - examples + /examples/onlybasicauth: + get: + operationId: getWithBasicAuth + responses: + 200: + description: some result + security: + - basic_auth: [] + summary: Get with basic auth + tags: + - examples + /examples/onlyoauthauth: + get: + operationId: getWithOauthAuth + responses: + 200: + description: some result + security: + - oauth_auth: + - something:create + - something:process + summary: get with oauth + tags: + - examples +tags: +- description: examples tag + name: examples diff --git a/test/oas_examples/v3.0/issue_7791.yaml b/test/oas_examples/v3.0/issue_7791.yaml new file mode 100644 index 0000000..7360d80 --- /dev/null +++ b/test/oas_examples/v3.0/issue_7791.yaml @@ -0,0 +1,29 @@ +info: + description: Google custom methods syntax + title: Custom methods + version: 0.0.1 +openapi: 3.0.1 +paths: + /events/{event_id}:undelete: + post: + operationId: undeleteOperation + parameters: + - description: Event Id + in: path + name: event_id + required: true + schema: + type: number + requestBody: + content: + multipart/form-data: + schema: + properties: + some_file: + description: another file to upload + format: binary + type: string + type: object + responses: + 200: + description: success diff --git a/test/oas_examples/v3.0/issue_8045.yaml b/test/oas_examples/v3.0/issue_8045.yaml new file mode 100644 index 0000000..8e3a821 --- /dev/null +++ b/test/oas_examples/v3.0/issue_8045.yaml @@ -0,0 +1,45 @@ +components: + schemas: + DummyRequest: + properties: + product_id: + type: string + required: + - product_id + type: object + DummyResponse: + properties: + status: + type: string + required: + - status + type: object +info: + title: reactive-spring-boot-request-body-issue + version: 1.0.0 +openapi: 3.0.0 +paths: + /some/dummy/endpoint: + post: + requestBody: + content: + application/json: + schema: + additionalProperties: + $ref: '#/components/schemas/DummyRequest' + type: object + description: request + required: true + responses: + 200: + content: + application/json: + schema: + additionalProperties: + $ref: '#/components/schemas/DummyResponse' + type: object + description: Successfully created reverse listings for retail + tags: + - ReactiveSpringBootRequestBodyIssue +tags: +- name: ReactiveSpringBootRequestBodyIssue diff --git a/test/oas_examples/v3.0/issue_8052_recursive_model.yaml b/test/oas_examples/v3.0/issue_8052_recursive_model.yaml new file mode 100644 index 0000000..4289bce --- /dev/null +++ b/test/oas_examples/v3.0/issue_8052_recursive_model.yaml @@ -0,0 +1,85 @@ +components: + schemas: + GeoJsonGeometry: + description: GeoJSON geometry + externalDocs: + url: http://geojson.org/geojson-spec.html#geometry-objects + properties: + geometries: + items: + $ref: '#/components/schemas/GeoJsonGeometry' + type: array + type: + enum: + - GeometryCollection + type: string + title: GeoJsonGeometry + type: object + GeometryCollection: + description: GeoJSon geometry collection + externalDocs: + url: http://geojson.org/geojson-spec.html#geometrycollection + properties: + geometries: + items: + $ref: '#/components/schemas/GeoJsonGeometry' + type: array + type: + default: GeometryCollection + type: string + required: + - type + - geometries + title: GeometryCollection + type: object + Point: + description: GeoJSON geometry + externalDocs: + url: http://geojson.org/geojson-spec.html#id2 + properties: + coordinates: + description: Point in 3D space + externalDocs: + url: http://geojson.org/geojson-spec.html#id2 + items: + format: double + type: number + maxItems: 3 + minItems: 2 + title: Point3D + type: array + type: + default: Point + type: string + required: + - type + title: Point + type: object +info: + termsOfService: http://api.apitest.com/party/tos/ + title: APITest API documentation. + version: 01.01.00 +openapi: 3.0.0 +paths: + /geojson: + post: + operationId: post-geojson + parameters: [] + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/GeoJsonGeometry' + responses: + '201': + content: + application/json: + schema: + description: GeoJson ID + type: string + description: Created + '400': + description: Bad Request + summary: Add a GeoJson Object +servers: +- url: https://api.apitest.com/v1 diff --git a/test/oas_examples/v3.0/issue_8535.yaml b/test/oas_examples/v3.0/issue_8535.yaml new file mode 100644 index 0000000..c09ba33 --- /dev/null +++ b/test/oas_examples/v3.0/issue_8535.yaml @@ -0,0 +1,123 @@ +components: + schemas: + TestResponse: + properties: + booleanField: + default: true + type: boolean + id: + type: integer + numberField: + default: 11 + type: number + stringField: + default: asd + type: string + required: + - id + - stringField + - numberField + - booleanField + type: object +info: + description: desc + title: toto + version: 1.0.0 +openapi: 3.0.1 +paths: + /test-headers: + get: + description: desc + operationId: headersTest + parameters: + - in: header + name: headerNumber + schema: + default: 11.2 + type: number + - in: header + name: headerString + schema: + default: qwerty + type: string + - in: header + name: headerStringWrapped + schema: + default: qwerty + type: string + - in: header + name: headerStringQuotes + schema: + default: qwerty"with quotes" test + type: string + - in: header + name: headerStringQuotesWrapped + schema: + default: qwerty"with quotes" test + type: string + - in: header + name: headerBoolean + schema: + default: true + type: boolean + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/TestResponse' + description: default response + summary: test headers + tags: + - verify-default-value + /test-query-params: + get: + description: desc + operationId: queryParamsTest + parameters: + - in: query + name: queryNumber + schema: + default: 11.2 + type: number + - in: query + name: queryString + schema: + default: qwerty + type: string + - in: query + name: queryStringWrapped + schema: + default: qwerty + type: string + - in: query + name: queryStringQuotes + schema: + default: qwerty"with quotes" test + type: string + - in: query + name: queryStringQuotesWrapped + schema: + default: qwerty"with quotes" test + type: string + - in: query + name: queryBoolean + schema: + default: true + type: boolean + responses: + default: + content: + application/json: + schema: + $ref: '#/components/schemas/TestResponse' + description: default response + summary: test query params + tags: + - verify-default-value +servers: +- description: / + url: / +tags: +- description: verify-default-value + name: verify-default-value diff --git a/test/oas_examples/v3.0/issue_9086_expected.yaml b/test/oas_examples/v3.0/issue_9086_expected.yaml new file mode 100644 index 0000000..88be98d --- /dev/null +++ b/test/oas_examples/v3.0/issue_9086_expected.yaml @@ -0,0 +1,46 @@ +components: + schemas: + _foo_bar_post_200_response: + additionalProperties: false + example: + n: 1.23 + properties: + n: + example: 1.23 + type: number + type: object + bar2: + additionalProperties: false + example: + n: 4.56 + properties: + n: + example: 4.56 + type: number + type: object +info: + title: Buggy Api + version: '1.0' +openapi: 3.0.1 +paths: + /foo/bar: + post: + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/_foo_bar_post_200_response' + description: ok + /foo/bar2: + post: + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/bar2' + description: ok +servers: +- url: / +x-original-swagger-version: '2.0' diff --git a/test/oas_examples/v3.0/issue_9447.yaml b/test/oas_examples/v3.0/issue_9447.yaml new file mode 100644 index 0000000..5091365 --- /dev/null +++ b/test/oas_examples/v3.0/issue_9447.yaml @@ -0,0 +1,106 @@ +components: + schemas: + Int32: + format: int32 + type: integer + Int64: + format: int64 + type: integer + ObjectModelWithIntegerProps: + properties: + Int32: + format: int32 + type: integer + Int64: + format: int64 + type: integer + UnboundedInteger: + type: integer + type: object + UnboundedInteger: + type: integer + securitySchemes: {} +info: + description: sample to vet integer handling + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /Int32: + post: + operationId: Int32 + parameters: + - in: path + name: Int32 + required: true + schema: + format: int32 + type: integer + requestBody: + content: + application/json: + schema: + format: int32 + type: integer + required: true + responses: + 200: + content: + application/json: + schema: + format: int32 + type: integer + description: success + /Int64: + post: + operationId: Int64 + parameters: + - in: path + name: Int64 + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/json: + schema: + format: int64 + type: integer + required: true + responses: + 200: + content: + application/json: + schema: + format: int64 + type: integer + description: success + /UnboundedInteger: + post: + operationId: UnboundedInteger + parameters: + - in: path + name: UnboundedInteger + required: true + schema: + type: integer + requestBody: + content: + application/json: + schema: + type: integer + required: true + responses: + 200: + content: + application/json: + schema: + type: integer + description: success +servers: +- url: http://petstore.swagger.io:80/v2 +tags: [] diff --git a/test/oas_examples/v3.0/issue_9719.yaml b/test/oas_examples/v3.0/issue_9719.yaml new file mode 100644 index 0000000..0aa39fa --- /dev/null +++ b/test/oas_examples/v3.0/issue_9719.yaml @@ -0,0 +1,48 @@ +info: + description: sample to vet integer handling + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /dotDelimiter: + get: + operationId: petstore.api.users.get_all + responses: + '200': + content: + application/json: + schema: + type: string + description: A paged array of users + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + summary: List all users + tags: + - users + /underscoreDelimiter: + get: + operationId: petstore_api_users_getAll + responses: + '200': + content: + application/json: + schema: + type: string + description: A paged array of users + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + summary: List all users + tags: + - users +servers: +- url: http://petstore.swagger.io:80/v2 +tags: [] diff --git a/test/oas_examples/v3.0/issue_9848.yaml b/test/oas_examples/v3.0/issue_9848.yaml new file mode 100644 index 0000000..1612d5c --- /dev/null +++ b/test/oas_examples/v3.0/issue_9848.yaml @@ -0,0 +1,50 @@ +components: + schemas: + nonUniqueArray: + properties: + array: + items: + type: string + type: array + uniqueItems: false + type: object + uniqueArray: + properties: + array: + items: + type: string + type: array + uniqueItems: true + type: object +info: + description: sample spec + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /nonUniqueTypes: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/nonUniqueArray' + description: non-unique array + /uniqueTypes: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/uniqueArray' + description: unique array +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: an api that ensures that isX properties are present on Schema classes + name: isX diff --git a/test/oas_examples/v3.0/issue______kotlinArrayEnumEmbedded.yaml b/test/oas_examples/v3.0/issue______kotlinArrayEnumEmbedded.yaml new file mode 100644 index 0000000..6763d79 --- /dev/null +++ b/test/oas_examples/v3.0/issue______kotlinArrayEnumEmbedded.yaml @@ -0,0 +1,89 @@ +components: + schemas: + Colors: + enum: + - BLACK + - RED + - ORANGE + - YELLOW + - BLUE + - GREEN + type: string + EmbeddedEnumArray: + properties: + colors: + items: + enum: + - BLACK + - RED + - ORANGE + - YELLOW + - BLUE + - GREEN + type: string + type: array + reqColors: + items: + enum: + - BLACK + - RED + - ORANGE + - YELLOW + - BLUE + - GREEN + type: string + type: array + required: + - reqColors + type: object + NoEmbeddedEnumArray: + properties: + colors: + items: + $ref: '#/components/schemas/Colors' + type: array + reqColors: + items: + $ref: '#/components/schemas/Colors' + required: + - reqColors + type: array + type: object + SimpleColorContainer: + properties: + color: + enum: + - BLACK + - RED + - ORANGE + - YELLOW + - BLUE + - GREEN + type: string + reqColor: + enum: + - BLACK + - RED + - ORANGE + - YELLOW + - BLUE + - GREEN + type: string + required: + - reqColor + type: object +info: + title: test + version: '1.0' +openapi: 3.0.1 +paths: + /test: + get: + operationId: test + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/EmbeddedEnumArray' + description: OK diff --git a/test/oas_examples/v3.0/issue_constructor-required-values-with-multiple-inheritance.yaml b/test/oas_examples/v3.0/issue_constructor-required-values-with-multiple-inheritance.yaml new file mode 100644 index 0000000..bd70fcc --- /dev/null +++ b/test/oas_examples/v3.0/issue_constructor-required-values-with-multiple-inheritance.yaml @@ -0,0 +1,83 @@ +components: + schemas: + BaseType: + discriminator: + mapping: + SubType: '#/components/schemas/SubType' + propertyName: type + properties: + freeTextField: + default: [] + items: + maxLength: 255 + type: string + maxItems: 6 + minItems: 0 + type: array + id: + format: uuid + type: string + schemaVersion: + $ref: '#/components/schemas/SchemaVersion' + required: + - schemaVersion + - id + type: object + IntermediateSubType: + allOf: + - $ref: '#/components/schemas/IntermediateType' + - properties: + someBoolean: + default: false + type: boolean + someEnum: + $ref: '#/components/schemas/SomeEnum' + required: + - someBoolean + - someEnum + type: object + IntermediateType: + allOf: + - $ref: '#/components/schemas/BaseType' + - properties: + OneBoolean: + default: false + type: boolean + OneOptionalBoolean: + default: false + type: boolean + required: + - OneBoolean + type: object + SchemaVersion: + default: 1.0.0 + enum: + - 1.0.0 + type: string + x-enum-varnames: + - CURRENT + SomeEnum: + enum: + - LIT1 + - LIT2 + type: string + x-enum-varnames: + - Literal1 + - Literal2 + SubType: + allOf: + - $ref: '#/components/schemas/IntermediateSubType' + - properties: + type: + default: SubType + enum: + - SubType + type: string + required: + - type + type: object +info: + title: Wrong Constructor + version: 0.0.0 +openapi: 3.0.2 +paths: {} diff --git a/test/oas_examples/v3.0/issues_13069.yaml b/test/oas_examples/v3.0/issues_13069.yaml new file mode 100644 index 0000000..34e3826 --- /dev/null +++ b/test/oas_examples/v3.0/issues_13069.yaml @@ -0,0 +1,21 @@ +components: + schemas: + UUID: + format: uuid + pattern: '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}' + type: string +info: + title: Test + version: 1.0.0-SNAPSHOT +openapi: 3.0.3 +paths: + /test: + get: + parameters: + - in: query + name: uuid + schema: + $ref: '#/components/schemas/UUID' + responses: + '200': + description: OK diff --git a/test/oas_examples/v3.0/jaxrs__petstore.yaml b/test/oas_examples/v3.0/jaxrs__petstore.yaml new file mode 100644 index 0000000..26287c4 --- /dev/null +++ b/test/oas_examples/v3.0/jaxrs__petstore.yaml @@ -0,0 +1,751 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /test/upload: + post: + description: upload test + operationId: testUpload + requestBody: + content: + application/octet-stream: + schema: + format: binary + type: string + required: false + responses: + default: + description: whatever + summary: test upload + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/jmeter__petstore.yaml b/test/oas_examples/v3.0/jmeter__petstore.yaml new file mode 100644 index 0000000..04e2388 --- /dev/null +++ b/test/oas_examples/v3.0/jmeter__petstore.yaml @@ -0,0 +1,746 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/operation_id_dollar_sign: + get: + description: operationId dollar sign + operationId: operationId$DollarSign + responses: + '400': + description: Invalid username supplied + summary: operationId dollar sign + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/jsoncodable.yaml b/test/oas_examples/v3.0/jsoncodable.yaml new file mode 100644 index 0000000..49107ab --- /dev/null +++ b/test/oas_examples/v3.0/jsoncodable.yaml @@ -0,0 +1,44 @@ +components: + schemas: + Request: + properties: + user1: + $ref: '#/components/schemas/User' + title: Request + type: object + User: + description: '' + properties: + integerValue: + type: integer + title: User + type: object + x-examples: {} +info: + title: test + version: '1.0' +openapi: 3.0.0 +paths: + /postModel: + parameters: [] + post: + description: Create a new user. + operationId: post-user + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/Request' + responses: + '200': + content: + application/json: + examples: {} + schema: + $ref: '#/components/schemas/User' + description: User Created + '400': + description: Missing Required Information + summary: Create New User +servers: +- url: http://localhost:3000 diff --git a/test/oas_examples/v3.0/kotlin__petstore.yaml b/test/oas_examples/v3.0/kotlin__petstore.yaml new file mode 100644 index 0000000..c8d3eff --- /dev/null +++ b/test/oas_examples/v3.0/kotlin__petstore.yaml @@ -0,0 +1,757 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + Annotation: + properties: + id: + format: uuid + type: string + type: object + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/annotations: + post: + operationId: annotations + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Annotation' + required: true + responses: + '200': + description: OK + summary: annotate + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/mapSchemas.yaml b/test/oas_examples/v3.0/mapSchemas.yaml new file mode 100644 index 0000000..40732ba --- /dev/null +++ b/test/oas_examples/v3.0/mapSchemas.yaml @@ -0,0 +1,70 @@ +components: + schemas: + ComplexModel: + example: + id: 1 + name: Puma + properties: + id: + format: int64 + type: integer + name: + type: string + required: + - name + type: object + ExampleModel: + properties: + id: + type: string + withAdditionalProperties: + $ref: '#/components/schemas/ModelWithAdditionalProperties' + type: object + FreeformObjectTypes: + properties: + ComplexModel: + $ref: '#/components/schemas/ComplexModel' + ExampleModel: + $ref: '#/components/schemas/ExampleModel' + ModelWithAdditionalProperties: + $ref: '#/components/schemas/ModelWithAdditionalProperties' + ModelWithStringToModelMapping: + $ref: '#/components/schemas/ModelWithStringToModelMapping' + ModelWithStringToStringMapping: + $ref: '#/components/schemas/ModelWithStringToStringMapping' + type: object + ModelWithAdditionalProperties: + additionalProperties: {} + properties: + id: + type: string + type: object + ModelWithStringToModelMapping: + additionalProperties: + $ref: '#/components/schemas/ComplexModel' + type: object + ModelWithStringToStringMapping: + additionalProperties: + type: string + type: object +info: + title: Example API + version: 3.0.0 +openapi: 3.0.0 +paths: + /: + get: + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/FreeformObjectTypes' + type: array + description: Good Request. + '400': + description: Bad Request. + '403': + description: Forbidden. Access denied. + summary: Empty Route diff --git a/test/oas_examples/v3.0/multipart-v3.yaml b/test/oas_examples/v3.0/multipart-v3.yaml new file mode 100644 index 0000000..b28b80a --- /dev/null +++ b/test/oas_examples/v3.0/multipart-v3.yaml @@ -0,0 +1,114 @@ +components: + schemas: + multipart_related_request: + properties: + object_field: + properties: + field_a: + type: string + field_b: + items: + type: string + type: array + required: + - field_a + type: object + optional_binary_field: + format: binary + type: string + required_binary_field: + format: binary + type: string + required: + - required_binary_field + type: object + multipart_request: + properties: + binary_field: + format: byte + type: string + object_field: + properties: + field_a: + type: string + field_b: + items: + type: string + type: array + required: + - field_a + type: object + optional_string_field: + type: string + string_field: + type: string + required: + - string_field + - binary_field + type: object +info: + description: API under test + title: Multipart OpenAPI V3 Rust Server Test + version: 1.0.7 +openapi: 3.0.1 +paths: + /multipart_related_request: + post: + requestBody: + content: + multipart/related: + encoding: + object_field: + contentType: application/json + optional_binary_field: + contentType: application/zip + headers: + Content-Id: + schema: + type: string + required_binary_field: + contentType: image/png + headers: + Content-Id: + schema: + type: string + schema: + $ref: '#/components/schemas/multipart_related_request' + required: true + responses: + '201': + description: OK + /multipart_request: + post: + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/multipart_request' + required: true + responses: + '201': + description: OK + /multiple-identical-mime-types: + post: + requestBody: + content: + multipart/related: + encoding: + binary1: + contentType: application/octet-stream + binary2: + contentType: application/octet-stream + schema: + properties: + binary1: + format: binary + type: string + binary2: + format: binary + type: string + type: object + required: true + responses: + 200: + description: OK diff --git a/test/oas_examples/v3.0/name-parameter-mappings.yaml b/test/oas_examples/v3.0/name-parameter-mappings.yaml new file mode 100644 index 0000000..f34485a --- /dev/null +++ b/test/oas_examples/v3.0/name-parameter-mappings.yaml @@ -0,0 +1,64 @@ +components: + schemas: + Environment: + properties: + dummy: + type: string + PropertyNameMapping: + properties: + _type: + type: string + http_debug_operation: + type: string + type: + type: string + type_: + type: string +info: + description: To test name, parameter mapping options + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Dummy + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + in: header + name: _type + required: true + schema: + format: int64 + type: integer + - description: type + in: query + name: type + required: true + schema: + type: string + - description: type_ + in: header + name: type_ + required: true + schema: + type: string + - description: http debug option (to test parameter naming option) + in: query + name: http_debug_option + required: true + schema: + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Environment' + description: OK + summary: parameter name mapping test + tags: + - fake diff --git a/test/oas_examples/v3.0/nested_anyof.yaml b/test/oas_examples/v3.0/nested_anyof.yaml new file mode 100644 index 0000000..8eed96c --- /dev/null +++ b/test/oas_examples/v3.0/nested_anyof.yaml @@ -0,0 +1,16 @@ +components: + schemas: + NullOne: + enum: + - null + SomeData: + anyOf: + - anyOf: + - type: string + - type: integer + - $ref: '#/components/schemas/NullOne' +info: + title: Problem example with nested anyOf + version: 1.0.0 +openapi: 3.0.0 +paths: {} diff --git a/test/oas_examples/v3.0/no-example-v3.yaml b/test/oas_examples/v3.0/no-example-v3.yaml new file mode 100644 index 0000000..203ddc7 --- /dev/null +++ b/test/oas_examples/v3.0/no-example-v3.yaml @@ -0,0 +1,21 @@ +info: + title: Regression test for an API which doesn't have any example + version: 0.0.1 +openapi: 3.0.1 +paths: + /op: + get: + requestBody: + content: + application/json: + schema: + properties: + property: + type: string + required: + - property + type: object + required: true + responses: + '200': + description: OK diff --git a/test/oas_examples/v3.0/oauth2.yaml b/test/oas_examples/v3.0/oauth2.yaml new file mode 100644 index 0000000..1ff0abe --- /dev/null +++ b/test/oas_examples/v3.0/oauth2.yaml @@ -0,0 +1,23 @@ +components: + securitySchemes: + OAuth_2.0_Client_Credentials: + description: OAuth 2.0 - Client Credentials + flows: + clientCredentials: + scopes: + scope: scope description + tokenUrl: https://example.com/token + type: oauth2 +info: + description: info + title: info + version: 0.1.0 +openapi: 3.0.2 +paths: + /example/api: + get: + description: description + responses: + 200: + description: response + summary: summary diff --git a/test/oas_examples/v3.0/oneOf.yaml b/test/oas_examples/v3.0/oneOf.yaml new file mode 100644 index 0000000..893d777 --- /dev/null +++ b/test/oas_examples/v3.0/oneOf.yaml @@ -0,0 +1,36 @@ +components: + schemas: + apple: + properties: + kind: + type: string + title: apple + type: object + banana: + properties: + count: + type: number + title: banana + type: object + fruit: + oneOf: + - $ref: '#/components/schemas/apple' + - $ref: '#/components/schemas/banana' + properties: + color: + type: string + title: fruit +info: + title: fruity + version: 0.0.1 +openapi: 3.0.1 +paths: + /: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/fruit' + description: desc diff --git a/test/oas_examples/v3.0/oneOfArrayMapImport.yaml b/test/oas_examples/v3.0/oneOfArrayMapImport.yaml new file mode 100644 index 0000000..f1a3ebd --- /dev/null +++ b/test/oas_examples/v3.0/oneOfArrayMapImport.yaml @@ -0,0 +1,56 @@ +components: + schemas: + apple: + properties: + kind: + type: string + title: apple + type: object + apples: + additionalProperties: + $ref: '#/components/schemas/apple' + title: apples + type: object + fruit: + oneOf: + - $ref: '#/components/schemas/apples' + - $ref: '#/components/schemas/grapes' + properties: + color: + type: string + title: fruit + grape: + properties: + color: + type: string + title: grape + type: object + grapes: + items: + $ref: '#/components/schemas/grape' + title: grapes + type: array +info: + title: fruity + version: 0.0.1 +openapi: 3.0.1 +paths: + /: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/fruit' + description: desc + put: + operationId: test + parameters: [] + requestBody: + content: + application/json: + schema: {} + responses: + '204': + description: Success diff --git a/test/oas_examples/v3.0/oneOfDiscriminator.yaml b/test/oas_examples/v3.0/oneOfDiscriminator.yaml new file mode 100644 index 0000000..233d908 --- /dev/null +++ b/test/oas_examples/v3.0/oneOfDiscriminator.yaml @@ -0,0 +1,301 @@ +components: + schemas: + AppleAllOfDisc: + allOf: + - $ref: '#/components/schemas/FruitType' + properties: + seeds: + type: integer + required: + - seeds + type: object + AppleAnyOfDisc: + anyOf: + - $ref: '#/components/schemas/FruitType' + properties: + seeds: + type: integer + required: + - seeds + type: object + AppleGrandparentDisc: + allOf: + - $ref: '#/components/schemas/Parent' + properties: + seeds: + type: integer + required: + - seeds + type: object + AppleOneOfDisc: + oneOf: + - $ref: '#/components/schemas/FruitType' + properties: + seeds: + type: integer + required: + - seeds + type: object + AppleOneOfEnumMappingDisc: + properties: + seeds: + type: integer + required: + - seeds + type: object + AppleReqDisc: + properties: + fruitType: + type: string + seeds: + type: integer + required: + - seeds + - fruitType + type: object + BananaAllOfDisc: + allOf: + - $ref: '#/components/schemas/FruitType' + properties: + length: + type: integer + required: + - length + type: object + BananaAnyOfDisc: + anyOf: + - $ref: '#/components/schemas/FruitType' + properties: + length: + type: integer + required: + - length + type: object + BananaGrandparentDisc: + allOf: + - $ref: '#/components/schemas/Parent' + properties: + length: + type: integer + required: + - length + type: object + BananaOneOfDisc: + oneOf: + - $ref: '#/components/schemas/FruitType' + properties: + length: + type: integer + required: + - length + type: object + BananaOneOfEnumMappingDisc: + properties: + length: + type: integer + required: + - length + type: object + BananaReqDisc: + properties: + fruitType: + type: string + length: + type: integer + required: + - length + - fruitType + type: object + ComposedDiscMissingFromProperties: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/DiscMissingFromProperties' + ComposedDiscMissingNoProperties: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/DiscMissingNoProperties' + ComposedDiscOptionalTypeCorrect: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + ComposedDiscOptionalTypeInconsistent: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/DiscOptionalTypeIncorrect' + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + ComposedDiscOptionalTypeIncorrect: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/DiscOptionalTypeIncorrect' + ComposedDiscRequiredInconsistent: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/DiscOptionalTypeCorrect' + - $ref: '#/components/schemas/FruitType' + ComposedDiscTypeInconsistent: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/DiscTypeIncorrect' + - $ref: '#/components/schemas/FruitType' + ComposedDiscTypeIncorrect: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/DiscTypeIncorrect' + DiscMissingFromProperties: + properties: + length: + type: integer + type: object + DiscMissingNoProperties: + type: object + DiscOptionalTypeCorrect: + properties: + fruitType: + type: string + type: object + DiscOptionalTypeIncorrect: + properties: + fruitType: + type: integer + type: object + DiscTypeIncorrect: + properties: + fruitType: + type: integer + required: + - fruitType + type: object + FruitAllOfDisc: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/AppleAllOfDisc' + - $ref: '#/components/schemas/BananaAllOfDisc' + FruitAnyOfDisc: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/AppleAnyOfDisc' + - $ref: '#/components/schemas/BananaAnyOfDisc' + FruitGrandparentDisc: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/AppleGrandparentDisc' + - $ref: '#/components/schemas/BananaGrandparentDisc' + FruitInlineDisc: + discriminator: + propertyName: fruitType + oneOf: + - properties: + fruitType: + type: string + seeds: + type: integer + required: + - seeds + - fruitType + type: object + - properties: + fruitType: + type: string + length: + type: integer + required: + - length + - fruitType + type: object + FruitInlineInlineDisc: + discriminator: + propertyName: fruitType + oneOf: + - oneOf: + - properties: + fruitType: + type: string + required: + - fruitType + type: object + properties: + seeds: + type: integer + required: + - seeds + type: object + - oneOf: + - properties: + fruitType: + type: string + required: + - fruitType + type: object + properties: + length: + type: integer + required: + - length + type: object + FruitOneOfDisc: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/AppleOneOfDisc' + - $ref: '#/components/schemas/BananaOneOfDisc' + FruitOneOfEnumMappingDisc: + discriminator: + mapping: + APPLE: '#/components/schemas/AppleOneOfEnumMappingDisc' + BANANA: '#/components/schemas/BananaOneOfEnumMappingDisc' + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/AppleOneOfEnumMappingDisc' + - $ref: '#/components/schemas/BananaOneOfEnumMappingDisc' + properties: + fruitType: + $ref: '#/components/schemas/FruitTypeEnum' + required: + - fruitType + type: object + FruitReqDisc: + discriminator: + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/AppleReqDisc' + - $ref: '#/components/schemas/BananaReqDisc' + FruitType: + properties: + fruitType: + type: string + required: + - fruitType + FruitTypeEnum: + enum: + - APPLE + - BANANA + type: string + Parent: + allOf: + - $ref: '#/components/schemas/FruitType' + type: object +info: + title: fruity + version: 0.0.1 +openapi: 3.0.1 +paths: + /: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/FruitAllOfDisc' + description: desc diff --git a/test/oas_examples/v3.0/oneOf_nonPrimitive.yaml b/test/oas_examples/v3.0/oneOf_nonPrimitive.yaml new file mode 100644 index 0000000..488d653 --- /dev/null +++ b/test/oas_examples/v3.0/oneOf_nonPrimitive.yaml @@ -0,0 +1,29 @@ +components: + schemas: + Example: + oneOf: + - format: uuid + type: string + - format: date-time + type: string + - type: integer + - type: number +info: + license: + name: MIT + title: Example - oneOf data type + version: 1.0.0 +openapi: 3.0.1 +paths: + /example: + get: + operationId: list + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Example' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/oneOf_primitive.yaml b/test/oas_examples/v3.0/oneOf_primitive.yaml new file mode 100644 index 0000000..b4a4c30 --- /dev/null +++ b/test/oas_examples/v3.0/oneOf_primitive.yaml @@ -0,0 +1,31 @@ +components: + schemas: + Child: + properties: + name: + type: string + type: object + Example: + oneOf: + - $ref: '#/components/schemas/Child' + - format: int32 + type: integer +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /example: + get: + operationId: list + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Example' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/oneOf_reuseRef.yaml b/test/oas_examples/v3.0/oneOf_reuseRef.yaml new file mode 100644 index 0000000..5b9a1ff --- /dev/null +++ b/test/oas_examples/v3.0/oneOf_reuseRef.yaml @@ -0,0 +1,47 @@ +components: + schemas: + Apple: + nullable: true + properties: + cultivar: + pattern: ^[a-zA-Z\s]*$ + type: string + origin: + pattern: /^[A-Z\s]*$/i + type: string + type: object + Banana: + properties: + lengthCm: + type: number + type: object + Fruit: + discriminator: + mapping: + banana: '#/components/schemas/Banana' + green_apple: '#/components/schemas/Apple' + red_apple: '#/components/schemas/Apple' + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/Apple' + - $ref: '#/components/schemas/Apple' + - $ref: '#/components/schemas/Banana' +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /example: + get: + operationId: get_fruit + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Fruit' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/oneOf_twoPrimitives.yaml b/test/oas_examples/v3.0/oneOf_twoPrimitives.yaml new file mode 100644 index 0000000..63d5706 --- /dev/null +++ b/test/oas_examples/v3.0/oneOf_twoPrimitives.yaml @@ -0,0 +1,20 @@ +info: + description: oneOf with two entries of type string, see https://github.com/OpenAPITools/openapi-generator/issues/10450 + title: oneOf two primitives + version: 1.0.0 +openapi: 3.0.3 +paths: + /myExample: + post: + requestBody: + content: + application/json: + schema: + oneOf: + - format: ipv4 + type: string + - format: ipv6 + type: string + responses: + 200: + description: OK diff --git a/test/oas_examples/v3.0/oneof_polymorphism_and_inheritance.yaml b/test/oas_examples/v3.0/oneof_polymorphism_and_inheritance.yaml new file mode 100644 index 0000000..adb1b69 --- /dev/null +++ b/test/oas_examples/v3.0/oneof_polymorphism_and_inheritance.yaml @@ -0,0 +1,238 @@ +components: + requestBodies: + Foo: + content: + application/json;charset=utf-8: + schema: + $ref: '#/components/schemas/Foo' + description: The Foo to be created + responses: + 200FooArray: + content: + application/json;charset=utf-8: + schema: + items: + $ref: '#/components/schemas/FooRefOrValue' + type: array + description: Success + 201Foo: + content: + application/json: + schema: + $ref: '#/components/schemas/FooRefOrValue' + description: Error + '204': + content: {} + description: Deleted + schemas: + Addressable: + description: Base schema for addressable entities + properties: + href: + description: Hyperlink reference + type: string + id: + description: unique identifier + type: string + type: object + Apple: + properties: + seeds: + type: integer + required: + - seeds + type: object + Banana: + properties: + length: + type: integer + required: + - length + type: object + Bar: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + barPropA: + type: string + foo: + $ref: '#/components/schemas/FooRefOrValue' + fooPropB: + type: string + id: + type: string + required: + - id + type: object + BarRef: + allOf: + - $ref: '#/components/schemas/EntityRef' + type: object + BarRefOrValue: + oneOf: + - $ref: '#/components/schemas/Bar' + - $ref: '#/components/schemas/BarRef' + type: object + Bar_Create: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + barPropA: + type: string + foo: + $ref: '#/components/schemas/FooRefOrValue' + fooPropB: + type: string + type: object + Entity: + allOf: + - $ref: '#/components/schemas/Addressable' + - $ref: '#/components/schemas/Extensible' + discriminator: + propertyName: '@type' + type: object + EntityRef: + allOf: + - $ref: '#/components/schemas/Addressable' + - $ref: '#/components/schemas/Extensible' + description: Entity reference schema to be use for all entityRef class. + discriminator: + propertyName: '@type' + properties: + '@referredType': + description: The actual type of the target instance when needed for disambiguation. + type: string + name: + description: Name of the related entity. + type: string + type: object + Extensible: + properties: + '@baseType': + description: When sub-classing, this defines the super-class + type: string + '@schemaLocation': + description: A URI to a JSON-Schema file that defines additional attributes + and relationships + type: string + '@type': + description: When sub-classing, this defines the sub-class Extensible name + type: string + required: + - '@type' + type: object + Foo: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + fooPropA: + type: string + fooPropB: + type: string + type: object + FooRef: + allOf: + - $ref: '#/components/schemas/EntityRef' + properties: + foorefPropA: + type: string + type: object + FooRefOrValue: + discriminator: + propertyName: '@type' + oneOf: + - $ref: '#/components/schemas/Foo' + - $ref: '#/components/schemas/FooRef' + type: object + Fruit: + discriminator: + mapping: + APPLE: '#/components/schemas/Apple' + BANANA: '#/components/schemas/Banana' + propertyName: fruitType + oneOf: + - $ref: '#/components/schemas/Apple' + - $ref: '#/components/schemas/Banana' + properties: + fruitType: + $ref: '#/components/schemas/FruitType' + required: + - fruitType + type: object + FruitType: + enum: + - APPLE + - BANANA + type: string + Pasta: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + vendor: + type: string + type: object + Pizza: + allOf: + - $ref: '#/components/schemas/Entity' + properties: + pizzaSize: + type: number + type: object + PizzaSpeziale: + allOf: + - $ref: '#/components/schemas/Pizza' + properties: + toppings: + type: string + type: object +info: + description: 'This tests for a oneOf interface representation + + ' + title: ByRefOrValue + version: 0.0.1 +openapi: 3.0.1 +paths: + /bar: + post: + operationId: createBar + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Bar_Create' + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Bar' + description: Bar created + summary: Create a Bar + tags: + - Bar + /foo: + get: + operationId: getAllFoos + responses: + '200': + $ref: '#/components/responses/200FooArray' + summary: GET all Foos + tags: + - Foo + post: + operationId: createFoo + requestBody: + $ref: '#/components/requestBodies/Foo' + responses: + '201': + $ref: '#/components/responses/201Foo' + summary: Create a Foo + tags: + - Foo +servers: +- url: http://localhost:8080 +tags: +- name: Foo +- name: Bar diff --git a/test/oas_examples/v3.0/openapi__openapi.yaml b/test/oas_examples/v3.0/openapi__openapi.yaml new file mode 100644 index 0000000..df842aa --- /dev/null +++ b/test/oas_examples/v3.0/openapi__openapi.yaml @@ -0,0 +1,826 @@ +components: + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + message: message + type: type + properties: + code: + format: int32 + title: code + type: integer + message: + title: message + type: string + type: + title: type + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + title: id + type: integer + name: + title: name + type: string + title: Pet category + type: object + xml: + name: Category + EnumModel: + enum: + - available> + - pending< + - sold + - '1' + - '2' + type: string + Order: + description: An order for a pets from the pet store + example: + complete: false + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23 04:56:07+00:00 + status: placed + properties: + complete: + default: false + title: complete + type: boolean + id: + format: int64 + title: id + type: integer + petId: + format: int64 + title: petId + type: integer + quantity: + format: int32 + title: quantity + type: integer + shipDate: + format: date-time + title: shipDate + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + title: status + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + example: + category: + id: 6 + name: name + id: 0 + name: doggie + photoUrls: + - photoUrls + - photoUrls + status: available + tags: + - id: 1 + name: name + - id: 1 + name: name + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + title: id + type: integer + name: + example: doggie + title: name + type: string + photoUrls: + items: + type: string + title: photoUrls + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + title: status + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + title: tags + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + title: id + type: integer + name: + title: name + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + example: + email: email + firstName: firstName + id: 0 + lastName: lastName + password: password + phone: phone + userStatus: 6 + username: username + properties: + email: + title: email + type: string + firstName: + title: firstName + type: string + id: + format: int64 + title: id + type: integer + lastName: + title: lastName + type: string + password: + title: password + type: string + phone: + title: phone + type: string + userStatus: + description: User Status + format: int32 + title: userStatus + type: integer + username: + title: username + type: string + title: a User + type: object + xml: + name: User + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + x-apikeyInfoFunc: openapi_server.controllers.security_controller.info_from_api_key + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 + x-scopeValidateFunc: openapi_server.controllers.security_controller.validate_scope_petstore_auth + x-tokenInfoFunc: openapi_server.controllers.security_controller.info_from_petstore_auth +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /pet: + post: + operationId: add_pet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + '405': + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-codegen-request-body-name: body + x-openapi-router-controller: openapi_server.controllers.pet_controller + put: + operationId: update_pet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + '400': + content: {} + description: Invalid ID supplied + '404': + content: {} + description: Pet not found + '405': + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: find_pets_by_status + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: find_pets_by_tags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/{petId}: + delete: + operationId: delete_pet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + get: + description: Returns a single pet + operationId: get_pet_by_id + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + content: {} + description: Invalid ID supplied + '404': + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + post: + operationId: update_pet_with_form + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + '405': + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/{petId}/uploadImage: + post: + operationId: upload_file + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: get_inventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + /store/order: + post: + operationId: place_order + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-codegen-request-body-name: body + x-openapi-router-controller: openapi_server.controllers.store_controller + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: delete_order + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + content: {} + description: Invalid ID supplied + '404': + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: get_order_by_id + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + content: {} + description: Invalid ID supplied + '404': + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + /user: + post: + description: This can only be done by the logged in user. + operationId: create_user + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-codegen-request-body-name: body + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/createWithArray: + post: + operationId: create_users_with_array_input + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/createWithList: + post: + operationId: create_users_with_list_input + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/login: + get: + operationId: login_user + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/logout: + get: + operationId: logout_user + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: delete_user + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + content: {} + description: Invalid username supplied + '404': + content: {} + description: User not found + summary: Delete user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + get: + operationId: get_user_by_name + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + content: {} + description: Invalid username supplied + '404': + content: {} + description: User not found + summary: Get user by user name + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + put: + description: This can only be done by the logged in user. + operationId: update_user + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + content: {} + description: Invalid user supplied + '404': + content: {} + description: User not found + summary: Updated user + tags: + - user + x-codegen-request-body-name: body + x-openapi-router-controller: openapi_server.controllers.user_controller +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +x-original-swagger-version: '2.0' diff --git a/test/oas_examples/v3.0/ops-v3.yaml b/test/oas_examples/v3.0/ops-v3.yaml new file mode 100644 index 0000000..d12a104 --- /dev/null +++ b/test/oas_examples/v3.0/ops-v3.yaml @@ -0,0 +1,190 @@ +info: + title: Regression test for large number of operations + version: 0.0.1 +openapi: 3.0.1 +paths: + /op1: + get: + responses: + '200': + description: OK + /op10: + get: + responses: + '200': + description: OK + /op11: + get: + responses: + '200': + description: OK + /op12: + get: + responses: + '200': + description: OK + /op13: + get: + responses: + '200': + description: OK + /op14: + get: + responses: + '200': + description: OK + /op15: + get: + responses: + '200': + description: OK + /op16: + get: + responses: + '200': + description: OK + /op17: + get: + responses: + '200': + description: OK + /op18: + get: + responses: + '200': + description: OK + /op19: + get: + responses: + '200': + description: OK + /op2: + get: + responses: + '200': + description: OK + /op20: + get: + responses: + '200': + description: OK + /op21: + get: + responses: + '200': + description: OK + /op22: + get: + responses: + '200': + description: OK + /op23: + get: + responses: + '200': + description: OK + /op24: + get: + responses: + '200': + description: OK + /op25: + get: + responses: + '200': + description: OK + /op26: + get: + responses: + '200': + description: OK + /op27: + get: + responses: + '200': + description: OK + /op28: + get: + responses: + '200': + description: OK + /op29: + get: + responses: + '200': + description: OK + /op3: + get: + responses: + '200': + description: OK + /op30: + get: + responses: + '200': + description: OK + /op31: + get: + responses: + '200': + description: OK + /op32: + get: + responses: + '200': + description: OK + /op33: + get: + responses: + '200': + description: OK + /op34: + get: + responses: + '200': + description: OK + /op35: + get: + responses: + '200': + description: OK + /op36: + get: + responses: + '200': + description: OK + /op37: + get: + responses: + '200': + description: OK + /op4: + get: + responses: + '200': + description: OK + /op5: + get: + responses: + '200': + description: OK + /op6: + get: + responses: + '200': + description: OK + /op7: + get: + responses: + '200': + description: OK + /op8: + get: + responses: + '200': + description: OK + /op9: + get: + responses: + '200': + description: OK diff --git a/test/oas_examples/v3.0/optionalResponse.yaml b/test/oas_examples/v3.0/optionalResponse.yaml new file mode 100644 index 0000000..40e422e --- /dev/null +++ b/test/oas_examples/v3.0/optionalResponse.yaml @@ -0,0 +1,48 @@ +components: + schemas: + UserDto: + additionalProperties: false + properties: + id: + format: uuid + type: string + name: + nullable: true + type: string + required: + - id + type: object +info: + title: My Sample User API + version: '1.0' +openapi: 3.0.1 +paths: + /api/Users/{userId}: + get: + operationId: GetUserById + parameters: + - description: ID of the user + in: path + name: userId + required: true + schema: + format: uuid + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/UserDto' + text/json: + schema: + $ref: '#/components/schemas/UserDto' + text/plain: + schema: + $ref: '#/components/schemas/UserDto' + description: Success + '204': + description: No Content + summary: Get a specific user + tags: + - Users diff --git a/test/oas_examples/v3.0/parameter-test-spec.yaml b/test/oas_examples/v3.0/parameter-test-spec.yaml new file mode 100644 index 0000000..29b73a9 --- /dev/null +++ b/test/oas_examples/v3.0/parameter-test-spec.yaml @@ -0,0 +1,132 @@ +info: + description: test parameters + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: Test parameters + version: 1.0.0 +openapi: 3.0.0 +paths: + /test/parameters/{path_default}/{path_nullable}: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: query default + explode: false + in: query + name: query_default + schema: + default: available + type: string + style: form + - description: query default enum + in: query + name: query_default_enum + schema: + default: B + enum: + - A + - B + - C + type: string + - description: query default int + in: query + name: query_default_int + schema: + default: 3 + format: int32 + type: number + - description: header default + in: header + name: header_default + schema: + default: available + type: string + - description: header default enum + in: header + name: header_default_enum + schema: + default: B + enum: + - A + - B + - C + type: string + - description: header default int + in: header + name: header_default_int + schema: + default: 3 + format: int32 + type: number + - description: path default + in: path + name: path_default + required: true + schema: + type: string + - description: cookie default + in: cookie + name: cookie_default + schema: + default: available + type: string + - description: cookie default enum + in: cookie + name: cookie_default_enum + schema: + default: B + enum: + - A + - B + - C + type: string + - description: cookie default int + in: cookie + name: cookie_default_int + schema: + default: 3 + format: int32 + type: number + - deprecated: true + description: query nullable + explode: false + in: query + name: query_nullable + schema: + nullable: true + type: string + style: form + - description: header nullable + in: header + name: header_nullable + schema: + nullable: true + type: string + - description: path_nullable + in: path + name: path_nullable + required: true + schema: + type: string + - description: cookie_nullable + in: cookie + name: cookie_nullable + schema: + nullable: true + type: string + - description: query parameter with dollar sign + in: query + name: $query-$dollar-sign + schema: + type: string + responses: + '200': + description: successful operation + '400': + description: Invalid status value + summary: Finds Pets by status + tags: + - default diff --git a/test/oas_examples/v3.0/petstore-addpet-only.yaml b/test/oas_examples/v3.0/petstore-addpet-only.yaml new file mode 100644 index 0000000..a0aeb76 --- /dev/null +++ b/test/oas_examples/v3.0/petstore-addpet-only.yaml @@ -0,0 +1,130 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + schemas: + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet diff --git a/test/oas_examples/v3.0/petstore-for-testing.yaml b/test/oas_examples/v3.0/petstore-for-testing.yaml new file mode 100644 index 0000000..b0eb71f --- /dev/null +++ b/test/oas_examples/v3.0/petstore-for-testing.yaml @@ -0,0 +1,858 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + AnyValue: {} + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Color: + enum: + - black + - white + - red + - green + - blue + type: string + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PetsForm: + properties: + image: + format: binary + type: string + images[]: + items: + format: binary + type: string + type: array + intParam: + format: int32 + type: integer + longArray: + items: + format: int64 + type: integer + type: array + stringParam: + type: string + titles[]: + items: + type: string + type: array + required: + - stringParam + type: object + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. For this sample, + you can use the api key `special-key` to test the authorization filters. Special + characters: " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: integer + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/upload: + post: + description: '' + operationId: addPets + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/PetsForm' + description: Object that contains info about pets + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + summary: Add a few pets using form + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - in: header + name: headerLong + required: true + schema: + format: int64 + type: integer + - in: cookie + name: cookieString + required: true + schema: + type: string + - in: cookie + name: cookieInt + required: false + schema: + format: int32 + type: integer + - in: cookie + name: cookieIntArray + required: false + schema: + items: + type: integer + type: array + - in: cookie + name: cookieStringArray + required: false + schema: + items: + type: string + type: array + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + - description: Date for test + in: path + name: petDate + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + maximum: 5 + minimum: 1 + type: number + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + - description: String param to test Size constraint + in: query + name: sizeString + required: true + schema: + maxLength: 10 + minLength: 5 + type: string + - description: Min Long param for test + in: query + name: minLong + required: true + schema: + format: int64 + minimum: 10 + type: integer + - description: Min Decimal param for test + in: query + name: minDecimal + required: true + schema: + exclusiveMinimum: true + minimum: 0 + type: number + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.helidon.io:8080/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore-group-parameter.yaml b/test/oas_examples/v3.0/petstore-group-parameter.yaml new file mode 100644 index 0000000..85c76e6 --- /dev/null +++ b/test/oas_examples/v3.0/petstore-group-parameter.yaml @@ -0,0 +1,454 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-group-parameters: false + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore-multiple-required-properties-has-same-oneOf-object.yaml b/test/oas_examples/v3.0/petstore-multiple-required-properties-has-same-oneOf-object.yaml new file mode 100644 index 0000000..b4c49dc --- /dev/null +++ b/test/oas_examples/v3.0/petstore-multiple-required-properties-has-same-oneOf-object.yaml @@ -0,0 +1,63 @@ +components: + schemas: + cat: + properties: + attr: + enum: + - CAT + type: string + required: + - attr + type: object + dog: + properties: + attr: + enum: + - DOG + type: string + required: + - attr + type: object + pet: + discriminator: + mapping: + CAT: '#/components/schemas/cat' + DOG: '#/components/schemas/dog' + propertyName: attr + oneOf: + - $ref: '#/components/schemas/dog' + - $ref: '#/components/schemas/cat' + petPreference: + properties: + pet1: + $ref: '#/components/schemas/pet' + pet2: + $ref: '#/components/schemas/pet' + pet3: + $ref: '#/components/schemas/pet' + required: + - pet1 + - pet2 + - pet3 + type: object +info: + description: API under test + title: My title + version: 1.0.7 +openapi: 3.0.1 +paths: + /pet_preference: + post: + operationId: postPreference + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/petPreference' + responses: + 201: + description: OK + tags: + - pet +servers: +- url: https://localhost:9999/root diff --git a/test/oas_examples/v3.0/petstore-no-multipart-for-testing.yaml b/test/oas_examples/v3.0/petstore-no-multipart-for-testing.yaml new file mode 100644 index 0000000..8364c68 --- /dev/null +++ b/test/oas_examples/v3.0/petstore-no-multipart-for-testing.yaml @@ -0,0 +1,787 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + AnyValue: {} + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Color: + enum: + - black + - white + - red + - green + - blue + type: string + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PetsForm: + properties: + image: + format: binary + type: string + images[]: + items: + format: binary + type: string + type: array + intParam: + format: int32 + type: integer + longArray: + items: + format: int64 + type: integer + type: array + stringParam: + type: string + titles[]: + items: + type: string + type: array + required: + - stringParam + type: object + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. For this sample, + you can use the api key `special-key` to test the authorization filters. Special + characters: " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: integer + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - in: header + name: headerLong + required: true + schema: + format: int64 + type: integer + - in: cookie + name: cookieString + required: true + schema: + type: string + - in: cookie + name: cookieInt + required: false + schema: + format: int32 + type: integer + - in: cookie + name: cookieIntArray + required: false + schema: + items: + type: integer + type: array + - in: cookie + name: cookieStringArray + required: false + schema: + items: + type: string + type: array + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + maximum: 5 + minimum: 1 + type: number + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + - description: String param to test Size constraint + in: query + name: sizeString + required: true + schema: + maxLength: 10 + minLength: 5 + type: string + - description: Min Long param for test + in: query + name: minLong + required: true + schema: + format: int64 + minimum: 10 + type: integer + - description: Min Decimal param for test + in: query + name: minDecimal + required: true + schema: + exclusiveMinimum: true + minimum: 0 + type: number + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.helidon.io:8080/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore-on-classpath.yaml b/test/oas_examples/v3.0/petstore-on-classpath.yaml new file mode 100644 index 0000000..6e42cea --- /dev/null +++ b/test/oas_examples/v3.0/petstore-on-classpath.yaml @@ -0,0 +1,731 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore-v3.0-recommend.yaml b/test/oas_examples/v3.0/petstore-v3.0-recommend.yaml new file mode 100644 index 0000000..9d5be6a --- /dev/null +++ b/test/oas_examples/v3.0/petstore-v3.0-recommend.yaml @@ -0,0 +1,114 @@ +components: + schemas: + Error: + properties: + code: + format: int32 + type: integer + message: + type: string + required: + - code + - message + Pet: + properties: + id: + format: int64 + type: integer + name: + type: string + tag: + type: string + required: + - id + - name + Pets: + items: + $ref: '#/components/schemas/Pet' + type: array +info: + license: + name: MIT + title: Swagger Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pets: + get: + operationId: listPets + parameters: + - description: How many items to return at one time (max 100) + in: query + name: limit + required: false + schema: + format: int32 + type: integer + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: A paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: List all pets + tags: + - pets + post: + operationId: createPets + responses: + '201': + description: Null response + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Create a pet + tags: + - pets + /pets/{petId}: + get: + operationId: showPetById + parameters: + - description: The id of the pet to retrieve + in: path + name: petId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: Expected response to a valid request + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Info for a specific pet + tags: + - pets +servers: +- url: http://petstore.swagger.io/v1 diff --git a/test/oas_examples/v3.0/petstore-v3.1.yaml b/test/oas_examples/v3.0/petstore-v3.1.yaml new file mode 100644 index 0000000..a4fe275 --- /dev/null +++ b/test/oas_examples/v3.0/petstore-v3.1.yaml @@ -0,0 +1,109 @@ +components: + schemas: + Error: + properties: + code: + format: int32 + type: integer + message: + type: string + required: + - code + - message + Pet: + properties: + id: + format: int64 + type: integer + name: + type: string + tag: + type: string + required: + - id + - name + Pets: + items: + $ref: '#/components/schemas/Pet' + type: array +info: + license: + name: MIT + title: Swagger Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /v3/pets: + get: + operationId: listPets + parameters: + - description: How many items to return at one time (max 100) + in: query + name: limit + required: false + schema: + format: int32 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: A paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: List all pets + tags: + - pets + post: + operationId: createPets + responses: + '201': + description: Null response + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Create a pet + tags: + - pets + /v3/pets/{petId}: + get: + operationId: showPetById + parameters: + - description: The id of the pet to retrieve + in: path + name: petId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: Expected response to a valid request + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Info for a specific pet + tags: + - pets +servers: +- url: http://petstore.swagger.io/v1 diff --git a/test/oas_examples/v3.0/petstore-with-complex-headers.yaml b/test/oas_examples/v3.0/petstore-with-complex-headers.yaml new file mode 100644 index 0000000..03ae4bb --- /dev/null +++ b/test/oas_examples/v3.0/petstore-with-complex-headers.yaml @@ -0,0 +1,715 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + MediaType: + enum: + - application/json + - application/xml + type: string + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + parameters: + - in: header + name: header1 + schema: + $ref: '#/components/schemas/Pet' + - in: header + name: header2 + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + - in: header + name: Accept + schema: + $ref: '#/components/schemas/MediaType' + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore-with-deprecated-fields.yaml b/test/oas_examples/v3.0/petstore-with-deprecated-fields.yaml new file mode 100644 index 0000000..c5c8b61 --- /dev/null +++ b/test/oas_examples/v3.0/petstore-with-deprecated-fields.yaml @@ -0,0 +1,722 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + deprecated: true + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + nullable: true + type: string + photoUrls: + deprecated: true + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + auth_cookie: + in: cookie + name: AUTH_KEY + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - deprecated: true + description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - deprecated: true + description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore-with-no-response-body.yaml b/test/oas_examples/v3.0/petstore-with-no-response-body.yaml new file mode 100644 index 0000000..044523d --- /dev/null +++ b/test/oas_examples/v3.0/petstore-with-no-response-body.yaml @@ -0,0 +1,21 @@ +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + delete: + responses: + '204': + description: OK + tags: + - pet +tags: +- description: Everything about your Pets + name: pet diff --git a/test/oas_examples/v3.0/petstore-with-nullable-required.yaml b/test/oas_examples/v3.0/petstore-with-nullable-required.yaml new file mode 100644 index 0000000..b35923a --- /dev/null +++ b/test/oas_examples/v3.0/petstore-with-nullable-required.yaml @@ -0,0 +1,808 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PetWithRequiredNullableCases1: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + nullable: true + type: integer + name: + example: doggie + nullable: true + type: string + photoUrls: + items: + type: string + nullable: true + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + nullable: true + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + nullable: true + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a PetWithRequiredNullableCases1 + type: object + xml: + name: Pet + PetWithRequiredNullableCases2: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + nullable: false + type: integer + name: + example: doggie + nullable: false + type: string + photoUrls: + items: + type: string + nullable: false + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + nullable: false + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + nullable: false + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a PetWithRequiredNullableCases2 + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + auth_cookie: + in: cookie + name: AUTH_KEY + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore-with-object-as-parameter.yaml b/test/oas_examples/v3.0/petstore-with-object-as-parameter.yaml new file mode 100644 index 0000000..f93c764 --- /dev/null +++ b/test/oas_examples/v3.0/petstore-with-object-as-parameter.yaml @@ -0,0 +1,787 @@ +components: + parameters: + statusEnum: + description: The required status + example: pending + explode: true + in: query + name: status + required: true + schema: + $ref: '#/components/schemas/statusEnum' + style: form + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + PetForm: + content: + application/x-www-form-urlencoded: + example: + name: fluffy + status: available + schema: + $ref: '#/components/schemas/PetForm' + UploadForm: + content: + multipart/form-data: + example: + additionalMetadata: additional metadata example + file: c29tZSB0ZXN0IGRhdGEK + schema: + $ref: '#/components/schemas/UploadForm' + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user objects + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PetForm: + description: A form for updating a pet + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + required: + - name + - status + title: A pet form + type: object + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + UploadForm: + description: A form for attaching files to a pet + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + required: + - file + title: An upload form + type: object + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + statusEnum: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + auth_cookie: + in: cookie + name: AUTH_KEY + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + patch: + description: '' + operationId: updatePetStatusWithEnum + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + - $ref: '#/components/parameters/statusEnum' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + summary: Set the status of a pet in the store using an enum + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + $ref: '#/components/requestBodies/PetForm' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + $ref: '#/components/requestBodies/UploadForm' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore-with-problem-details.yaml b/test/oas_examples/v3.0/petstore-with-problem-details.yaml new file mode 100644 index 0000000..eb02e3c --- /dev/null +++ b/test/oas_examples/v3.0/petstore-with-problem-details.yaml @@ -0,0 +1,61 @@ +components: + schemas: + Foo: + default: foo + type: string + RestServiceError: + properties: + detail: + description: A human-readable explanation specific to this occurrence of + the problem. + type: string + instance: + description: A unique URI that identifies the specific occurrence of the + problem. + type: string + status: + description: The HTTP Status Code + type: integer + title: + description: A short, human-readable summary of the problem type. + type: string + type: + description: ' A URI reference that identifies the problem type' + type: string +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /foo: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Foo' + description: response + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/RestServiceError' + description: not found + '422': + content: + application/json: + schema: + $ref: '#/components/schemas/RestServiceError' + description: validation error + tags: + - pet +tags: +- description: Everything about your Pets + name: pet diff --git a/test/oas_examples/v3.0/petstore-with-tags.yaml b/test/oas_examples/v3.0/petstore-with-tags.yaml new file mode 100644 index 0000000..808f8a9 --- /dev/null +++ b/test/oas_examples/v3.0/petstore-with-tags.yaml @@ -0,0 +1,732 @@ +components: + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet tag + x-codegen-request-body-name: body + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet tag + x-codegen-request-body-name: body + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet tag + x-spring-paginated: true + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet tag + x-spring-paginated: true + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet tag + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet tag + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet tag + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet tag + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store tag + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store tag + x-codegen-request-body-name: body + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store tag + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store tag + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user tag + x-codegen-request-body-name: body + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user tag + x-codegen-request-body-name: body + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user tag + x-codegen-request-body-name: body + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + 200: + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + 400: + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user tag + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user tag + options: + operationId: logoutUserOptions + responses: + default: + content: {} + description: endpoint configuration response + summary: logoutUserOptions + tags: + - user tag + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user tag + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Get user by user name + tags: + - user tag + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + content: {} + description: Invalid user supplied + 404: + content: {} + description: User not found + summary: Updated user + tags: + - user tag + x-codegen-request-body-name: body +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore_oas3_test.yaml b/test/oas_examples/v3.0/petstore_oas3_test.yaml new file mode 100644 index 0000000..c307af2 --- /dev/null +++ b/test/oas_examples/v3.0/petstore_oas3_test.yaml @@ -0,0 +1,741 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + NullablePet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + nullable: true + type: integer + name: + example: doggie + nullable: true + type: string + photoUrls: + items: + type: string + nullable: true + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + nullable: true + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: A test spec based on the Petstore spec with OAS3 related test cases + such as nullable + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + nullable: true + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + nullable: true + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + example: orderid123 + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/petstore_with_test_endpoint.yaml b/test/oas_examples/v3.0/petstore_with_test_endpoint.yaml new file mode 100644 index 0000000..592bd3f --- /dev/null +++ b/test/oas_examples/v3.0/petstore_with_test_endpoint.yaml @@ -0,0 +1,846 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + nullable: true + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + allOf: + - $ref: '#/components/schemas/OrderInfo' + - $ref: '#/components/schemas/SpecialInfo' + description: An order for a pets from the pet store + properties: + comment: + nullable: true + type: string + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + required: + - comment + title: Pet Order + type: object + xml: + name: Order + OrderInfo: + description: An order info for a pets from the pet store + properties: + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + title: Pet Order Info + type: object + xml: + name: OrderInfo + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + nullable: true + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + nullable: true + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + SpecialInfo: + description: An order info for a pets from the pet store + discriminator: + propertyName: type + properties: + promotion: + type: boolean + requireTest: + type: string + type: + type: string + required: + - requireTest + title: Pet Order Info + type: object + xml: + name: OrderInfo + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + deepSliceMap: + description: An array 1-deep. + items: + description: An array 2-deep. + items: + description: An array 3-deep. + properties: + Pet: + description: An array of pet. + items: + $ref: '#/components/schemas/Pet' + type: array + tag: + $ref: '#/components/schemas/Tag' + title: an Object + type: object + type: array + type: array + deepSliceModel: + description: An array 1-deep. + items: + description: An array 2-deep. + items: + description: An array 3-deep. + items: + $ref: '#/components/schemas/Tag' + type: array + type: array + nullable: true + type: array + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + nullable: true + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + required: + - deepSliceModel + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: int32_test + schema: + format: int32 + type: integer + - description: The password for login in clear text + in: query + name: int64_test + schema: + format: int64 + type: integer + - description: The password for login in clear text + in: query + name: float32_test + schema: + type: number + - description: The password for login in clear text + in: query + name: float64_test + schema: + format: double + type: number + - description: The password for login in clear text + in: query + name: boolean_test + schema: + type: boolean + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + - description: boolean query parameter + in: query + name: boolean_test + schema: + type: boolean + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/php-symfony__petstore.yaml b/test/oas_examples/v3.0/php-symfony__petstore.yaml new file mode 100644 index 0000000..82b2b79 --- /dev/null +++ b/test/oas_examples/v3.0/php-symfony__petstore.yaml @@ -0,0 +1,740 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + EnumStringModel: + description: enum model + enum: + - available + - pending + - sold + type: string + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/ping-array-default.yaml b/test/oas_examples/v3.0/ping-array-default.yaml new file mode 100644 index 0000000..20e895c --- /dev/null +++ b/test/oas_examples/v3.0/ping-array-default.yaml @@ -0,0 +1,28 @@ +components: + schemas: + AnArrayOfString: + properties: + arrayWithADefaultValue: + default: + - aString + items: + type: string + type: array + type: object +info: + title: ping test + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + operationId: pingGet + responses: + '201': + content: + application/json: + schema: + $ref: '#/components/schemas/AnArrayOfString' + description: OK +servers: +- url: http://localhost:8000/ diff --git a/test/oas_examples/v3.0/ping.yaml b/test/oas_examples/v3.0/ping.yaml new file mode 100644 index 0000000..b06ae6c --- /dev/null +++ b/test/oas_examples/v3.0/ping.yaml @@ -0,0 +1,13 @@ +info: + title: ping test + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + operationId: pingGet + responses: + '201': + description: OK +servers: +- url: http://localhost:8000/ diff --git a/test/oas_examples/v3.0/pingBearerAuth.yaml b/test/oas_examples/v3.0/pingBearerAuth.yaml new file mode 100644 index 0000000..969fb60 --- /dev/null +++ b/test/oas_examples/v3.0/pingBearerAuth.yaml @@ -0,0 +1,21 @@ +components: + securitySchemes: + bearerAuth: + bearerFormat: token + scheme: bearer + type: http +info: + title: ping test + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + operationId: pingGet + responses: + '201': + description: OK +security: +- bearerAuth: [] +servers: +- url: http://localhost:8080/ diff --git a/test/oas_examples/v3.0/pingSomeObj.yaml b/test/oas_examples/v3.0/pingSomeObj.yaml new file mode 100644 index 0000000..9f1bd29 --- /dev/null +++ b/test/oas_examples/v3.0/pingSomeObj.yaml @@ -0,0 +1,43 @@ +components: + schemas: + SomeObj: + properties: + $_type: + default: SomeObjIdentifier + enum: + - SomeObjIdentifier + type: string + active: + type: boolean + id: + format: int64 + type: integer + name: + type: string + type: + type: string + type: object +info: + title: ping some object + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + post: + operationId: postPing + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SomeObj' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SomeObj' + description: OK + tags: + - ping +servers: +- url: http://localhost:8082/ diff --git a/test/oas_examples/v3.0/produces.yaml b/test/oas_examples/v3.0/produces.yaml new file mode 100644 index 0000000..b8115d4 --- /dev/null +++ b/test/oas_examples/v3.0/produces.yaml @@ -0,0 +1,62 @@ +components: + schemas: + LocationData: + properties: + xPos: + format: int32 + type: integer + yPos: + format: int32 + type: integer + type: object +info: + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Test + version: 1.0.0 +openapi: 3.0.0 +paths: + /other/issue443: + get: + operationId: issue443 + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/LocationData' + description: Expected response to a valid request + default: + content: + application/text: + schema: + type: string + description: Unexpected error + /ping/json: + get: + operationId: pingJson + responses: + '200': + content: + application/json: + example: '{ "message": "Hello world", "timestamp": "2018-06-29T07:32:23Z"}' + schema: + properties: + message: + type: string + timestamp: + type: string + type: object + description: OK + /ping/text: + get: + operationId: pingText + responses: + '200': + content: + text/plain: + example: Hello world 2018-06-29T07:32:23Z + description: OK +servers: +- url: http://api.example.com/v3 diff --git a/test/oas_examples/v3.0/property-deprecated.yaml b/test/oas_examples/v3.0/property-deprecated.yaml new file mode 100644 index 0000000..ccc3433 --- /dev/null +++ b/test/oas_examples/v3.0/property-deprecated.yaml @@ -0,0 +1,46 @@ +components: + schemas: + Request: + properties: + customerCode: + example: '0001' + type: string + firstName: + deprecated: true + example: first + type: string + type: object + Response: + properties: + customerCode: + example: '0001' + type: string + firstName: + deprecated: true + example: first + type: string + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /deprecated-test: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Request' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + description: responses + x-swagger-router-controller: /deprecated-test +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/property-readonly.yaml b/test/oas_examples/v3.0/property-readonly.yaml new file mode 100644 index 0000000..f7084a1 --- /dev/null +++ b/test/oas_examples/v3.0/property-readonly.yaml @@ -0,0 +1,44 @@ +components: + schemas: + Request: + properties: + customerCode: + example: '0001' + readOnly: true + type: string + firstName: + example: first + type: string + type: object + Response: + properties: + customerCode: + example: '0001' + type: string + firstName: + example: first + type: string + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /test: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Request' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + description: responses +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/protobuf__petstore.yaml b/test/oas_examples/v3.0/protobuf__petstore.yaml new file mode 100644 index 0000000..f6c75e7 --- /dev/null +++ b/test/oas_examples/v3.0/protobuf__petstore.yaml @@ -0,0 +1,743 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + OtherTest: + description: A model to test other use cases + properties: + set_test: + items: + type: string + type: array + uniqueItems: true + title: A model to test other use cases + type: object + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/python-fastapi__openapi.yaml b/test/oas_examples/v3.0/python-fastapi__openapi.yaml new file mode 100644 index 0000000..c7b190f --- /dev/null +++ b/test/oas_examples/v3.0/python-fastapi__openapi.yaml @@ -0,0 +1,867 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + message: message + type: type + properties: + code: + format: int32 + title: code + type: integer + message: + title: message + type: string + type: + title: type + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + title: id + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + title: name + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + example: + complete: false + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23 04:56:07+00:00 + status: placed + properties: + complete: + default: false + title: complete + type: boolean + id: + format: int64 + title: id + type: integer + petId: + format: int64 + title: petId + type: integer + quantity: + format: int32 + title: quantity + type: integer + shipDate: + format: date-time + title: shipDate + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + title: status + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + example: + category: + id: 6 + name: name + id: 0 + name: doggie + photoUrls: + - photoUrls + - photoUrls + status: available + tags: + - id: 1 + name: name + - id: 1 + name: name + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + title: id + type: integer + name: + example: doggie + title: name + type: string + photoUrls: + items: + type: string + title: photoUrls + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + title: status + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + title: tags + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + title: id + type: integer + name: + title: name + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + example: + email: email + firstName: firstName + id: 0 + lastName: lastName + password: password + phone: phone + userStatus: 6 + username: username + properties: + email: + title: email + type: string + firstName: + title: firstName + type: string + id: + format: int64 + title: id + type: integer + lastName: + title: lastName + type: string + password: + title: password + type: string + phone: + title: phone + type: string + userStatus: + description: User Status + format: int32 + title: userStatus + type: integer + username: + title: username + type: string + title: a User + type: object + xml: + name: User + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/query_param_default: + get: + description: '' + operationId: fake_query_param_default + parameters: + - description: has default value + explode: true + in: query + name: hasDefault + required: false + schema: + default: Hello World + type: string + style: form + - description: no default value + explode: true + in: query + name: noDefault + required: false + schema: + type: string + style: form + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + summary: test query parameter default value + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/python-fastapi__petstore.yaml b/test/oas_examples/v3.0/python-fastapi__petstore.yaml new file mode 100644 index 0000000..8650c14 --- /dev/null +++ b/test/oas_examples/v3.0/python-fastapi__petstore.yaml @@ -0,0 +1,760 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/query_param_default: + get: + description: '' + operationId: fake_query_param_default + parameters: + - description: has default value + in: query + name: hasDefault + schema: + default: Hello World + type: string + - description: no default value + in: query + name: noDefault + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + summary: test query parameter default value + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/r__petstore.yaml b/test/oas_examples/v3.0/r__petstore.yaml new file mode 100644 index 0000000..fa5f23d --- /dev/null +++ b/test/oas_examples/v3.0/r__petstore.yaml @@ -0,0 +1,1185 @@ +components: + requestBodies: + OptionalPet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + multipart/related: + encoding: + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + jsonData: + contentType: application/json + schema: + properties: + binaryDataN2Information: + format: binary + type: string + jsonData: + $ref: '#/components/schemas/Pet' + type: object + description: Pet object that needs to be added to the store + required: false + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + multipart/related: + encoding: + binaryDataN2Information: + contentType: application/vnd.3gpp.ngap + headers: + Content-Id: + schema: + type: string + jsonData: + contentType: application/json + schema: + properties: + binaryDataN2Information: + format: binary + type: string + jsonData: + $ref: '#/components/schemas/Pet' + type: object + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + Address: + additionalProperties: + type: integer + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnyOfPig: + anyOf: + - $ref: '#/components/schemas/BasquePig' + - $ref: '#/components/schemas/DanishPig' + AnyOfPrimitiveTypeTest: + oneOf: + - type: integer + - type: string + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + BasquePig: + properties: + className: + type: string + color: + type: string + required: + - className + - color + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - $ref: '#/components/schemas/Address' + - properties: + declawed: + type: boolean + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + DanishPig: + properties: + className: + type: string + size: + type: integer + required: + - className + - size + type: object + Date: + description: to test the model name `Date` + properties: + className: + type: string + percent_description: + description: using % in the description + type: string + url_property: + format: uri + type: string + required: + - className + - url_property + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + NestedOneOf: + properties: + nested_pig: + $ref: '#/components/schemas/Pig' + size: + type: integer + type: object + OneOfPrimitiveTypeTest: + oneOf: + - type: integer + - type: string + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Pig: + discriminator: + propertyName: className + oneOf: + - $ref: '#/components/schemas/BasquePig' + - $ref: '#/components/schemas/DanishPig' + Special: + description: Describes the result of uploading an image resource + properties: + ? '' + : type: string + 123_number: + type: string + array[test]: + type: string + private: + type: string + self: + format: int32 + type: integer + set_test: + items: + type: string + type: array + uniqueItems: true + super: + type: string + title: An uploaded response + type: object + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + allof_tag_api_response: + allOf: + - $ref: '#/components/schemas/Tag' + - $ref: '#/components/schemas/ApiResponse' + dummy_model: + description: to test the model name mapping + properties: + property: + type: string + type: object + format_test: + properties: + binary: + format: binary + type: string + byte: + format: byte + type: string + date: + default: 2019-07-19 + format: date + type: string + dateTime: + default: 2015-10-28 14:38:02+00:00 + format: date-time + type: string + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + integer: + maximum: 100 + minimum: 10 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + password: + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_with_digits: + description: A string that is a 10 digit number. Can have leading zeros. + pattern: ^\d{10}$ + type: string + pattern_with_digits_and_delimiter: + description: A string starting with 'image_' (case insensitive) and one + to three digits following i.e. Image_01. + pattern: /^image_\d{1,3}$/i + type: string + string: + pattern: /[a-z]/i + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + required: + - number + - byte + - date + - password + type: object + mammal: + discriminator: + mapping: + whale: '#/components/schemas/whale' + zebra: '#/components/schemas/zebra' + propertyName: className + oneOf: + - $ref: '#/components/schemas/whale' + - $ref: '#/components/schemas/zebra' + whale: + properties: + className: + type: string + hasBaleen: + type: boolean + hasTeeth: + type: boolean + required: + - className + type: object + zebra: + properties: + className: + type: string + type: + enum: + - plains + - mountain + - grevys + type: string + required: + - className + type: object + securitySchemes: + BearerToken: + scheme: bearer + type: http + api_key: + in: header + name: api_key + type: apiKey + http_auth: + scheme: basic + type: http + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/data_file: + get: + description: '' + operationId: fake_data_file + parameters: + - description: dummy required parameter + in: header + name: dummy + required: true + schema: + type: string + - description: header data file + in: header + name: data_file + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + summary: test data_file to ensure it's escaped correctly + tags: + - fake + /fake/path_array/{path_array}/testing: + get: + description: '' + operationId: fake_path_array + parameters: + - description: dummy path parameter + in: path + name: path_array + required: true + schema: + items: + type: string + type: array + responses: + '200': + description: successful operation + summary: test array parameter in path + tags: + - fake + /fake/regular_expression: + get: + description: '' + operationId: fake_regular-expression + parameters: + - description: dummy required parameter + in: header + name: reg_exp_test + required: true + schema: + pattern: /^[A-Za-z0-9_]{1,15}$/ + type: string + responses: + '200': + description: successful operation + summary: test regular expression to ensure no exception + tags: + - fake + /fake/set_query_parameter: + get: + description: '' + operationId: fake_set_query + parameters: + - description: set query + in: query + name: set_dummy + required: true + schema: + items: + type: string + type: array + uniqueItems: true + - description: array query + in: query + name: array_dummy + required: true + schema: + items: + type: string + type: array + uniqueItems: false + responses: + '200': + description: successful operation + summary: test set query parameter + tags: + - fake + /fake/test_optional_body_parameter: + post: + description: '' + operationId: addPetOptional + requestBody: + $ref: '#/components/requestBodies/OptionalPet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - http_auth: [] + summary: Add a new pet to the store (optional body) + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - http_auth: [] + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: true + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - BearerToken: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /pet/{petId}?streaming: + get: + description: Returns a single pet + operationId: getPetByIdStreaming + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID (streaming) + tags: + - pet + x-streaming: true + /pet_header_test: + get: + description: Header test + operationId: test_header + parameters: + - description: header test int + in: header + name: header_test_int + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Header test + tags: + - pet + x-streaming: true + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/recursion-bug-4650.yaml b/test/oas_examples/v3.0/recursion-bug-4650.yaml new file mode 100644 index 0000000..961eea3 --- /dev/null +++ b/test/oas_examples/v3.0/recursion-bug-4650.yaml @@ -0,0 +1,64 @@ +components: + schemas: + AndFilter: + allOf: + - $ref: '#/components/schemas/Filter' + - properties: + filters: + items: + $ref: '#/components/schemas/Filter' + type: array + operator: + default: and + enum: + - and + - or + type: string + type: object + type: object + Filter: + discriminator: + mapping: + and: '#/components/schemas/AndFilter' + or: '#/components/schemas/OrFilter' + propertyName: operator + example: + field: name + operator: eq + value: john + oneOf: + - $ref: '#/components/schemas/AndFilter' + - $ref: '#/components/schemas/OrFilter' + properties: + operator: + enum: + - and + - or + type: string + type: object + OrFilter: + allOf: + - $ref: '#/components/schemas/Filter' + - properties: + operator: + default: or + enum: + - and + - or + type: string + type: object + type: object +info: + title: Test + version: v1 +openapi: 3.0.1 +paths: + /api/v1/filters: + get: + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/Filter' + description: default response diff --git a/test/oas_examples/v3.0/recursion.yaml b/test/oas_examples/v3.0/recursion.yaml new file mode 100644 index 0000000..3f5d2d1 --- /dev/null +++ b/test/oas_examples/v3.0/recursion.yaml @@ -0,0 +1,33 @@ +components: + schemas: + Bar: + properties: + baz: + $ref: '#/components/schemas/Baz' + type: object + Baz: + properties: + bar: + $ref: '#/components/schemas/Bar' + type: object + Foo: + properties: + foo: + $ref: '#/components/schemas/Foo' + type: object +info: + description: Test + title: OpenAPI + version: 1.0.0 +openapi: 3.0.0 +paths: + /foo: + post: + description: '' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Foo' + description: Response diff --git a/test/oas_examples/v3.0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml b/test/oas_examples/v3.0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml new file mode 100644 index 0000000..1f07e4c --- /dev/null +++ b/test/oas_examples/v3.0/removeAnyOfOneOfAndKeepPropertiesOnly_test.yaml @@ -0,0 +1,49 @@ +components: + schemas: + Person: + anyOf: + - required: + - specialName + - required: + - hiddenName + description: person using anyOf with required properties + properties: + firstName: + type: string + hiddenName: + type: string + id: + type: string + lastName: + type: string + nickName: + type: string + specialName: + type: string + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/required-and-readonly-property.yaml b/test/oas_examples/v3.0/required-and-readonly-property.yaml new file mode 100644 index 0000000..66f8f64 --- /dev/null +++ b/test/oas_examples/v3.0/required-and-readonly-property.yaml @@ -0,0 +1,35 @@ +components: + schemas: + ReadonlyAndRequiredProperties: + properties: + requiredNoReadonlyNo: + type: string + requiredNoReadonlyYes: + readOnly: true + type: string + requiredYesReadonlyNo: + type: string + requiredYesReadonlyYes: + readOnly: true + type: string + required: + - requiredYesReadonlyYes + - requiredYesReadonlyNo + type: object +info: + description: Title + title: Title + version: 1.0.0 +openapi: 3.0.3 +paths: + /user: + get: + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ReadonlyAndRequiredProperties' + description: success +servers: +- url: https diff --git a/test/oas_examples/v3.0/reserved_words.yaml b/test/oas_examples/v3.0/reserved_words.yaml new file mode 100644 index 0000000..103b6dc --- /dev/null +++ b/test/oas_examples/v3.0/reserved_words.yaml @@ -0,0 +1,520 @@ +components: + schemas: + Good: + description: OK, Good + properties: + annotation: + type: string + as: + type: string + break: + type: string + class: + type: string + continue: + type: string + do: + type: string + else: + type: string + false: + type: string + for: + type: string + fun: + type: string + if: + type: string + in: + type: string + interface: + type: string + is: + type: string + null: + type: string + object: + type: string + package: + type: string + return: + type: string + super: + type: string + this: + type: string + throw: + type: string + true: + type: string + try: + type: string + typealias: + type: string + typeof: + type: string + val: + type: string + value: + type: string + var: + type: string + when: + type: string + while: + type: string + open: + type: string + external: + type: string + internal: + type: string + linked: + $ref: '#/components/schemas/Linked' + type: object + Linked: + description: Reference links + properties: + annotation: + $ref: '#/components/schemas/annotation' + as: + $ref: '#/components/schemas/as' + break: + $ref: '#/components/schemas/break' + class: + $ref: '#/components/schemas/class' + continue: + $ref: '#/components/schemas/continue' + do: + $ref: '#/components/schemas/do' + else: + $ref: '#/components/schemas/else' + false: + $ref: '#/components/schemas/false' + for: + $ref: '#/components/schemas/for' + fun: + $ref: '#/components/schemas/fun' + if: + $ref: '#/components/schemas/if' + in: + $ref: '#/components/schemas/in' + interface: + $ref: '#/components/schemas/interface' + is: + $ref: '#/components/schemas/is' + null: + $ref: '#/components/schemas/null' + object: + $ref: '#/components/schemas/object' + package: + $ref: '#/components/schemas/package' + return: + $ref: '#/components/schemas/return' + super: + $ref: '#/components/schemas/super' + this: + $ref: '#/components/schemas/this' + throw: + $ref: '#/components/schemas/throw' + true: + $ref: '#/components/schemas/true' + try: + $ref: '#/components/schemas/try' + typealias: + $ref: '#/components/schemas/typealias' + typeof: + $ref: '#/components/schemas/typeof' + val: + $ref: '#/components/schemas/val' + value: + $ref: '#/components/schemas/value' + var: + $ref: '#/components/schemas/var' + when: + $ref: '#/components/schemas/when' + while: + $ref: '#/components/schemas/while' + open: + $ref: '#/components/schemas/open' + external: + $ref: '#/components/schemas/external' + internal: + $ref: '#/components/schemas/internal' + type: object + annotation: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'annotation' + type: object + as: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'as' + type: object + break: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'break' + type: object + class: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'class' + type: object + continue: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'continue' + type: object + do: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'do' + type: object + else: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'else' + type: object + false: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'false' + type: object + for: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'for' + type: object + fun: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'fun' + type: object + if: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'if' + type: object + in: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'in' + type: object + interface: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'interface' + type: object + is: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'is' + type: object + null: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'null' + type: object + object: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'object' + type: object + package: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'package' + type: object + return: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'return' + type: object + super: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'super' + type: object + this: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'this' + type: object + throw: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'throw' + type: object + true: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'true' + type: object + try: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'try' + type: object + typealias: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'typealias' + type: object + typeof: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'typeof' + type: object + val: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'val' + type: object + value: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'value' + type: object + var: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'var' + type: object + when: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'when' + type: object + while: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'while' + type: object + open: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'open' + type: object + external: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'external' + type: object + internal: + properties: + id: + format: int64 + type: integer + title: Testing reserved word 'internal' + type: object +info: + title: Test for Kotlin reserved words + version: 1.0.0 +openapi: 3.0.1 +paths: + /ping: + get: + description: Pingy Ping + parameters: + - in: header + name: annotation + schema: + type: string + - in: header + name: as + schema: + type: string + - in: header + name: break + schema: + type: string + - in: header + name: class + schema: + type: string + - in: header + name: continue + schema: + type: string + - in: header + name: do + schema: + type: string + - in: header + name: else + schema: + type: string + - in: header + name: 'false' + schema: + type: string + - in: header + name: for + schema: + type: string + - in: header + name: fun + schema: + type: string + - in: header + name: if + schema: + type: string + - in: header + name: in + schema: + type: string + - in: header + name: interface + schema: + type: string + - in: header + name: is + schema: + type: string + - in: header + name: 'null' + schema: + type: string + - in: header + name: object + schema: + type: string + - in: header + name: package + schema: + type: string + - in: header + name: return + schema: + type: string + - in: header + name: super + schema: + type: string + - in: header + name: this + schema: + type: string + - in: header + name: throw + schema: + type: string + - in: header + name: 'true' + schema: + type: string + - in: header + name: try + schema: + type: string + - in: header + name: typealias + schema: + type: string + - in: header + name: typeof + schema: + type: string + - in: header + name: val + schema: + type: string + - in: header + name: value + schema: + type: string + - in: header + name: var + schema: + type: string + - in: header + name: when + schema: + type: string + - in: header + name: while + schema: + type: string + - in: header + name: open + schema: + type: string + - in: header + name: external + schema: + type: string + - in: header + name: internal + schema: + type: string + responses: + '200': + $ref: '#/components/schemas/Good' + summary: Ping diff --git a/test/oas_examples/v3.0/resources__openapi.yaml b/test/oas_examples/v3.0/resources__openapi.yaml new file mode 100644 index 0000000..6713bdb --- /dev/null +++ b/test/oas_examples/v3.0/resources__openapi.yaml @@ -0,0 +1,2390 @@ +components: + requestBodies: + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + 200_response: + description: Model for testing model name starting with number + properties: + class: + type: string + name: + format: int32 + type: integer + xml: + name: Name + AdditionalPropertiesAnyType: + additionalProperties: + type: object + properties: + name: + type: string + type: object + AdditionalPropertiesArray: + additionalProperties: + items: + type: object + type: array + properties: + name: + type: string + type: object + AdditionalPropertiesBoolean: + additionalProperties: + type: boolean + properties: + name: + type: string + type: object + AdditionalPropertiesClass: + properties: + anytype_1: + type: object + anytype_2: {} + anytype_3: + properties: {} + type: object + map_array_anytype: + additionalProperties: + items: + type: object + type: array + type: object + map_array_integer: + additionalProperties: + items: + type: integer + type: array + type: object + map_boolean: + additionalProperties: + type: boolean + type: object + map_integer: + additionalProperties: + type: integer + type: object + map_map_anytype: + additionalProperties: + additionalProperties: + type: object + type: object + type: object + map_map_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_number: + additionalProperties: + type: number + type: object + map_string: + additionalProperties: + type: string + type: object + type: object + AdditionalPropertiesInteger: + additionalProperties: + type: integer + properties: + name: + type: string + type: object + AdditionalPropertiesNumber: + additionalProperties: + type: number + properties: + name: + type: string + type: object + AdditionalPropertiesObject: + additionalProperties: + additionalProperties: + type: object + type: object + properties: + name: + type: string + type: object + AdditionalPropertiesString: + additionalProperties: + type: string + properties: + name: + type: string + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + ApiResponse: + example: + code: 0 + message: message + type: type + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayTest: + properties: + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + array_of_string: + items: + type: string + type: array + type: object + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string + type: object + Capitalization: + properties: + ATT_NAME: + description: 'Name of the pet + + ' + type: string + CapitalCamel: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + smallCamel: + type: string + small_Snake: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + Category: + example: + id: 6 + name: default-name + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + ChildWithNullable: + allOf: + - $ref: '#/components/schemas/ParentWithNullable' + - properties: + otherProperty: + type: string + type: object + example: + nullableProperty: nullableProperty + otherProperty: otherProperty + type: ChildWithNullable + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Client: + example: + client: client + properties: + client: + type: string + type: object + ContainerDefaultValue: + properties: + nullable_array: + items: + type: string + nullable: true + type: array + nullable_array_with_default: + default: + - foo + - bar + items: + type: string + nullable: true + type: array + nullable_required_array: + items: + type: string + nullable: true + type: array + required_array: + items: + type: string + nullable: false + type: array + required: + - nullable_required_array + - required_array + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + EnumArrays: + properties: + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + just_symbol: + enum: + - '>=' + - $ + type: string + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + enum_string: + enum: + - UPPER + - lower + - '' + type: string + enum_string_required: + enum: + - UPPER + - lower + - '' + type: string + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + List: + properties: + 123-list: + type: string + type: object + MapTest: + properties: + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + uuid: + format: uuid + type: string + type: object + Name: + description: Model for testing model name same as property name + properties: + 123Number: + readOnly: true + type: integer + name: + format: int32 + type: integer + property: + type: string + snake_case: + format: int32 + readOnly: true + type: integer + required: + - name + xml: + name: Name + NullableMapProperty: + properties: + languageValues: + additionalProperties: + type: string + nullable: true + type: object + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + Order: + example: + complete: false + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23 04:56:07+00:00 + status: placed + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + type: object + xml: + name: Order + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + OuterComposite: + example: + my_boolean: true + my_number: 0.8008281904610115 + my_string: my_string + properties: + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + my_number: + type: number + my_string: + type: string + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + OuterNumber: + type: number + OuterString: + type: string + ParentWithNullable: + discriminator: + propertyName: type + properties: + nullableProperty: + nullable: true + type: string + type: + enum: + - ChildWithNullable + type: string + type: object + Pet: + example: + category: + id: 6 + name: default-name + id: 0 + name: doggie + photoUrls: + - photoUrls + - photoUrls + status: available + tags: + - id: 1 + name: name + - id: 1 + name: name + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + x-is-unique: true + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + uniqueItems: true + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + type: object + xml: + name: Pet + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + ResponseObjectWithDifferentFieldNames: + example: + UPPER_CASE_PROPERTY_SNAKE: UPPER_CASE_PROPERTY_SNAKE + lower-case-property-dashes: lower-case-property-dashes + normalPropertyName: normalPropertyName + property name with spaces: property name with spaces + properties: + UPPER_CASE_PROPERTY_SNAKE: + type: string + lower-case-property-dashes: + type: string + normalPropertyName: + type: string + property name with spaces: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + StringBooleanMap: + additionalProperties: + type: boolean + type: object + Tag: + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + TypeHolderDefault: + properties: + array_item: + default: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + bool_item: + default: true + type: boolean + integer_item: + default: -2 + type: integer + number_item: + default: 1.234 + type: number + string_item: + default: what + type: string + required: + - array_item + - bool_item + - integer_item + - number_item + - string_item + type: object + TypeHolderExample: + properties: + array_item: + example: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + bool_item: + example: true + type: boolean + float_item: + example: 1.234 + format: float + type: number + integer_item: + example: -2 + type: integer + number_item: + example: 1.234 + type: number + string_item: + example: what + type: string + required: + - array_item + - bool_item + - float_item + - integer_item + - number_item + - string_item + type: object + User: + example: + email: email + firstName: firstName + id: 0 + lastName: lastName + password: password + phone: phone + userStatus: 6 + username: username + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + x-is-unique: true + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + type: object + xml: + name: User + XmlItem: + properties: + attribute_boolean: + example: true + type: boolean + xml: + attribute: true + attribute_integer: + example: -2 + type: integer + xml: + attribute: true + attribute_number: + example: 1.234 + type: number + xml: + attribute: true + attribute_string: + example: string + type: string + xml: + attribute: true + name_array: + items: + type: integer + xml: + name: xml_name_array_item + type: array + name_boolean: + example: true + type: boolean + xml: + name: xml_name_boolean + name_integer: + example: -2 + type: integer + xml: + name: xml_name_integer + name_number: + example: 1.234 + type: number + xml: + name: xml_name_number + name_string: + example: string + type: string + xml: + name: xml_name_string + name_wrapped_array: + items: + type: integer + xml: + name: xml_name_wrapped_array_item + type: array + xml: + name: xml_name_wrapped_array + wrapped: true + namespace_array: + items: + type: integer + xml: + namespace: http://e.com/schema + type: array + namespace_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + namespace_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + namespace_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + namespace_string: + example: string + type: string + xml: + namespace: http://a.com/schema + namespace_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + type: array + xml: + namespace: http://f.com/schema + wrapped: true + prefix_array: + items: + type: integer + xml: + prefix: ij + type: array + prefix_boolean: + example: true + type: boolean + xml: + prefix: gh + prefix_integer: + example: -2 + type: integer + xml: + prefix: ef + prefix_ns_array: + items: + type: integer + xml: + namespace: http://e.com/schema + prefix: e + type: array + prefix_ns_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + prefix: d + prefix_ns_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + prefix: c + prefix_ns_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + prefix: b + prefix_ns_string: + example: string + type: string + xml: + namespace: http://a.com/schema + prefix: a + prefix_ns_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + prefix: g + type: array + xml: + namespace: http://f.com/schema + prefix: f + wrapped: true + prefix_number: + example: 1.234 + type: number + xml: + prefix: cd + prefix_string: + example: string + type: string + xml: + prefix: ab + prefix_wrapped_array: + items: + type: integer + xml: + prefix: mn + type: array + xml: + prefix: kl + wrapped: true + wrapped_array: + items: + type: integer + type: array + xml: + wrapped: true + type: object + xml: + namespace: http://a.com/schema + prefix: pre + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: $special[model.name] + format_test: + properties: + BigDecimal: + format: number + type: string + binary: + format: binary + type: string + byte: + format: byte + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + integer: + maximum: 100 + minimum: 10 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + password: + format: password + maxLength: 64 + minLength: 10 + type: string + string: + pattern: /[a-z]/i + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + required: + - byte + - date + - number + - password + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + testEndpointParameters_request: + properties: + binary: + description: None + format: binary + type: string + byte: + description: None + format: byte + type: string + callback: + description: None + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + string: + description: None + pattern: /[a-z]/i + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + type: object + testEnumParameters_request: + properties: + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + type: object + testJsonFormData_request: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + updatePetWithForm_request: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + uploadFileWithRequiredFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + uploadFile_request: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: $another-fake? + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + explode: true + in: query + name: required_string_group + required: true + schema: + type: integer + style: form + - description: Required Boolean in group parameters + explode: false + in: header + name: required_boolean_group + required: true + schema: + type: boolean + style: simple + - description: Required Integer in group parameters + explode: true + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + style: form + - description: String in group parameters + explode: true + in: query + name: string_group + required: false + schema: + type: integer + style: form + - description: Boolean in group parameters + explode: false + in: header + name: boolean_group + required: false + schema: + type: boolean + style: simple + - description: Integer in group parameters + explode: true + in: query + name: int64_group + required: false + schema: + format: int64 + type: integer + style: form + responses: + '400': + description: Something wrong + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-accepts: application/json + x-group-parameters: true + x-tags: + - tag: fake + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + explode: false + in: header + name: enum_header_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: simple + - description: Header parameter enum test (string) + explode: false + in: header + name: enum_header_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: simple + - description: Query parameter enum test (string array) + explode: true + in: query + name: enum_query_string_array + required: false + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + style: form + - description: Query parameter enum test (string) + explode: true + in: query + name: enum_query_string + required: false + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_integer + required: false + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + style: form + - description: Query parameter enum test (double) + explode: true + in: query + name: enum_query_double + required: false + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + style: form + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEnumParameters_request' + responses: + '400': + description: Invalid request + '404': + description: Not found + summary: To test enum parameters + tags: + - fake + x-accepts: application/json + x-content-type: application/x-www-form-urlencoded + x-tags: + - tag: fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: fake + post: + description: "Fake endpoint for testing various parameters\n 假端點\n 偽のエンドポイント\n\ + \ 가짜 엔드 포인트" + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testEndpointParameters_request' + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - http_basic_test: [] + summary: "Fake endpoint for testing various parameters\n 假端點\n 偽のエンドポイント\n 가짜\ + \ 엔드 포인트" + tags: + - fake + x-accepts: application/json + x-content-type: application/x-www-form-urlencoded + x-tags: + - tag: fake + /fake/body-with-file-schema: + put: + description: For this test, the body for this request much reference a schema + named `File`. + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + '200': + description: Success + tags: + - fake + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - explode: true + in: query + name: query + required: true + schema: + type: string + style: form + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + '200': + description: Success + tags: + - fake + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: fake + /fake/create_xml_item: + post: + description: this route creates an XmlItem + operationId: createXmlItem + requestBody: + content: + application/xml: + schema: + $ref: '#/components/schemas/XmlItem' + application/xml; charset=utf-16: + schema: + $ref: '#/components/schemas/XmlItem' + application/xml; charset=utf-8: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml; charset=utf-16: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml; charset=utf-8: + schema: + $ref: '#/components/schemas/XmlItem' + description: XmlItem Body + required: true + responses: + '200': + description: successful operation + summary: creates an XmlItem + tags: + - fake + x-accepts: application/json + x-content-type: application/xml + x-tags: + - tag: fake + /fake/inline-additionalProperties: + post: + description: '' + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + '200': + description: successful operation + summary: test inline additionalProperties + tags: + - fake + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: fake + /fake/jsonFormData: + get: + description: '' + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/testJsonFormData_request' + responses: + '200': + description: successful operation + summary: test json serialization of form data + tags: + - fake + x-accepts: application/json + x-content-type: application/x-www-form-urlencoded + x-tags: + - tag: fake + /fake/nullable: + post: + description: '' + operationId: testNullable + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChildWithNullable' + description: request body + required: true + responses: + '200': + description: successful operation + summary: test nullable parent property + tags: + - fake + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + x-accepts: '*/*' + x-content-type: application/json + x-tags: + - tag: fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + x-accepts: '*/*' + x-content-type: application/json + x-tags: + - tag: fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + x-accepts: '*/*' + x-content-type: application/json + x-tags: + - tag: fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + x-accepts: '*/*' + x-content-type: application/json + x-tags: + - tag: fake + /fake/response-with-example: + get: + description: This endpoint defines an example value for its response schema. + operationId: testWithResultExample + responses: + '200': + content: + application/json: + schema: + example: 42 + type: integer + description: Success + tags: + - fake + x-accepts: application/json + x-tags: + - tag: fake + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - explode: true + in: query + name: pipe + required: true + schema: + items: + type: string + type: array + style: form + - explode: false + in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + description: Success + tags: + - fake + x-accepts: application/json + x-tags: + - tag: fake + /fake/{petId}/response-object-different-names: + get: + operationId: responseObjectDifferentNames + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseObjectWithDifferentFieldNames' + description: successful operation + tags: + - pet + x-accepts: application/json + x-tags: + - tag: pet + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: '' + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFileWithRequiredFile_request' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + x-accepts: application/json + x-content-type: multipart/form-data + x-tags: + - tag: pet + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: fake_classname_tags 123#$%^ + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-accepts: application/json,application/xml + x-tags: + - tag: pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + uniqueItems: true + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + uniqueItems: true + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-accepts: application/json,application/xml + x-tags: + - tag: pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + '200': + description: successful operation + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + x-accepts: application/json + x-tags: + - tag: pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-accepts: application/json,application/xml + x-tags: + - tag: pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/updatePetWithForm_request' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-accepts: application/json + x-content-type: application/x-www-form-urlencoded + x-tags: + - tag: pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/uploadFile_request' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + x-accepts: application/json + x-content-type: multipart/form-data + x-tags: + - tag: pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + x-accepts: application/json + x-tags: + - tag: store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-accepts: application/json,application/xml + x-content-type: application/json + x-tags: + - tag: store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: order_id + required: true + schema: + type: string + style: simple + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-accepts: application/json + x-tags: + - tag: store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + x-accepts: application/json,application/xml + x-tags: + - tag: store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + x-accepts: application/json,application/xml + x-tags: + - tag: user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + x-accepts: application/json + x-tags: + - tag: user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Delete user + tags: + - user + x-accepts: application/json + x-tags: + - tag: user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + x-accepts: application/json,application/xml + x-tags: + - tag: user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + summary: Updated user + tags: + - user + x-accepts: application/json + x-content-type: application/json + x-tags: + - tag: user +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/response-tests.yaml b/test/oas_examples/v3.0/response-tests.yaml new file mode 100644 index 0000000..1e09038 --- /dev/null +++ b/test/oas_examples/v3.0/response-tests.yaml @@ -0,0 +1,566 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '500': + content: + application/application: + schema: + $ref: '#/components/schemas/ApiResponse' + description: Server error + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + '500': + description: Server error + summary: Find purchase order by ID + tags: + - store + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/rootOperation.yaml b/test/oas_examples/v3.0/rootOperation.yaml new file mode 100644 index 0000000..4c24d8d --- /dev/null +++ b/test/oas_examples/v3.0/rootOperation.yaml @@ -0,0 +1,11 @@ +info: + title: Root Operation + version: 1.0.0 +openapi: 3.0.0 +paths: + /: + get: + responses: + 204: + description: No response body + summary: Simple root endpoint diff --git a/test/oas_examples/v3.0/ruby-sinatra__openapi.yaml b/test/oas_examples/v3.0/ruby-sinatra__openapi.yaml new file mode 100644 index 0000000..9055f34 --- /dev/null +++ b/test/oas_examples/v3.0/ruby-sinatra__openapi.yaml @@ -0,0 +1,822 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + inline_object: + content: + application/x-www-form-urlencoded: + schema: + $ref: '#/components/schemas/inline_object' + inline_object_1: + content: + multipart/form-data: + schema: + $ref: '#/components/schemas/inline_object_1' + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + message: message + type: type + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + example: + id: 6 + name: name + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + example: + complete: false + id: 0 + petId: 6 + quantity: 1 + shipDate: 2000-01-23 04:56:07+00:00 + status: placed + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + example: + category: + id: 6 + name: name + id: 0 + name: doggie + photoUrls: + - photoUrls + - photoUrls + status: available + tags: + - id: 1 + name: name + - id: 1 + name: name + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + example: + id: 1 + name: name + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + example: + email: email + firstName: firstName + id: 0 + lastName: lastName + password: password + phone: phone + userStatus: 6 + username: username + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + inline_object: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + inline_object_1: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - explode: false + in: header + name: api_key + required: false + schema: + type: string + style: simple + - description: Pet id to delete + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object' + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + explode: false + in: path + name: petId + required: true + schema: + format: int64 + type: integer + style: simple + requestBody: + $ref: '#/components/requestBodies/inline_object_1' + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + explode: false + in: path + name: orderId + required: true + schema: + type: string + style: simple + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + explode: false + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + explode: true + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + style: form + - description: The password for login in clear text + explode: true + in: query + name: password + required: true + schema: + type: string + style: form + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + explode: false + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + style: simple + X-Expires-After: + description: date in UTC when token expires + explode: false + schema: + format: date-time + type: string + style: simple + X-Rate-Limit: + description: calls per hour allowed by the user + explode: false + schema: + format: int32 + type: integer + style: simple + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + explode: false + in: path + name: username + required: true + schema: + type: string + style: simple + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/rust-name-mapping-test.yaml b/test/oas_examples/v3.0/rust-name-mapping-test.yaml new file mode 100644 index 0000000..0652457 --- /dev/null +++ b/test/oas_examples/v3.0/rust-name-mapping-test.yaml @@ -0,0 +1,66 @@ +components: + schemas: + PropertyNameMapping: + properties: + -type: + type: string + _type: + type: string + http_debug_operation: + type: string + type: + type: string + type_: + type: string +info: + description: rust name mapping test + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: rust test + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + in: header + name: _type + required: true + schema: + format: int64 + type: integer + - description: type + in: query + name: type + required: true + schema: + type: string + - description: type_ + in: header + name: type_ + required: true + schema: + type: string + - description: -type + in: header + name: -type + required: true + schema: + type: string + - description: http debug option (to test parameter naming option) + in: query + name: http_debug_option + required: true + schema: + type: string + responses: + 200: + description: OK + summary: parameter name mapping test + tags: + - fake +servers: +- url: http://petstore.swagger.io/v2 diff --git a/test/oas_examples/v3.0/rust__petstore.yaml b/test/oas_examples/v3.0/rust__petstore.yaml new file mode 100644 index 0000000..cada88b --- /dev/null +++ b/test/oas_examples/v3.0/rust__petstore.yaml @@ -0,0 +1,955 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ActionContainer: + properties: + action: + allOf: + - $ref: '#/components/schemas/Baz' + - nullable: false + required: + - action + type: object + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + ArrayItemRefTest: + description: Test handling of object reference in arrays + properties: + list_with_array_ref: + items: + $ref: '#/components/schemas/ArrayRefItem' + type: array + list_with_object_ref: + items: + $ref: '#/components/schemas/ObjectRefItem' + type: array + required: + - list_with_array_ref + - list_with_object_ref + type: object + ArrayRefItem: + description: Helper object for the array item ref test + items: + type: string + type: array + Baz: + description: Test handling of empty variants + enum: + - A + - B + - '' + type: string + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + EnumArrayTesting: + description: Test of enum array + properties: + required_enums: + items: + enum: + - A + - B + - C + type: string + type: array + required: + - required_enums + type: object + NullableArray: + properties: + array_nullable: + items: + type: string + nullable: true + type: array + just_array: + items: + type: string + type: array + just_string: + type: string + nullable_string: + nullable: true + type: string + type: object + ObjectRefItem: + additionalProperties: true + description: Helper object for the array item ref test + type: object + OptionalTesting: + description: Test handling of optional and nullable fields + properties: + optional_nonnull: + nullable: false + type: string + optional_nullable: + nullable: true + type: string + required_nonnull: + nullable: false + type: string + required_nullable: + nullable: true + type: string + required: + - required_nonnull + - required_nullable + type: object + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + minimum: 0 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + minimum: 0 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Return: + description: Test using keywords + properties: + async: + type: boolean + match: + type: integer + super: + type: boolean + type: object + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + TypeTesting: + description: Test handling of different field data types + properties: + boolean: + type: boolean + double: + format: double + type: number + float: + format: float + type: number + int32: + format: int32 + type: integer + int64: + format: int64 + type: integer + string: + type: string + uuid: + format: uuid + type: string + required: + - int32 + - int64 + - float + - double + - string + - boolean + - uuid + type: object + UniqueItemArrayTesting: + description: Test handling of enum array with unique items + properties: + unique_item_array: + description: Helper object for the unique item array test + items: + enum: + - unique_item_1 + - unique_item_2 + - unique_item_3 + type: string + type: array + uniqueItems: true + required: + - unique_item_array + type: object + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + minLength: 1 + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + maxLength: 90 + minLength: 1 + pattern: ^[a-z][-a-z0-9]*$ + type: string + required: + - username + - lastName + title: a User + type: object + xml: + name: User + property_test: + description: A model to test various formats, e.g. UUID + properties: + uuid: + format: uuid + type: string + title: A model to test various formats, e.g. UUID + type: object + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/user/{username}: + get: + description: '' + operationId: test_nullable_required_param + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + - description: To test nullable required parameters + in: header + name: dummy_required_nullable_param + required: true + schema: + nullable: true + type: string + - description: To test parameter names in upper case + in: header + name: UPPERCASE + schema: + type: string + responses: + '200': + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: To test nullable required parameters + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /tests/fileResponse: + get: + responses: + '200': + content: + image/jpeg: + schema: + format: binary + type: string + description: An image file + summary: Returns an image file + tags: + - testing + /tests/typeTesting: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TypeTesting' + description: The TypeTesting response + summary: Route to test the TypeTesting schema + tags: + - testing + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/scala-akka__petstore.yaml b/test/oas_examples/v3.0/scala-akka__petstore.yaml new file mode 100644 index 0000000..70122a0 --- /dev/null +++ b/test/oas_examples/v3.0/scala-akka__petstore.yaml @@ -0,0 +1,737 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + auth_cookie: + in: cookie + name: AUTH_KEY + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '200': + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/scala-pekko__petstore.yaml b/test/oas_examples/v3.0/scala-pekko__petstore.yaml new file mode 100644 index 0000000..e80f357 --- /dev/null +++ b/test/oas_examples/v3.0/scala-pekko__petstore.yaml @@ -0,0 +1,737 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + auth_cookie: + in: cookie + name: AUTH_KEY + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '200': + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `auth_cookie` + apiKey authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - auth_cookie: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - auth_cookie: [] + summary: Updated user + tags: + - user +servers: +- url: https://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/scala__petstore.yaml b/test/oas_examples/v3.0/scala__petstore.yaml new file mode 100644 index 0000000..e4a5c39 --- /dev/null +++ b/test/oas_examples/v3.0/scala__petstore.yaml @@ -0,0 +1,800 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + EnumTest: + properties: + emails: + items: + type: string + type: array + search: + enum: + - first_name + - last_name + - email + - full_name + type: string + sort_by: + items: + enum: + - first_name + - last_name + - email + type: string + type: array + type: object + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + PropertyNameMapping: + properties: + _type: + type: string + http_debug_operation: + type: string + type: + type: string + type_: + type: string + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/parameter-name-mapping: + get: + operationId: getParameterNameMapping + parameters: + - description: _type + in: header + name: _type + required: true + schema: + format: int64 + type: integer + - description: type + in: query + name: type + required: true + schema: + type: string + - description: type_ + in: header + name: type_ + required: true + schema: + type: string + - description: http debug option (to test parameter naming option) + in: query + name: http_debug_option + required: true + schema: + type: string + responses: + 200: + description: OK + summary: parameter name mapping test + tags: + - fake + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/scala_reserved_words.yaml b/test/oas_examples/v3.0/scala_reserved_words.yaml new file mode 100644 index 0000000..943df7d --- /dev/null +++ b/test/oas_examples/v3.0/scala_reserved_words.yaml @@ -0,0 +1,86 @@ +components: + schemas: + SomeObj: + properties: + $_type: + default: SomeObjIdentifier + enum: + - SomeObjIdentifier + type: string + case: + type: string + catch: + type: string + class: + type: string + created_at: + format: date-time + type: string + def: + type: string + finally: + type: string + foobar: + type: boolean + for: + type: string + id: + format: int64 + type: integer + implicit: + type: string + import: + type: string + lazy: + type: string + match: + type: string + name: + type: string + object: + type: string + private: + type: string + trait: + type: string + try: + type: string + type: + type: string + val: + type: string + var: + type: string + required: + - id + - try + - catch + - finally + - lazy + - foobar + - created_at + type: object +info: + title: ping some object + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + post: + operationId: postPing + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SomeObj' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SomeObj' + description: OK + tags: + - ping +servers: +- url: http://localhost:8082/ diff --git a/test/oas_examples/v3.0/schema-with-nullable-arrays.yaml b/test/oas_examples/v3.0/schema-with-nullable-arrays.yaml new file mode 100644 index 0000000..a3795b7 --- /dev/null +++ b/test/oas_examples/v3.0/schema-with-nullable-arrays.yaml @@ -0,0 +1,43 @@ +components: + schemas: + ByteArrayObject: + properties: + intField: + format: int32 + type: number + normalArray: + description: byte array. + format: byte + type: string + nullableArray: + description: byte array. + format: byte + nullable: true + type: string + nullableString: + nullable: true + type: string + stringField: + type: string + type: object +info: + description: byte Array error in equal method + title: 'Minimal Example ' + version: v1 +openapi: 3.0.0 +paths: + /nullable-array-test: + get: + description: '' + operationId: '' + parameters: [] + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/ByteArrayObject' + type: array + description: '' + summary: '' diff --git a/test/oas_examples/v3.0/schema-with-special-characters.yaml b/test/oas_examples/v3.0/schema-with-special-characters.yaml new file mode 100644 index 0000000..a7ca8dd --- /dev/null +++ b/test/oas_examples/v3.0/schema-with-special-characters.yaml @@ -0,0 +1,46 @@ +components: + schemas: + ChildSchema: + allOf: + - $ref: '#/components/schemas/Parent' + - properties: + prop1: + type: string + type: object + description: A schema that does not have any special character. + MySchemaName._-Characters: + allOf: + - $ref: '#/components/schemas/Parent' + - properties: + prop2: + type: string + type: object + description: A schema name that has letters, numbers, punctuation and non-ASCII + characters. The sanitization rules should make it possible to generate a language-specific + classname with allowed characters in that programming language. + Parent: + discriminator: + propertyName: objectType + properties: + objectType: + type: string +info: + description: test + title: test + version: 1.0.0 +openapi: 3.0.3 +paths: + /test: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MySchemaName._-Characters' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/MySchemaName._-Characters' + description: the response diff --git a/test/oas_examples/v3.0/schema.yaml b/test/oas_examples/v3.0/schema.yaml new file mode 100644 index 0000000..29069f7 --- /dev/null +++ b/test/oas_examples/v3.0/schema.yaml @@ -0,0 +1,70 @@ +components: + schemas: + Misc: + description: Schema tests + properties: + anyof1: + anyOf: + - type: number + - type: string + anyof2: + anyOf: + - type: string + - items: + type: string + type: array + free_form_object_1: + type: object + free_form_object_2: + additionalProperties: true + type: object + free_form_object_3: + additionalProperties: {} + type: object + map1: + additionalProperties: + type: string + type: object + oneof1: + oneOf: + - type: string + - type: integer + type: object + anyof1: + anyOf: + - type: string + - type: number +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /dummy: + post: + description: '' + operationId: dummy_operation + responses: + '200': + description: successful operation + '405': + description: Invalid input + summary: dummy operation + tags: + - dummy +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/simplifyAnyOfStringAndEnumString_test.yaml b/test/oas_examples/v3.0/simplifyAnyOfStringAndEnumString_test.yaml new file mode 100644 index 0000000..9d668f7 --- /dev/null +++ b/test/oas_examples/v3.0/simplifyAnyOfStringAndEnumString_test.yaml @@ -0,0 +1,45 @@ +components: + schemas: + AnyOfTest: + anyOf: + - type: string + - $ref: '#/components/schemas/EnumString' + description: to test anyOf (string, enum string) + EnumString: + enum: + - A + - B + type: string + SingleAnyOfTest: + anyOf: + - enum: + - A + - B + type: string + description: to test anyOf (enum string only) +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AnyOfTest' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/simplifyBooleanEnum_test.yaml b/test/oas_examples/v3.0/simplifyBooleanEnum_test.yaml new file mode 100644 index 0000000..3986e2f --- /dev/null +++ b/test/oas_examples/v3.0/simplifyBooleanEnum_test.yaml @@ -0,0 +1,61 @@ +components: + schemas: + BooleanEnumTest: + description: a model to with boolean enum property + properties: + boolean_enum: + enum: + - true + - false + type: boolean + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + type: object + ComposedSchemaBooleanEnumTest: + description: a model to with boolean enum property + oneOf: + - type: string + - type: integer + properties: + boolean_enum: + enum: + - true + - false + type: boolean + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/BooleanEnumTest' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/skip-default-interface.yaml b/test/oas_examples/v3.0/skip-default-interface.yaml new file mode 100644 index 0000000..70c2094 --- /dev/null +++ b/test/oas_examples/v3.0/skip-default-interface.yaml @@ -0,0 +1,11 @@ +info: + title: test + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + operationId: ping + responses: + 200: + description: OK diff --git a/test/oas_examples/v3.0/spec-with-oneof-anyof-required.yaml b/test/oas_examples/v3.0/spec-with-oneof-anyof-required.yaml new file mode 100644 index 0000000..5d91a5b --- /dev/null +++ b/test/oas_examples/v3.0/spec-with-oneof-anyof-required.yaml @@ -0,0 +1,31 @@ +components: + schemas: + NestedObject1: + properties: + field1: + description: Specifies an action name to be used with the Android Intent + class. + type: string + required: + - field1 + NestedObject2: + properties: + field2: + description: Specifies an action name to be used with the Android Intent + class. + type: string + required: + - field2 + Object: + oneOf: + - $ref: '#/components/schemas/NestedObject1' + - $ref: '#/components/schemas/NestedObject2' + Object2: + anyOf: + - $ref: '#/components/schemas/NestedObject1' + - $ref: '#/components/schemas/NestedObject2' +info: + title: Test + version: 1.0.0 +openapi: 3.0.0 +paths: {} diff --git a/test/oas_examples/v3.0/spec1.yaml b/test/oas_examples/v3.0/spec1.yaml new file mode 100644 index 0000000..a5ccf20 --- /dev/null +++ b/test/oas_examples/v3.0/spec1.yaml @@ -0,0 +1,45 @@ +components: + schemas: + Spec1Model: + properties: + spec1Field: + type: string + type: object +info: + description: Specification to reproduce nullable issue with Array + title: ArrayNullableTest Api + version: 1.0.0 +openapi: 3.0.3 +paths: + /spec1: + get: + operationId: spec1Operation + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Spec1Model' + description: OK + summary: dummy + tags: + - spec1 + /spec1/complex/{param1}/path: + get: + operationId: spec1OperationComplex + parameters: + - in: path + name: param1 + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Spec1Model' + description: OK + summary: dummy + tags: + - spec1 diff --git a/test/oas_examples/v3.0/spec2.yaml b/test/oas_examples/v3.0/spec2.yaml new file mode 100644 index 0000000..2d63fc8 --- /dev/null +++ b/test/oas_examples/v3.0/spec2.yaml @@ -0,0 +1,26 @@ +components: + schemas: + Spec2Model: + properties: + spec2Field: + type: number + type: object +info: + description: Specification to reproduce nullable issue with Array + title: ArrayNullableTest Api + version: 1.0.0 +openapi: 3.0.3 +paths: + /spec2: + get: + operationId: spec2Operation + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Spec2Model' + description: OK + summary: dummy + tags: + - spec2 diff --git a/test/oas_examples/v3.0/specs__petstore-v3.0.yaml b/test/oas_examples/v3.0/specs__petstore-v3.0.yaml new file mode 100644 index 0000000..8da7af8 --- /dev/null +++ b/test/oas_examples/v3.0/specs__petstore-v3.0.yaml @@ -0,0 +1,109 @@ +components: + schemas: + Error: + properties: + code: + format: int32 + type: integer + message: + type: string + required: + - code + - message + Pet: + properties: + id: + format: int64 + type: integer + name: + type: string + tag: + type: string + required: + - id + - name + Pets: + items: + $ref: '#/components/schemas/Pet' + type: array +info: + license: + name: MIT + title: Swagger Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pets: + get: + operationId: listPets + parameters: + - description: How many items to return at one time (max 100) + in: query + name: limit + required: false + schema: + format: int32 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: A paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: List all pets + tags: + - pets + post: + operationId: createPets + responses: + '201': + description: Null response + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Create a pet + tags: + - pets + /pets/{petId}: + get: + operationId: showPetById + parameters: + - description: The id of the pet to retrieve + in: path + name: petId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: Expected response to a valid request + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Info for a specific pet + tags: + - pets +servers: +- url: http://petstore.swagger.io/v1 diff --git a/test/oas_examples/v3.0/specs__petstore.yaml b/test/oas_examples/v3.0/specs__petstore.yaml new file mode 100644 index 0000000..6d2d49d --- /dev/null +++ b/test/oas_examples/v3.0/specs__petstore.yaml @@ -0,0 +1,111 @@ +components: + schemas: + Error: + properties: + code: + format: int32 + type: integer + message: + type: string + required: + - code + - message + type: object + Pet: + properties: + id: + format: int64 + type: integer + name: + type: string + tag: + type: string + required: + - id + - name + type: object + Pets: + items: + $ref: '#/components/schemas/Pet' + type: array +info: + license: + name: MIT + title: Swagger Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pets: + get: + operationId: listPets + parameters: + - description: How many items to return at one time (max 100) + in: query + name: limit + required: false + schema: + format: int32 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: A paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: List all pets + tags: + - pets + post: + operationId: createPets + responses: + '201': + description: Null response + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Create a pet + tags: + - pets + /pets/{petId}: + get: + operationId: showPetById + parameters: + - description: The id of the pet to retrieve + in: path + name: petId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Expected response to a valid request + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Info for a specific pet + tags: + - pets +servers: +- url: http://petstore.swagger.io/v1 diff --git a/test/oas_examples/v3.0/spring__petstore-with-fake-endpoints-models-for-testing.yaml b/test/oas_examples/v3.0/spring__petstore-with-fake-endpoints-models-for-testing.yaml new file mode 100644 index 0000000..8681b8f --- /dev/null +++ b/test/oas_examples/v3.0/spring__petstore-with-fake-endpoints-models-for-testing.yaml @@ -0,0 +1,2094 @@ +components: + requestBodies: + Client: + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + 200_response: + description: Model for testing model name starting with number + properties: + class: + type: string + name: + format: int32 + type: integer + xml: + name: Name + AdditionalPropertiesAnyType: + additionalProperties: + type: object + properties: + name: + type: string + type: object + AdditionalPropertiesArray: + additionalProperties: + items: + type: object + type: array + properties: + name: + type: string + type: object + AdditionalPropertiesBoolean: + additionalProperties: + type: boolean + properties: + name: + type: string + type: object + AdditionalPropertiesClass: + properties: + anytype_1: + type: object + anytype_2: {} + anytype_3: + properties: {} + type: object + map_array_anytype: + additionalProperties: + items: + type: object + type: array + type: object + map_array_integer: + additionalProperties: + items: + type: integer + type: array + type: object + map_boolean: + additionalProperties: + type: boolean + type: object + map_integer: + additionalProperties: + type: integer + type: object + map_map_anytype: + additionalProperties: + additionalProperties: + type: object + type: object + type: object + map_map_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_number: + additionalProperties: + type: number + type: object + map_string: + additionalProperties: + type: string + type: object + type: object + AdditionalPropertiesInteger: + additionalProperties: + type: integer + properties: + name: + type: string + type: object + AdditionalPropertiesNumber: + additionalProperties: + type: number + properties: + name: + type: string + type: object + AdditionalPropertiesObject: + additionalProperties: + additionalProperties: + type: object + type: object + properties: + name: + type: string + type: object + AdditionalPropertiesString: + additionalProperties: + type: string + properties: + name: + type: string + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + ApiResponse: + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + ArrayTest: + properties: + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + array_of_string: + items: + type: string + type: array + type: object + BigCat: + allOf: + - $ref: '#/components/schemas/Cat' + - properties: + kind: + enum: + - lions + - tigers + - leopards + - jaguars + type: string + type: object + Capitalization: + properties: + ATT_NAME: + description: 'Name of the pet + + ' + type: string + CapitalCamel: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + smallCamel: + type: string + small_Snake: + type: string + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + Category: + properties: + id: + format: int64 + type: integer + name: + default: default-name + type: string + required: + - name + type: object + xml: + name: Category + ChildWithNullable: + allOf: + - $ref: '#/components/schemas/ParentWithNullable' + - properties: + otherProperty: + type: string + type: object + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + Client: + properties: + client: + type: string + type: object + ContainerDefaultValue: + properties: + nullable_array: + items: + type: string + nullable: true + type: array + nullable_array_with_default: + default: + - foo + - bar + items: + type: string + nullable: true + type: array + nullable_required_array: + items: + type: string + nullable: true + type: array + required_array: + items: + type: string + nullable: false + type: array + required: + - required_array + - nullable_required_array + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + EnumArrays: + properties: + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + just_symbol: + enum: + - '>=' + - $ + type: string + type: object + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + Enum_Test: + properties: + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + enum_string: + enum: + - UPPER + - lower + - '' + type: string + enum_string_required: + enum: + - UPPER + - lower + - '' + type: string + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + File: + description: Must be named `File` for test. + properties: + sourceURI: + description: Test capitalization + type: string + type: object + FileSchemaTestClass: + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + List: + properties: + 123-list: + type: string + type: object + MapTest: + properties: + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + $ref: '#/components/schemas/StringBooleanMap' + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + uuid: + format: uuid + type: string + type: object + Name: + description: Model for testing model name same as property name + properties: + 123Number: + readOnly: true + type: integer + name: + format: int32 + type: integer + property: + type: string + snake_case: + format: int32 + readOnly: true + type: integer + required: + - name + xml: + name: Name + NullableMapProperty: + properties: + languageValues: + additionalProperties: + type: string + nullable: true + type: object + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + Order: + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + type: object + xml: + name: Order + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + OuterComposite: + properties: + my_boolean: + $ref: '#/components/schemas/OuterBoolean' + my_number: + $ref: '#/components/schemas/OuterNumber' + my_string: + $ref: '#/components/schemas/OuterString' + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + OuterNumber: + type: number + OuterString: + type: string + ParentWithNullable: + discriminator: + propertyName: type + properties: + nullableProperty: + nullable: true + type: string + type: + enum: + - ChildWithNullable + type: string + type: object + Pet: + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + x-is-unique: true + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + uniqueItems: true + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + type: object + xml: + name: Pet + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + ResponseObjectWithDifferentFieldNames: + properties: + UPPER_CASE_PROPERTY_SNAKE: + type: string + lower-case-property-dashes: + type: string + normalPropertyName: + type: string + property name with spaces: + type: string + type: object + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + xml: + name: Return + StringBooleanMap: + additionalProperties: + type: boolean + Tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + TypeHolderDefault: + properties: + array_item: + default: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + bool_item: + default: true + type: boolean + integer_item: + default: -2 + type: integer + number_item: + default: 1.234 + type: number + string_item: + default: what + type: string + required: + - string_item + - number_item + - integer_item + - bool_item + - array_item + type: object + TypeHolderExample: + properties: + array_item: + example: + - 0 + - 1 + - 2 + - 3 + items: + type: integer + type: array + bool_item: + example: true + type: boolean + float_item: + example: 1.234 + format: float + type: number + integer_item: + example: -2 + type: integer + number_item: + example: 1.234 + type: number + string_item: + example: what + type: string + required: + - string_item + - number_item + - float_item + - integer_item + - bool_item + - array_item + type: object + User: + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + x-is-unique: true + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + type: object + xml: + name: User + XmlItem: + properties: + attribute_boolean: + example: true + type: boolean + xml: + attribute: true + attribute_integer: + example: -2 + type: integer + xml: + attribute: true + attribute_number: + example: 1.234 + type: number + xml: + attribute: true + attribute_string: + example: string + type: string + xml: + attribute: true + name_array: + items: + type: integer + xml: + name: xml_name_array_item + type: array + name_boolean: + example: true + type: boolean + xml: + name: xml_name_boolean + name_integer: + example: -2 + type: integer + xml: + name: xml_name_integer + name_number: + example: 1.234 + type: number + xml: + name: xml_name_number + name_string: + example: string + type: string + xml: + name: xml_name_string + name_wrapped_array: + items: + type: integer + xml: + name: xml_name_wrapped_array_item + type: array + xml: + name: xml_name_wrapped_array + wrapped: true + namespace_array: + items: + type: integer + xml: + namespace: http://e.com/schema + type: array + namespace_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + namespace_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + namespace_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + namespace_string: + example: string + type: string + xml: + namespace: http://a.com/schema + namespace_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + type: array + xml: + namespace: http://f.com/schema + wrapped: true + prefix_array: + items: + type: integer + xml: + prefix: ij + type: array + prefix_boolean: + example: true + type: boolean + xml: + prefix: gh + prefix_integer: + example: -2 + type: integer + xml: + prefix: ef + prefix_ns_array: + items: + type: integer + xml: + namespace: http://e.com/schema + prefix: e + type: array + prefix_ns_boolean: + example: true + type: boolean + xml: + namespace: http://d.com/schema + prefix: d + prefix_ns_integer: + example: -2 + type: integer + xml: + namespace: http://c.com/schema + prefix: c + prefix_ns_number: + example: 1.234 + type: number + xml: + namespace: http://b.com/schema + prefix: b + prefix_ns_string: + example: string + type: string + xml: + namespace: http://a.com/schema + prefix: a + prefix_ns_wrapped_array: + items: + type: integer + xml: + namespace: http://g.com/schema + prefix: g + type: array + xml: + namespace: http://f.com/schema + prefix: f + wrapped: true + prefix_number: + example: 1.234 + type: number + xml: + prefix: cd + prefix_string: + example: string + type: string + xml: + prefix: ab + prefix_wrapped_array: + items: + type: integer + xml: + prefix: mn + type: array + xml: + prefix: kl + wrapped: true + wrapped_array: + items: + type: integer + type: array + xml: + wrapped: true + type: object + xml: + namespace: http://a.com/schema + prefix: pre + _special_model.name_: + properties: + $special[property.name]: + format: int64 + type: integer + xml: + name: $special[model.name] + format_test: + properties: + BigDecimal: + format: number + type: string + binary: + format: binary + type: string + byte: + format: byte + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + int32: + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + format: int64 + type: integer + integer: + maximum: 100 + minimum: 10 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + password: + format: password + maxLength: 64 + minLength: 10 + type: string + string: + pattern: /[a-z]/i + type: string + uuid: + example: 72f98069-206d-4f12-9f12-3d1e525a8e84 + format: uuid + type: string + required: + - number + - byte + - date + - password + type: object + hasOnlyReadOnly: + properties: + bar: + readOnly: true + type: string + foo: + readOnly: true + type: string + type: object + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + api_key_query: + in: query + name: api_key_query + type: apiKey + http_basic_test: + scheme: basic + type: http + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +info: + description: 'This spec is mainly for testing Petstore server and contains fake + endpoints, models. Please do not use this for any other purpose. Special characters: + " \' + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /another-fake/dummy: + patch: + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test special tags + tags: + - $another-fake? + /fake: + delete: + description: Fake endpoint to test group parameters (optional) + operationId: testGroupParameters + parameters: + - description: Required String in group parameters + in: query + name: required_string_group + required: true + schema: + type: integer + - description: Required Boolean in group parameters + in: header + name: required_boolean_group + required: true + schema: + type: boolean + - description: Required Integer in group parameters + in: query + name: required_int64_group + required: true + schema: + format: int64 + type: integer + - description: String in group parameters + in: query + name: string_group + schema: + type: integer + - description: Boolean in group parameters + in: header + name: boolean_group + schema: + type: boolean + - description: Integer in group parameters + in: query + name: int64_group + schema: + format: int64 + type: integer + responses: + '400': + description: Something wrong + summary: Fake endpoint to test group parameters (optional) + tags: + - fake + x-group-parameters: true + get: + description: To test enum parameters + operationId: testEnumParameters + parameters: + - description: Header parameter enum test (string array) + in: header + name: enum_header_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + - description: Header parameter enum test (string) + in: header + name: enum_header_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (string array) + in: query + name: enum_query_string_array + schema: + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + - description: Query parameter enum test (string) + in: query + name: enum_query_string + schema: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + - description: Query parameter enum test (double) + in: query + name: enum_query_integer + schema: + enum: + - 1 + - -2 + format: int32 + type: integer + - description: Query parameter enum test (double) + in: query + name: enum_query_double + schema: + enum: + - 1.1 + - -1.2 + format: double + type: number + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + type: object + responses: + '400': + description: Invalid request + '404': + description: Not found + summary: To test enum parameters + tags: + - fake + patch: + description: To test "client" model + operationId: testClientModel + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + summary: To test "client" model + tags: + - fake + post: + description: "Fake endpoint for testing various parameters\n 假端點\n 偽のエンドポイント\n\ + \ 가짜 엔드 포인트" + operationId: testEndpointParameters + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + binary: + description: None + format: binary + type: string + byte: + description: None + format: byte + type: string + callback: + description: None + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + string: + description: None + pattern: /[a-z]/i + type: string + required: + - number + - double + - pattern_without_delimiter + - byte + type: object + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - http_basic_test: [] + summary: "Fake endpoint for testing various parameters\n 假端點\n 偽のエンドポイント\n 가짜\ + \ 엔드 포인트" + tags: + - fake + /fake/body-with-file-schema: + put: + description: For this test, the body for this request much reference a schema + named `File`. + operationId: testBodyWithFileSchema + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/FileSchemaTestClass' + required: true + responses: + '200': + description: Success + tags: + - fake + /fake/body-with-query-params: + put: + operationId: testBodyWithQueryParams + parameters: + - in: query + name: query + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + required: true + responses: + '200': + description: Success + tags: + - fake + /fake/create_xml_item: + post: + description: this route creates an XmlItem + operationId: createXmlItem + requestBody: + content: + application/xml: + schema: + $ref: '#/components/schemas/XmlItem' + application/xml; charset=utf-16: + schema: + $ref: '#/components/schemas/XmlItem' + application/xml; charset=utf-8: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml; charset=utf-16: + schema: + $ref: '#/components/schemas/XmlItem' + text/xml; charset=utf-8: + schema: + $ref: '#/components/schemas/XmlItem' + description: XmlItem Body + required: true + responses: + '200': + description: successful operation + summary: creates an XmlItem + tags: + - fake + /fake/inline-additionalProperties: + post: + description: '' + operationId: testInlineAdditionalProperties + requestBody: + content: + application/json: + schema: + additionalProperties: + type: string + type: object + description: request body + required: true + responses: + '200': + description: successful operation + summary: test inline additionalProperties + tags: + - fake + /fake/jsonFormData: + get: + description: '' + operationId: testJsonFormData + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + type: object + responses: + '200': + description: successful operation + summary: test json serialization of form data + tags: + - fake + /fake/nullable: + post: + description: '' + operationId: testNullable + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ChildWithNullable' + description: request body + required: true + responses: + '200': + description: successful operation + summary: test nullable parent property + tags: + - fake + /fake/outer/boolean: + post: + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Input boolean as post body + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterBoolean' + description: Output boolean + tags: + - fake + /fake/outer/composite: + post: + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterComposite' + description: Input composite as post body + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterComposite' + description: Output composite + tags: + - fake + /fake/outer/number: + post: + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterNumber' + description: Input number as post body + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterNumber' + description: Output number + tags: + - fake + /fake/outer/string: + post: + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/OuterString' + description: Input string as post body + responses: + '200': + content: + '*/*': + schema: + $ref: '#/components/schemas/OuterString' + description: Output string + tags: + - fake + /fake/response-with-example: + get: + description: This endpoint defines an example value for its response schema. + operationId: testWithResultExample + responses: + '200': + content: + application/json: + schema: + example: 42 + type: integer + description: Success + tags: + - fake + /fake/test-query-parameters: + put: + description: To test the collection format in query parameters + operationId: testQueryParameterCollectionFormat + parameters: + - in: query + name: pipe + required: true + schema: + items: + type: string + type: array + - in: query + name: http + required: true + schema: + items: + type: string + type: array + style: spaceDelimited + - explode: false + in: query + name: url + required: true + schema: + items: + type: string + type: array + style: form + - explode: true + in: query + name: context + required: true + schema: + items: + type: string + type: array + responses: + '200': + description: Success + tags: + - fake + /fake/{petId}/response-object-different-names: + get: + operationId: responseObjectDifferentNames + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ResponseObjectWithDifferentFieldNames' + description: successful operation + tags: + - pet + /fake/{petId}/uploadImageWithRequiredFile: + post: + description: '' + operationId: uploadFileWithRequiredFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image (required) + tags: + - pet + /fake_classname_test: + patch: + description: To test class name in snake case + operationId: testClassname + requestBody: + $ref: '#/components/requestBodies/Client' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: successful operation + security: + - api_key_query: [] + summary: To test class name in snake case + tags: + - fake_classname_tags 123#$%^ + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + uniqueItems: true + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + uniqueItems: true + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + uniqueItems: true + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + description: successful operation + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{order_id}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: order_id + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: order_id + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io:80/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/spring__petstore-with-spring-pageable.yaml b/test/oas_examples/v3.0/spring__petstore-with-spring-pageable.yaml new file mode 100644 index 0000000..693ee4c --- /dev/null +++ b/test/oas_examples/v3.0/spring__petstore-with-spring-pageable.yaml @@ -0,0 +1,732 @@ +components: + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.0.1 +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-codegen-request-body-name: body + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + x-spring-paginated: true + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + x-spring-paginated: true + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-codegen-request-body-name: body + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-codegen-request-body-name: body + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + 200: + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + 400: + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + options: + operationId: logoutUserOptions + responses: + default: + content: {} + description: endpoint configuration response + summary: logoutUserOptions + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + content: {} + description: Invalid user supplied + 404: + content: {} + description: User not found + summary: Updated user + tags: + - user + x-codegen-request-body-name: body +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.0/sse.yaml b/test/oas_examples/v3.0/sse.yaml new file mode 100644 index 0000000..6249fb1 --- /dev/null +++ b/test/oas_examples/v3.0/sse.yaml @@ -0,0 +1,60 @@ +components: + schemas: + EventType: + properties: + attribute1: + type: string + type: object +info: + description: SSE test cases + title: SSE test + version: 1.0.0 +openapi: 3.0.1 +paths: + /path/variant1: + post: + operationId: sseVariant1 + responses: + '200': + content: + text/event-stream: + schema: + format: event-stream + items: + type: string + type: array + description: acknowledged + tags: + - sse + /path/variant2: + post: + operationId: sseVariant2 + responses: + '200': + content: + text/event-stream: + schema: + format: event-stream + items: + $ref: '#/components/schemas/EventType' + type: array + description: acknowledged + tags: + - sse + /path/variant3: + post: + operationId: nonSSE + responses: + '200': + content: + text/event-stream: + schema: + format: event-stream + type: string + description: acknowledged + tags: + - sse +servers: +- url: https +tags: +- name: sse diff --git a/test/oas_examples/v3.0/streaming.yaml b/test/oas_examples/v3.0/streaming.yaml new file mode 100644 index 0000000..bf92f95 --- /dev/null +++ b/test/oas_examples/v3.0/streaming.yaml @@ -0,0 +1,81 @@ +components: + schemas: + SimpleOneOf: + oneOf: + - type: string + - type: integer + SomeObj: + properties: + $_type: + default: SomeObjIdentifier + enum: + - SomeObjIdentifier + type: string + active: + type: boolean + id: + format: int64 + type: integer + name: + type: string + type: + type: string + type: object +info: + title: ping some object + version: '1.0' +openapi: 3.0.1 +paths: + /ping: + get: + operationId: getPing + parameters: + - description: ID of pet that needs to be updated + in: query + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SomeObj' + description: OK + tags: + - ping + x-group-parameters: true + x-streaming: true + post: + operationId: postPing + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/SomeObj' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/SomeObj' + description: OK + tags: + - ping + x-streaming: true +servers: +- url: http://localhost:8082/ diff --git a/test/oas_examples/v3.0/stripModelName.yaml b/test/oas_examples/v3.0/stripModelName.yaml new file mode 100644 index 0000000..41e8421 --- /dev/null +++ b/test/oas_examples/v3.0/stripModelName.yaml @@ -0,0 +1,46 @@ +components: + schemas: + Non.Stripped.Request: + properties: + customerCode: + example: '0001' + type: string + firstName: + deprecated: true + example: first + type: string + type: object + Response: + properties: + customerCode: + example: '0001' + type: string + firstName: + deprecated: true + example: first + type: string + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.0.1 +paths: + /deprecated-test: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Non.Stripped.Request' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + description: responses + x-swagger-router-controller: /deprecated-test +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/swagger.yaml b/test/oas_examples/v3.0/swagger.yaml new file mode 100644 index 0000000..8da7af8 --- /dev/null +++ b/test/oas_examples/v3.0/swagger.yaml @@ -0,0 +1,109 @@ +components: + schemas: + Error: + properties: + code: + format: int32 + type: integer + message: + type: string + required: + - code + - message + Pet: + properties: + id: + format: int64 + type: integer + name: + type: string + tag: + type: string + required: + - id + - name + Pets: + items: + $ref: '#/components/schemas/Pet' + type: array +info: + license: + name: MIT + title: Swagger Petstore + version: 1.0.0 +openapi: 3.0.0 +paths: + /pets: + get: + operationId: listPets + parameters: + - description: How many items to return at one time (max 100) + in: query + name: limit + required: false + schema: + format: int32 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: A paged array of pets + headers: + x-next: + description: A link to the next page of responses + schema: + type: string + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: List all pets + tags: + - pets + post: + operationId: createPets + responses: + '201': + description: Null response + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Create a pet + tags: + - pets + /pets/{petId}: + get: + operationId: showPetById + parameters: + - description: The id of the pet to retrieve + in: path + name: petId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pets' + description: Expected response to a valid request + default: + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + description: unexpected error + summary: Info for a specific pet + tags: + - pets +servers: +- url: http://petstore.swagger.io/v1 diff --git a/test/oas_examples/v3.0/tags.yaml b/test/oas_examples/v3.0/tags.yaml new file mode 100644 index 0000000..58f350b --- /dev/null +++ b/test/oas_examples/v3.0/tags.yaml @@ -0,0 +1,99 @@ +components: + schemas: + SomeObj: + properties: + someProp: + type: string + type: object +info: + description: Tags Test + title: OpenAPI Test API + version: 1.0.0 +openapi: 3.0.1 +paths: + /: + get: + operationId: op0 + responses: + '200': + description: Ok + tags: + - tag0 + /group1/op1: + get: + operationId: op1 + responses: + '200': + description: Ok + tags: + - tag1 + /group1/op2: + get: + operationId: op2 + responses: + '200': + description: Ok + tags: + - tag2 + /group2/op3: + get: + operationId: op3 + responses: + '200': + description: Ok + tags: + - tag2 + /group3/op4: + get: + operationId: op4 + responses: + '200': + description: Ok + /group4/op5: + get: + operationId: op5 + responses: + '200': + description: Ok + tags: + - group4 + /group4/op6: + get: + operationId: op6 + responses: + '200': + description: Ok + tags: + - group4 + /group5/op7: + get: + operationId: op7 + responses: + '200': + description: Ok + tags: + - group5 + /group6/op8: + get: + operationId: op8 + responses: + '200': + description: Ok + tags: + - group5 + /{id}: + get: + operationId: opId + parameters: + - in: path + name: id + required: true + schema: + type: integer + responses: + '200': + description: Ok + tags: + - tag0 +servers: +- url: http://api.company.xyz/v2 diff --git a/test/oas_examples/v3.0/two-responses.yaml b/test/oas_examples/v3.0/two-responses.yaml new file mode 100644 index 0000000..549ad52 --- /dev/null +++ b/test/oas_examples/v3.0/two-responses.yaml @@ -0,0 +1,29 @@ +info: + title: Test + version: 1.0.0 +openapi: 3.0.0 +paths: + /test: + get: + responses: + '200': + content: + application/json: + schema: + properties: + test: + type: string + type: object + description: Success + '422': + content: + application/json: + schema: + properties: + test: + type: string + type: object + description: Validation failed + summary: Test +servers: +- url: http://test/ diff --git a/test/oas_examples/v3.0/type-alias.yaml b/test/oas_examples/v3.0/type-alias.yaml new file mode 100644 index 0000000..2190003 --- /dev/null +++ b/test/oas_examples/v3.0/type-alias.yaml @@ -0,0 +1,25 @@ +components: + schemas: + ParentType: + properties: + typeAlias: + $ref: '#/components/schemas/TypeAlias' + title: ParentType + type: object + TypeAlias: + type: string +info: + description: See https://github.com/OpenAPITools/openapi-generator/issues/3589 + title: API using a typeAlias mapped with importMapping + version: 1.0.0 +openapi: 3.0.0 +paths: + /type-alias: + get: + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ParentType' + description: OK diff --git a/test/oas_examples/v3.0/type_mapping_test.yaml b/test/oas_examples/v3.0/type_mapping_test.yaml new file mode 100644 index 0000000..0146335 --- /dev/null +++ b/test/oas_examples/v3.0/type_mapping_test.yaml @@ -0,0 +1,38 @@ +components: + schemas: + Animal: + properties: + className: + type: string + color: + default: red + type: string + mapping_test: + format: special + type: string + required: + - className + type: object +info: + description: API description in Markdown. + title: Sample API to test type mapping + version: 1.0.0 +openapi: 3.0.0 +paths: + /animals: + get: + description: Optional extended description in Markdown. + parameters: + - in: query + name: parameter_type_mapping + schema: + format: special + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Animal' + description: OK + summary: Returns all animals. diff --git a/test/oas_examples/v3.0/typescript-angular__composed-schemas.yaml b/test/oas_examples/v3.0/typescript-angular__composed-schemas.yaml new file mode 100644 index 0000000..caf1585 --- /dev/null +++ b/test/oas_examples/v3.0/typescript-angular__composed-schemas.yaml @@ -0,0 +1,103 @@ +components: + schemas: + CatComposed: + allOf: + - $ref: '#/components/schemas/PetWithoutDiscriminator' + - properties: + hunts: + type: boolean + type: object + CatInherited: + allOf: + - $ref: '#/components/schemas/PetWithSimpleDiscriminator' + - properties: + hunts: + type: boolean + type: object + CatMapped: + allOf: + - $ref: '#/components/schemas/PetWithMappedDiscriminator' + - properties: + hunts: + type: boolean + type: object + DogBreed: + enum: + - Dingo + - Husky + type: string + DogComposed: + allOf: + - $ref: '#/components/schemas/PetWithoutDiscriminator' + - properties: + inlineBreed: + enum: + - Dingo + - Husky + type: string + type: object + DogInherited: + allOf: + - $ref: '#/components/schemas/PetWithSimpleDiscriminator' + - properties: + breed: + $ref: '#/components/schemas/DogBreed' + type: object + DogMapped: + allOf: + - $ref: '#/components/schemas/PetWithMappedDiscriminator' + - properties: + breed: + $ref: '#/components/schemas/DogBreed' + type: object + PetWithMappedDiscriminator: + discriminator: + mapping: + cat: '#/components/schemas/CatMapped' + dog: '#/components/schemas/DogMapped' + propertyName: petType + properties: + petType: + type: string + required: + - petType + type: object + PetWithSimpleDiscriminator: + discriminator: + propertyName: petType + properties: + petType: + type: string + required: + - petType + type: object + PetWithoutDiscriminator: + properties: + petType: + type: string + required: + - petType + type: object +info: + license: + name: MIT + title: Schemas with different types of composition for testing models generation + version: 1.0.0 +openapi: 3.0.1 +paths: + /pet/mapped: + get: + operationId: getPets + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/PetWithMappedDiscriminator' + type: array + description: OK + tags: + - pet +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.0/typescript-fetch__enum.yaml b/test/oas_examples/v3.0/typescript-fetch__enum.yaml new file mode 100644 index 0000000..b779fcd --- /dev/null +++ b/test/oas_examples/v3.0/typescript-fetch__enum.yaml @@ -0,0 +1,229 @@ +components: + schemas: + EnumPatternObject: + properties: + nullable-number-enum: + allOf: + - $ref: '#/components/schemas/NumberEnum' + nullable: true + nullable-string-enum: + allOf: + - $ref: '#/components/schemas/StringEnum' + nullable: true + number-enum: + $ref: '#/components/schemas/NumberEnum' + string-enum: + $ref: '#/components/schemas/StringEnum' + type: object + NumberEnum: + enum: + - 1 + - 2 + - 3 + type: number + StringEnum: + enum: + - one + - two + - three + type: string +info: + title: Enum test + version: 1.0.0 +openapi: 3.0.0 +paths: + /fake/enum-request-inline: + get: + operationId: fake-enum-request-get-inline + parameters: + - in: query + name: string-enum + schema: + enum: + - one + - two + - three + type: string + - in: query + name: nullable-string-enum + schema: + allOf: + - enum: + - one + - two + - three + type: string + nullable: true + - in: query + name: number-enum + schema: + enum: + - 1 + - 2 + - 3 + type: number + - in: query + name: nullable-number-enum + schema: + allOf: + - enum: + - 1 + - 2 + - 3 + type: number + nullable: true + responses: + 200: + content: + application/json: + schema: + properties: + nullable-number-enum: + allOf: + - enum: + - 1 + - 2 + - 3 + type: number + nullable: true + nullable-string-enum: + allOf: + - enum: + - one + - two + - three + type: string + nullable: true + number-enum: + enum: + - 1 + - 2 + - 3 + type: number + string-enum: + enum: + - one + - two + - three + type: string + type: object + description: OK + post: + operationId: fake-enum-request-post-inline + requestBody: + content: + application/json: + schema: + properties: + nullable-number-enum: + allOf: + - enum: + - 1 + - 2 + - 3 + type: number + nullable: true + nullable-string-enum: + allOf: + - enum: + - one + - two + - three + type: string + nullable: true + number-enum: + enum: + - 1 + - 2 + - 3 + type: number + string-enum: + enum: + - one + - two + - three + type: string + type: object + responses: + 200: + content: + application/json: + schema: + properties: + nullable-number-enum: + allOf: + - enum: + - 1 + - 2 + - 3 + type: number + nullable: true + nullable-string-enum: + allOf: + - enum: + - one + - two + - three + type: string + nullable: true + number-enum: + enum: + - 1 + - 2 + - 3 + type: number + string-enum: + enum: + - one + - two + - three + type: string + type: object + description: OK + /fake/enum-request-ref: + get: + operationId: fake-enum-request-get-ref + parameters: + - in: query + name: string-enum + schema: + $ref: '#/components/schemas/StringEnum' + - in: query + name: nullable-string-enum + schema: + allOf: + - $ref: '#/components/schemas/StringEnum' + nullable: true + - in: query + name: number-enum + schema: + $ref: '#/components/schemas/NumberEnum' + - in: query + name: nullable-number-enum + schema: + allOf: + - $ref: '#/components/schemas/NumberEnum' + nullable: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/EnumPatternObject' + description: OK + post: + operationId: fake-enum-request-post-ref + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/EnumPatternObject' + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/EnumPatternObject' + description: OK +servers: +- url: http://localhost:3000 diff --git a/test/oas_examples/v3.0/unique_items.yaml b/test/oas_examples/v3.0/unique_items.yaml new file mode 100644 index 0000000..300949c --- /dev/null +++ b/test/oas_examples/v3.0/unique_items.yaml @@ -0,0 +1,31 @@ +components: + schemas: + Response: + properties: + non-unique-array: + items: + type: string + type: array + unique-array: + items: + type: string + type: array + uniqueItems: true + type: object +info: + title: Sample for uniqueItems + version: 1.0.0 +openapi: 3.0.0 +paths: + /unique-items: + get: + operationId: unique_items + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Response' + description: OK +servers: +- url: http://localhost:3000 diff --git a/test/oas_examples/v3.0/validation.yaml b/test/oas_examples/v3.0/validation.yaml new file mode 100644 index 0000000..21fdc4b --- /dev/null +++ b/test/oas_examples/v3.0/validation.yaml @@ -0,0 +1,26 @@ +components: + schemas: + banana: + properties: + count: + exclusiveMaximum: true + exclusiveMinimum: true + maximum: 100 + minimum: 10 + multipleOf: 5 + type: integer + title: banana +info: + title: fruity + version: 0.0.1 +openapi: 3.0.1 +paths: + /: + get: + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/banana' + description: desc diff --git a/test/oas_examples/v3.0/wsdl__petstore.yaml b/test/oas_examples/v3.0/wsdl__petstore.yaml new file mode 100644 index 0000000..2622c27 --- /dev/null +++ b/test/oas_examples/v3.0/wsdl__petstore.yaml @@ -0,0 +1,728 @@ +components: + schemas: + ApiResponse: + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + type: object + Category: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Category + Order: + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + type: object + xml: + name: Order + Pet: + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + type: object + xml: + name: Pet + Tag: + properties: + id: + format: int64 + type: integer + name: + type: string + type: object + xml: + name: Tag + User: + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + contact: + email: apiteam@swagger.io + 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.' + license: + 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 +openapi: 3.0.1 +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + x-codegen-request-body-name: body + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + x-codegen-request-body-name: body + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: true + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, + tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: true + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + x-codegen-request-body-name: body + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with positive integer value. Negative + or non-integer values will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + format: int64 + minimum: 1.0 + type: integer + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value >= 1 and <= 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 10.0 + minimum: 1.0 + type: integer + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + x-codegen-request-body-name: body + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + x-codegen-request-body-name: body + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + 200: + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + 400: + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + get: + operationId: getUserByName + parameters: + - description: 'The name that needs to be fetched. Use user1 for testing. ' + in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be updated + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + content: {} + description: Invalid user supplied + 404: + content: {} + description: User not found + summary: Updated user + tags: + - user + x-codegen-request-body-name: body +servers: +- url: https://petstore.swagger.io/v2 +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + externalDocs: + description: Find out more + url: http://swagger.io + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + externalDocs: + description: Find out more about our store + url: http://swagger.io + name: user diff --git a/test/oas_examples/v3.1/3_1__petstore.yaml b/test/oas_examples/v3.1/3_1__petstore.yaml new file mode 100644 index 0000000..d196446 --- /dev/null +++ b/test/oas_examples/v3.1/3_1__petstore.yaml @@ -0,0 +1,736 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + UserArray: + content: + application/json: + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + read:pets: read your pets + write:pets: modify pets in your account + type: oauth2 +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.1.0 +paths: + /pet: + post: + description: '' + operationId: addPet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + description: '' + externalDocs: + description: API documentation for the updatePet operation + url: http://petstore.swagger.io/v2/doc/updatePet + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - deprecated: true + description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid status value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use + tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + '200': + content: + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + '400': + description: Invalid tag value + security: + - petstore_auth: + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + description: '' + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + type: object + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + description: '' + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + type: object + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + '200': + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + description: '' + operationId: placeOrder + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything + above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other + values will generate exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Order' + application/xml: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Create user + tags: + - user + /user/createWithArray: + post: + description: '' + operationId: createUsersWithArrayInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + description: '' + operationId: createUsersWithListInput + requestBody: + $ref: '#/components/requestBodies/UserArray' + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + description: '' + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + type: string + application/xml: + schema: + type: string + description: successful operation + headers: + Set-Cookie: + description: Cookie authentication key for use with the `api_key` apiKey + authentication. + schema: + example: AUTH_KEY=abcde12345; Path=/; HttpOnly + type: string + X-Expires-After: + description: date in UTC when token expires + schema: + format: date-time + type: string + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + '400': + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + description: '' + operationId: logoutUser + responses: + default: + description: successful operation + security: + - api_key: [] + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found + security: + - api_key: [] + summary: Delete user + tags: + - user + get: + description: '' + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/User' + application/xml: + schema: + $ref: '#/components/schemas/User' + description: successful operation + '400': + description: Invalid username supplied + '404': + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + security: + - api_key: [] + summary: Updated user + tags: + - user +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.1/3_1__schema.yaml b/test/oas_examples/v3.1/3_1__schema.yaml new file mode 100644 index 0000000..7582e8b --- /dev/null +++ b/test/oas_examples/v3.1/3_1__schema.yaml @@ -0,0 +1,66 @@ +components: + schemas: + Misc: + description: Schema tests + properties: + anyof1: + anyOf: + - type: string + - type: number + anyof2: + anyOf: + - type: string + - items: + type: string + type: array + free_form_object_1: + type: object + free_form_object_2: + additionalProperties: true + type: object + free_form_object_3: + additionalProperties: {} + type: object + map1: + additionalProperties: + type: string + type: object + oneof1: + oneOf: + - type: string + - type: integer + type: object +externalDocs: + description: Find out more about Swagger + url: http://swagger.io +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.1.0 +paths: + /dummy: + post: + description: '' + operationId: dummy_operation + responses: + '200': + description: successful operation + '405': + description: Invalid input + summary: dummy operation + tags: + - dummy +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user diff --git a/test/oas_examples/v3.1/common-parameters.yaml b/test/oas_examples/v3.1/common-parameters.yaml new file mode 100644 index 0000000..ab95b17 --- /dev/null +++ b/test/oas_examples/v3.1/common-parameters.yaml @@ -0,0 +1,226 @@ +components: + requestBodies: + Pet: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + schemas: + ApiResponse: + description: Describes the result of uploading an image resource + properties: + code: + format: int32 + type: integer + message: + type: string + type: + type: string + title: An uploaded response + type: object + Category: + description: A category for a pet + properties: + id: + format: int64 + type: integer + name: + pattern: ^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$ + type: string + title: Pet category + type: object + xml: + name: Category + Order: + description: An order for a pets from the pet store + properties: + complete: + default: false + type: boolean + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + title: Pet Order + type: object + xml: + name: Order + Pet: + description: A pet for sale in the pet store + properties: + category: + $ref: '#/components/schemas/Category' + id: + format: int64 + type: integer + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + status: + deprecated: true + description: pet status in the store + enum: + - available + - pending + - sold + type: string + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + Tag: + description: A tag for a pet + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + User: + description: A User who is purchasing from the pet store + properties: + email: + type: string + firstName: + type: string + id: + format: int64 + type: integer + lastName: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + username: + type: string + title: a User + type: object + xml: + name: User + securitySchemes: + api_key: + in: header + name: api_key + type: apiKey +info: + description: This is a sample server Petstore server. For this sample, you can use + the api key `special-key` to test the authorization filters. + license: + name: Apache-2.0 + url: https://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +openapi: 3.1.0 +paths: + /pet/{petId}: + delete: + description: '' + operationId: deletePet + parameters: + - in: header + name: api_key + required: false + schema: + type: string + responses: + '400': + description: Invalid pet value + security: + - api_key: [] + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + patch: + description: '' + operationId: updatePet + requestBody: + $ref: '#/components/requestBodies/Pet' + responses: + '400': + description: Invalid pet value + security: + - api_key: [] + summary: Updates a pet + tags: + - pet +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet diff --git a/test/oas_examples/v3.1/issue-17485.yaml b/test/oas_examples/v3.1/issue-17485.yaml new file mode 100644 index 0000000..239d7b9 --- /dev/null +++ b/test/oas_examples/v3.1/issue-17485.yaml @@ -0,0 +1,24 @@ +info: + title: issue-17485 + version: 0.1.0 +openapi: 3.1.0 +paths: + /user: + get: + parameters: + - description: The name of the user + in: path + name: username + required: true + schema: + items: + pattern: ^[a-zA-Z0-9]$ + type: string + type: array + responses: + '200': + description: OK + tags: + - user +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.1/null-types-with-type-array.yaml b/test/oas_examples/v3.1/null-types-with-type-array.yaml new file mode 100644 index 0000000..8c1911d --- /dev/null +++ b/test/oas_examples/v3.1/null-types-with-type-array.yaml @@ -0,0 +1,121 @@ +components: + schemas: + Adult: + allOf: + - $ref: '#/components/schemas/Person' + - properties: + children: + items: + $ref: '#/components/schemas/Child' + type: array + nullableChildren: + items: + $ref: '#/components/schemas/Child' + type: + - array + - 'null' + nullableChildrenVariant2: + oneOf: + - type: 'null' + - items: + $ref: '#/components/schemas/Child' + type: array + type: object + description: A representation of an adult + Child: + allOf: + - properties: + age: + format: int32 + type: integer + type: object + - $ref: '#/components/schemas/Person' + description: A representation of a child + Nullable.Address: + description: A representation of an address whose value can be null. + nullable: true + properties: + city: + type: string + street: + type: string + type: object + Person: + discriminator: + mapping: + a: '#/components/schemas/Adult' + c: Child + propertyName: $_type + properties: + $_type: + type: string + address: + properties: + city: + type: string + street: + type: string + type: object + firstName: + type: string + lastName: + type: string + maidenName: + maxLength: 255 + type: + - string + - 'null' + nullableSkills: + items: + properties: + name: + type: string + type: object + type: + - array + - 'null' + nullableSkillsVariant2: + oneOf: + - type: 'null' + - items: + properties: + name: + type: string + type: object + type: array + secondHomeAddress: + $ref: '#/components/schemas/Nullable.Address' + skills: + items: + properties: + name: + type: string + type: object + type: array + type: object +info: + license: + name: MIT + title: Example + version: 1.0.0 +openapi: 3.1.0 +paths: + /person/display/{personId}: + get: + operationId: list + parameters: + - description: The id of the person to retrieve + in: path + name: personId + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Person' + description: OK +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.1/regression-16119.yaml b/test/oas_examples/v3.1/regression-16119.yaml new file mode 100644 index 0000000..2e2f9d2 --- /dev/null +++ b/test/oas_examples/v3.1/regression-16119.yaml @@ -0,0 +1,31 @@ +components: + schemas: + Child: + additionalProperties: {} + type: object + Parent: + additionalProperties: false + properties: + child: + $ref: '#/components/schemas/Child' + required: [] + type: object +info: + title: double-option-hashmap + version: 0.1.0 +openapi: 3.1.0 +paths: + /repro: + post: + deprecated: false + operationId: repro + parameters: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/Parent' + description: Reproduce bug in Rust generation code. +servers: +- url: http://api.example.xyz/v1 diff --git a/test/oas_examples/v3.1/webhooks.yaml b/test/oas_examples/v3.1/webhooks.yaml new file mode 100644 index 0000000..2642f9c --- /dev/null +++ b/test/oas_examples/v3.1/webhooks.yaml @@ -0,0 +1,31 @@ +components: + schemas: + Pet: + properties: + id: + format: int64 + type: integer + name: + type: string + tag: + type: string + required: + - id + - name +info: + title: Webhook Example + version: 1.0.0 +openapi: 3.1.0 +webhooks: + newPet: + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: Information about a new pet in the system + responses: + '200': + description: Return a 200 status to indicate that the data was received + successfully