Skip to content

Commit

Permalink
added swagger 2 tests for inline array definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
gcornacchia committed Nov 28, 2024
1 parent 9a04014 commit c8b5231
Show file tree
Hide file tree
Showing 2 changed files with 218 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,9 @@ public void testSwaggerWithAdditionalProperties() {
testForSwagger("petstoreAdditionalProperties.json");
}

@Test
public void testSwaggerWithInlineArray() {
testForSwagger("petstoreswagger2ArrayInline.yaml");
}

}
213 changes: 213 additions & 0 deletions src/test/resources/petstoreswagger2ArrayInline.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
swagger: '2.0'
info:
contact:
email: [email protected]
description: >-
This is a sample Pet Store Server based on the OpenAPI 3.0 specification.
You can find out more about
Swagger at [https://swagger.io](https://swagger.io). In the third iteration
of the pet store, we've switched to the design first approach!
You can now help us improve the API whether it's by making changes to the
definition itself or to the code.
That way, with time, we can improve the API in general, and expose some of
the new features in OAS3.
_If you're looking for the Swagger 2.0/OAS 2.0 version of Petstore, then
click
[here](https://editor.swagger.io/?url=https://petstore.swagger.io/v2/swagger.yaml).
Alternatively, you can load via the `Edit > Load Petstore OAS 2.0` menu
option!_
Some useful links:
- [The Pet Store
repository](https://github.com/swagger-api/swagger-petstore)
- [The source API definition for the Pet
Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
termsOfService: 'http://swagger.io/terms/'
title: Swagger Petstore - OpenAPI 3.0
version: 1.0.11
host: petstore3.swagger.io
basePath: /api/v3
schemes:
- https
paths:
/pet:
put:
consumes:
- application/json
produces:
- application/json
parameters:
- description: Update an existent pet in the store
in: body
name: body
schema:
items:
properties:
tags:
items:
properties:
id:
format: int64
type: integer
name:
type: string
type: object
xml:
name: tag
type: array
xml:
wrapped: true
category:
properties:
id:
example: 1
format: int64
type: integer
name:
example: Dogs
type: string
type: object
xml:
name: 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
required:
- name
- photoUrls
type: object
type: array
responses:
'200':
description: Successful operation
schema:
items:
properties:
tags:
items:
properties:
id:
format: int64
type: integer
name:
type: string
type: object
xml:
name: tag
type: array
xml:
wrapped: true
category:
properties:
id:
example: 1
format: int64
type: integer
name:
example: Dogs
type: string
type: object
xml:
name: 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
required:
- name
- photoUrls
type: object
type: array
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'422':
description: Validation exception
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
tags:
- pet
description: Update an existing pet by Id
operationId: updatePet
summary: Update an existing pet
securityDefinitions:
api_key:
in: header
name: api_key
type: apiKey
petstore_auth:
authorizationUrl: 'https://petstore3.swagger.io/oauth/authorize'
flow: implicit
scopes:
'read:pets': read your pets
'write:pets': modify pets in your account
type: oauth2
tags:
- externalDocs:
description: Find out more
url: 'http://swagger.io'
description: Everything about your Pets
name: pet
- externalDocs:
description: Find out more about our store
url: 'http://swagger.io'
description: Access to Petstore orders
name: store
- description: Operations about user
name: user
externalDocs:
description: Find out more about Swagger
url: 'http://swagger.io'
x-components: {}

0 comments on commit c8b5231

Please sign in to comment.