Skip to content

Instantly share code, notes, and snippets.

@giuliana-bezerra
Last active September 10, 2021 18:00
Show Gist options
  • Save giuliana-bezerra/0665a47d6a62aff6ea8633bcaf8c6405 to your computer and use it in GitHub Desktop.
Save giuliana-bezerra/0665a47d6a62aff6ea8633bcaf8c6405 to your computer and use it in GitHub Desktop.
---
openapi: 3.0.0
servers:
- url: 'https://petstore3.swagger.io/api/v3'
info:
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.'
version: 1.0.0
title: Swagger Petstore New
termsOfService: http://swagger.io/terms/
contact:
email: [email protected]
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
tags:
- name: pet
description: Everything about your Pets
externalDocs:
description: Find out more
url: http://swagger.io
- name: store
description: Access to Petstore orders
- name: user
description: Operations about user
externalDocs:
description: Find out more about our store
url: http://swagger.io
paths:
'/pet':
post:
tags:
- pet
summary: Add a new pet to the store
description: Add a new pet to the store
operationId: addPet
requestBody:
description: Create a new pet in the store
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Pet'
'405':
description: Invalid input
security:
- api_key: []
- petstore_auth:
- write:pets
- read:pets
'/pet/{petId}':
get:
tags:
- pet
summary: Find pet by ID
description: Returns a single pet
operationId: getPetById
parameters:
- name: petId
in: path
description: ID of pet to return
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/xml:
schema:
'$ref': '#/components/schemas/Pet'
application/json:
schema:
'$ref': '#/components/schemas/Pet'
'400':
description: Invalid ID supplied
'404':
description: Pet not found
'405':
description: Validation error
security:
- api_key: []
- petstore_auth:
- write:pets
- read:pets
components:
schemas:
Pet:
required:
- name
- photoUrls
type: object
properties:
id:
type: integer
format: int64
example: 10
name:
type: string
example: doggie
photoUrls:
type: array
xml:
wrapped: true
items:
type: string
xml:
name: photoUrl
status:
type: string
description: pet status in the store
enum:
- available
- pending
- sold
securitySchemes:
api_key:
type: apiKey
name: api_key
in: header
petstore_auth:
type: oauth2
flows:
implicit:
authorizationUrl: https://petstore3.swagger.io/oauth/authorize
scopes:
write:pets: modify pets in your account
read:pets: read your pets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment