Skip to content

Instantly share code, notes, and snippets.

@jspdown
Last active December 16, 2024 08:50
Show Gist options
  • Save jspdown/25dc03211509e09e3306ce8ee83d142d to your computer and use it in GitHub Desktop.
Save jspdown/25dc03211509e09e3306ce8ee83d142d to your computer and use it in GitHub Desktop.
openapi: 3.0.2
info:
title: API Pastry - 3.0
version: 3.0.0
description: API definition of API Pastry sample app
contact:
name: Laurent Broudoux
url: 'http://github.com/lbroudoux'
email: [email protected]
license:
name: MIT License
url: 'https://opensource.org/licenses/MIT'
paths:
/pastry:
summary: Global operations on pastries
get:
tags:
- pastry
responses:
'200':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pastry'
examples:
pastries_json:
value:
- name: Baba Rhum
description: Delicieux Baba au Rhum pas calorique du tout
size: L
price: 3.2
status: available
- name: Divorces
description: Delicieux Divorces pas calorique du tout
size: M
price: 2.8
status: available
- name: Tartelette Fraise
description: Delicieuse Tartelette aux Fraises fraiches
size: S
price: 2
status: available
description: Get list of pastries
operationId: GetPastries
summary: Get list of pastries
'/pastry/{name}':
summary: Specific operation on pastry
get:
parameters:
- examples:
Eclair Cafe:
value: Eclair Cafe
Millefeuille:
value: Millefeuille
name: name
description: pastry name
schema:
type: string
in: path
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Pastry'
examples:
Eclair Cafe:
value:
name: Eclair Cafe
description: Delicieux Eclair au Cafe pas calorique du tout
size: M
price: 2.5
status: available
Millefeuille:
value:
name: Millefeuille
description: Delicieux Millefeuille pas calorique du tout
size: L
price: 4.4
status: available
description: Pastry with specified name
operationId: GetPastryByName
summary: Get Pastry by name
description: Get Pastry by name
patch:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Pastry'
examples:
Eclair Cafe:
value:
price: 2.6
required: true
parameters:
- examples:
Eclair Cafe:
value: Eclair Cafe
name: name
description: pastry name
schema:
type: string
in: path
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Pastry'
examples:
Eclair Cafe:
value:
name: Eclair Cafe
description: Delicieux Eclair au Cafe pas calorique du tout
size: M
price: 2.6
status: available
description: Changed pastry
operationId: PatchPastry
summary: Patch existing pastry
parameters:
- name: name
description: pastry name
schema:
type: string
in: path
required: true
components:
schemas:
Pastry:
title: Root Type for Pastry
description: The root of the Pastry type's schema.
type: object
properties:
name:
description: Name of this pastry
type: string
description:
description: A short description of this pastry
type: string
size:
description: 'Size of pastry (S, M, L)'
type: string
price:
format: double
description: Price (in USD) of this pastry
type: number
status:
description: 'Status in stock (available, out_of_stock)'
type: string
example:
name: My Pastry
description: A short description os my pastry
size: M
price: 4.5
status: available
tags:
- name: pastry
description: Pastry resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment