Skip to content

Instantly share code, notes, and snippets.

@EDDYMENS
Created March 19, 2023 16:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EDDYMENS/441c69dd2e34355485aa7591b95c889f to your computer and use it in GitHub Desktop.
Save EDDYMENS/441c69dd2e34355485aa7591b95c889f to your computer and use it in GitHub Desktop.
Simple Open API starter template
openapi: 3.0.3
info:
title: Simple OpenAPI template
description: |
Simple open API template
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.11
servers:
- url: https://example.com/api/v1
tags:
- name: v1
description: Simple API (v1)
paths:
/data:
get:
tags:
- v1
summary: Return all data
description: Describe this a bit more here
operationId: allData
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ResponseStructure'
'400':
description: Invalid status value
post:
tags:
- v1
summary: Add data
description: Further description for adding data
operationId: addData
requestBody:
description: Request Body structure required to add data
content:
application/json:
schema:
$ref: '#/components/schemas/RequestStructure'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ResponseStructure'
'405':
description: Invalid input
/data/{dataId}:
patch:
tags:
- v1
summary: Update data
description: Further description for adding data
operationId: updateData
parameters:
- name: dataId
in: path
description: ID of datum to update
required: true
schema:
type: integer
format: int64
requestBody:
description: Request Body structure required to update data
content:
application/json:
schema:
$ref: '#/components/schemas/RequestStructure'
required: true
responses:
'200':
description: Successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ResponseStructure'
'405':
description: Invalid input
delete:
tags:
- v1
summary: Deletes a pet
description: delete a pet
operationId: deletePet
parameters:
- name: dataId
in: path
description: ID of datum to update
required: true
schema:
type: integer
format: int64
responses:
'400':
description: Invalid input
components:
schemas:
RequestStructure:
type: object
properties:
name:
type: string
example: "John Doe"
age:
type: integer
example: 24
status:
type: boolean
salutation:
type: string
enum:
- Mrs
- Mr
- Mrs
- Miss
ResponseStructure:
type: object
properties:
name:
type: string
example: "John Doe"
age:
type: integer
example: 24
status:
type: boolean
salutation:
type: string
enum:
- Mrs
- Mr
- Mrs
- Miss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment