Skip to content

Commit

Permalink
Drop data from schema
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Broadbent committed Dec 7, 2023
1 parent 8076a38 commit c83c65b
Show file tree
Hide file tree
Showing 16 changed files with 159 additions and 224 deletions.
21 changes: 9 additions & 12 deletions src/config/examples/ResponseCities.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
summary: The response to a GET /v1/city call with result
value:
data:
- id: london
name: London
country: United Kingdom
- id: milan
name: Milan
country: Italia
- id: paris
name: Paris
country: France
- id: london
name: London
country: United Kingdom
- id: milan
name: Milan
country: Italia
- id: paris
name: Paris
country: France
9 changes: 3 additions & 6 deletions src/config/examples/ResponseCityThurles.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
summary: The response to a GET /v1/city call with result of Thurles in the Republic of Ireland
value:
data:
id: thurles
name: Thurles
country: Éire
id: thurles
name: Thurles
country: Éire
3 changes: 3 additions & 0 deletions src/config/examples/ResponseRouteParisLondon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from: paris
to: london
miles: 292
9 changes: 3 additions & 6 deletions src/config/examples/ResponseRouteParisMilan.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
summary: Example response to /v1/route endpoint with route from Paris to Milan
value:
data:
from: paris
to: milan
miles: 529
from: paris
to: milan
miles: 529
210 changes: 96 additions & 114 deletions src/config/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,17 @@
"paths": {
"/city": {
"get": {
"tags": ["City"],
"tags": [
"City"
],
"summary": "Get Cities",
"description": "Get cities",
"operationId": "getCities",
"security": [
{
"api_key": ["city:read"]
"api_key": [
"city:read"
]
}
],
"responses": {
Expand All @@ -64,13 +68,17 @@
},
"/city/{id}": {
"get": {
"tags": ["City"],
"tags": [
"City"
],
"summary": "Get City",
"description": "Get a city given an ID",
"operationId": "getCity",
"security": [
{
"api_key": ["city:read"]
"api_key": [
"city:read"
]
}
],
"parameters": [
Expand All @@ -96,13 +104,17 @@
},
"/route": {
"get": {
"tags": ["Route"],
"tags": [
"Route"
],
"summary": "Get a Route",
"description": "Get a route between two cities",
"operationId": "getRoute",
"security": [
{
"api_key": ["route:read"]
"api_key": [
"route:read"
]
}
],
"parameters": [
Expand Down Expand Up @@ -135,7 +147,11 @@
"City": {
"title": "City",
"type": "object",
"required": ["id", "name", "country"],
"required": [
"id",
"name",
"country"
],
"properties": {
"id": {
"type": "string",
Expand All @@ -162,7 +178,11 @@
"title": "Route",
"description": "A route between two cities (`from` and `to`), with a distance of miles\n",
"type": "object",
"required": ["from", "to", "miles"],
"required": [
"from",
"to",
"miles"
],
"properties": {
"from": {
"type": "string",
Expand Down Expand Up @@ -190,7 +210,10 @@
"ErrorModel": {
"title": "Error Model",
"type": "object",
"required": ["status", "message"],
"required": [
"status",
"message"
],
"properties": {
"status": {
"type": "integer",
Expand All @@ -205,7 +228,10 @@
"CityCreate": {
"title": "City",
"type": "object",
"required": ["name", "country"],
"required": [
"name",
"country"
],
"properties": {
"name": {
"type": "string",
Expand Down Expand Up @@ -254,18 +280,12 @@
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["data"],
"properties": {
"data": {
"$ref": "#/components/schemas/City"
}
}
"$ref": "#/components/schemas/City"
},
"examples": {
"Thurles": {
"$ref": "#/components/examples/ResponseCityThurles"
}
"example": {
"id": "thurles",
"name": "Thurles",
"country": "Éire"
}
}
}
Expand All @@ -275,22 +295,28 @@
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["data"],
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/components/schemas/City"
}
}
"type": "array",
"items": {
"$ref": "#/components/schemas/City"
}
},
"examples": {
"ResponseCities": {
"$ref": "#/components/examples/ResponseCities"
"example": [
{
"id": "london",
"name": "London",
"country": "United Kingdom"
},
{
"id": "milan",
"name": "Milan",
"country": "Italia"
},
{
"id": "paris",
"name": "Paris",
"country": "France"
}
}
]
}
}
},
Expand All @@ -299,18 +325,12 @@
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["data"],
"properties": {
"data": {
"$ref": "#/components/schemas/Route"
}
}
"$ref": "#/components/schemas/Route"
},
"examples": {
"ParisMilan": {
"$ref": "#/components/examples/ResponseRouteParisMilan"
}
"example": {
"from": "paris",
"to": "milan",
"miles": 529
}
}
}
Expand All @@ -325,18 +345,12 @@
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["data"],
"properties": {
"data": {
"$ref": "#/components/schemas/Route"
}
}
"$ref": "#/components/schemas/Route"
},
"examples": {
"ParisMilan": {
"$ref": "#/components/examples/ResponseRouteParisMilan"
}
"example": {
"from": "paris",
"to": "london",
"miles": 292
}
}
}
Expand All @@ -351,11 +365,16 @@
"schema": {
"title": "Bad Request Error",
"type": "object",
"required": ["status", "message"],
"required": [
"status",
"message"
],
"properties": {
"status": {
"type": "integer",
"enum": [400]
"enum": [
400
]
},
"message": {
"type": "string"
Expand All @@ -381,11 +400,16 @@
"schema": {
"title": "Not Found Error",
"type": "object",
"required": ["status", "message"],
"required": [
"status",
"message"
],
"properties": {
"status": {
"type": "integer",
"enum": [404]
"enum": [
404
]
},
"message": {
"type": "string"
Expand All @@ -411,11 +435,16 @@
"schema": {
"title": "Unauthorized Error",
"type": "object",
"required": ["status", "message"],
"required": [
"status",
"message"
],
"properties": {
"status": {
"type": "integer",
"enum": [401]
"enum": [
401
]
},
"message": {
"type": "string"
Expand Down Expand Up @@ -454,56 +483,6 @@
}
}
},
"examples": {
"CityThurles": {
"$ref": "#/components/examples/ResponseCityThurles"
},
"RouteParisMilan": {
"$ref": "#/components/examples/ResponseRouteParisMilan"
},
"ResponseCities": {
"summary": "The response to a GET /v1/city call with result",
"value": {
"data": [
{
"id": "london",
"name": "London",
"country": "United Kingdom"
},
{
"id": "milan",
"name": "Milan",
"country": "Italia"
},
{
"id": "paris",
"name": "Paris",
"country": "France"
}
]
}
},
"ResponseCityThurles": {
"summary": "The response to a GET /v1/city call with result of Thurles in the Republic of Ireland",
"value": {
"data": {
"id": "thurles",
"name": "Thurles",
"country": "Éire"
}
}
},
"ResponseRouteParisMilan": {
"summary": "Example response to /v1/route endpoint with route from Paris to Milan",
"value": {
"data": {
"from": "paris",
"to": "milan",
"miles": 529
}
}
}
},
"parameters": {
"PathCityID": {
"in": "path",
Expand Down Expand Up @@ -570,7 +549,10 @@
"x-tagGroups": [
{
"name": "API",
"tags": ["City", "Route"]
"tags": [
"City",
"Route"
]
}
]
}
}
Loading

0 comments on commit c83c65b

Please sign in to comment.