mirror of
https://github.com/LukeHagar/connexion.git
synced 2025-12-10 12:27:46 +00:00
This PR updates the examples for Connexion 3.0 and merges them for OpenAPI and Swagger. 2 examples required some changes to make them work: - The reverse proxy example required some fixes to the SwaggerUIMiddleware to leverage the `root_path` correctly. This is included in the PR. - The enforced defaults example requires the json validator to adapt the body and pass it on. We currently pass on the original body after validation, and I'm not sure if we should change this. I'll submit a separate PR to discuss this.
113 lines
2.4 KiB
YAML
113 lines
2.4 KiB
YAML
swagger: '2.0'
|
|
info:
|
|
title: Pet Shop Example API
|
|
version: "0.1"
|
|
basePath: /swagger
|
|
consumes:
|
|
- application/json
|
|
produces:
|
|
- application/json
|
|
paths:
|
|
/pets:
|
|
get:
|
|
tags: [Pets]
|
|
operationId: app.get_pets
|
|
summary: Get all pets
|
|
parameters:
|
|
- name: animal_type
|
|
in: query
|
|
type: string
|
|
pattern: "^[a-zA-Z0-9]*$"
|
|
- name: limit
|
|
in: query
|
|
type: integer
|
|
minimum: 0
|
|
default: 100
|
|
responses:
|
|
200:
|
|
description: Return pets
|
|
schema:
|
|
type: array
|
|
items:
|
|
$ref: '#/definitions/Pet'
|
|
/pets/{pet_id}:
|
|
get:
|
|
tags: [Pets]
|
|
operationId: app.get_pet
|
|
summary: Get a single pet
|
|
parameters:
|
|
- $ref: '#/parameters/pet_id'
|
|
responses:
|
|
200:
|
|
description: Return pet
|
|
schema:
|
|
$ref: '#/definitions/Pet'
|
|
404:
|
|
description: Pet does not exist
|
|
put:
|
|
tags: [Pets]
|
|
operationId: app.put_pet
|
|
summary: Create or update a pet
|
|
parameters:
|
|
- $ref: '#/parameters/pet_id'
|
|
- name: pet
|
|
in: body
|
|
schema:
|
|
$ref: '#/definitions/Pet'
|
|
responses:
|
|
200:
|
|
description: Pet updated
|
|
201:
|
|
description: New pet created
|
|
delete:
|
|
tags: [Pets]
|
|
operationId: app.delete_pet
|
|
summary: Remove a pet
|
|
parameters:
|
|
- $ref: '#/parameters/pet_id'
|
|
responses:
|
|
204:
|
|
description: Pet was deleted
|
|
404:
|
|
description: Pet does not exist
|
|
|
|
|
|
parameters:
|
|
pet_id:
|
|
name: pet_id
|
|
description: Pet's Unique identifier
|
|
in: path
|
|
type: string
|
|
required: true
|
|
pattern: "^[a-zA-Z0-9-]+$"
|
|
|
|
definitions:
|
|
Pet:
|
|
type: object
|
|
required:
|
|
- name
|
|
- animal_type
|
|
properties:
|
|
id:
|
|
type: string
|
|
description: Unique identifier
|
|
example: "123"
|
|
readOnly: true
|
|
name:
|
|
type: string
|
|
description: Pet's name
|
|
example: "Susie"
|
|
minLength: 1
|
|
maxLength: 100
|
|
animal_type:
|
|
type: string
|
|
description: Kind of animal
|
|
example: "cat"
|
|
minLength: 1
|
|
created:
|
|
type: string
|
|
format: date-time
|
|
description: Creation time
|
|
example: "2015-07-07T15:49:51.230+02:00"
|
|
readOnly: true
|