Skip to content

Instantly share code, notes, and snippets.

@Nicklas2751
Created May 14, 2020 15:18
Show Gist options
  • Save Nicklas2751/ada3e97c63f6d07d61e7b3332545971e to your computer and use it in GitHub Desktop.
Save Nicklas2751/ada3e97c63f6d07d61e7b3332545971e to your computer and use it in GitHub Desktop.
---
openapi: 3.0.1
info:
title: Generated API
version: "1.0"
paths:
/address:
get:
summary: Retrieves all addresses
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CollectionAddress'
put:
summary: Updates existing address
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
responses:
"200":
description: The updated address
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
post:
summary: Create a new address
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
responses:
"200":
description: The saved address with it's generated ID
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
/address/{id}:
get:
summary: Retries a address by the given ID
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
"404":
description: No address with given ID found
"200":
description: The address with the given ID
content:
application/json:
schema:
$ref: '#/components/schemas/Address'
delete:
summary: Deletes the address with the given ID
parameters:
- name: id
in: path
required: true
schema:
$ref: '#/components/schemas/UUID'
responses:
"404":
description: No address with given ID found
"204":
description: The address with the given ID has been deleted
components:
schemas:
UUID:
format: uuid
pattern: '[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}'
type: string
Address:
type: object
propertiesHiddenFor:
id: post
properties:
address:
type: string
city:
type: string
id:
$ref: '#/components/schemas/UUID'
zip:
type: string
CollectionAddress:
type: array
items:
$ref: '#/components/schemas/Address'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment