Skip to content

Commit

Permalink
prettier yaml examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfhandl committed Aug 14, 2024
1 parent 3324562 commit a69874b
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 301 deletions.
245 changes: 127 additions & 118 deletions examples/v3.0/api-with-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,163 +8,172 @@ paths:
operationId: listVersionsv2
summary: List API versions
responses:
'200':
"200":
description: |-
200 response
content:
application/json:
examples:
examples:
foo:
value:
{
"versions": [
{
"versions":
[
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"id": "v2.0",
"links": [
"links":
[
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
}
]
},
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self",
},
],
},
{
"status": "EXPERIMENTAL",
"updated": "2013-07-23T11:33:21Z",
"id": "v3.0",
"links": [
"links":
[
{
"href": "http://127.0.0.1:8774/v3/",
"rel": "self"
}
]
}
]
"href": "http://127.0.0.1:8774/v3/",
"rel": "self",
},
],
},
],
}
'300':
"300":
description: |-
300 response
content:
application/json:
examples:
application/json:
examples:
foo:
value: |
{
"versions": [
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
}
]
},
{
"status": "EXPERIMENTAL",
"updated": "2013-07-23T11:33:21Z",
"id": "v3.0",
"links": [
{
"href": "http://127.0.0.1:8774/v3/",
"rel": "self"
}
]
}
]
}
{
"versions": [
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
}
]
},
{
"status": "EXPERIMENTAL",
"updated": "2013-07-23T11:33:21Z",
"id": "v3.0",
"links": [
{
"href": "http://127.0.0.1:8774/v3/",
"rel": "self"
}
]
}
]
}
/v2:
get:
operationId: getVersionDetailsv2
summary: Show API version details
responses:
'200':
"200":
description: |-
200 response
content:
application/json:
application/json:
examples:
foo:
value:
{
"version": {
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"media-types": [
{
"base": "application/xml",
"type": "application/vnd.openstack.compute+xml;version=2"
},
{
"base": "application/json",
"type": "application/vnd.openstack.compute+json;version=2"
}
],
"id": "v2.0",
"links": [
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf",
"type": "application/pdf",
"rel": "describedby"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby"
}
]
}
"version":
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"media-types":
[
{
"base": "application/xml",
"type": "application/vnd.openstack.compute+xml;version=2",
},
{
"base": "application/json",
"type": "application/vnd.openstack.compute+json;version=2",
},
],
"id": "v2.0",
"links":
[
{
"href": "http://127.0.0.1:8774/v2/",
"rel": "self",
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf",
"type": "application/pdf",
"rel": "describedby",
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby",
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby",
},
],
},
}
'203':
"203":
description: |-
203 response
content:
application/json:
application/json:
examples:
foo:
value:
{
"version": {
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"media-types": [
{
"base": "application/xml",
"type": "application/vnd.openstack.compute+xml;version=2"
},
{
"base": "application/json",
"type": "application/vnd.openstack.compute+json;version=2"
}
],
"id": "v2.0",
"links": [
{
"href": "http://23.253.228.211:8774/v2/",
"rel": "self"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf",
"type": "application/pdf",
"rel": "describedby"
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby"
}
]
}
"version":
{
"status": "CURRENT",
"updated": "2011-01-21T11:33:21Z",
"media-types":
[
{
"base": "application/xml",
"type": "application/vnd.openstack.compute+xml;version=2",
},
{
"base": "application/json",
"type": "application/vnd.openstack.compute+json;version=2",
},
],
"id": "v2.0",
"links":
[
{
"href": "http://23.253.228.211:8774/v2/",
"rel": "self",
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/os-compute-devguide-2.pdf",
"type": "application/pdf",
"rel": "describedby",
},
{
"href": "http://docs.openstack.org/api/openstack-compute/2/wadl/os-compute-2.wadl",
"type": "application/vnd.sun.wadl+xml",
"rel": "describedby",
},
],
},
}
8 changes: 4 additions & 4 deletions examples/v3.0/callback-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ paths:
format: uri
example: https://tonys-server.com
responses:
'201':
"201":
description: subscription successfully created
content:
application/json:
Expand All @@ -36,7 +36,7 @@ paths:
onData:
# when data is sent, it will be sent to the `callbackUrl` provided
# when making the subscription PLUS the suffix `/data`
'{$request.query.callbackUrl}/data':
"{$request.query.callbackUrl}/data":
post:
requestBody:
description: subscription payload
Expand All @@ -51,11 +51,11 @@ paths:
userData:
type: string
responses:
'202':
"202":
description: |
Your server implementation should return this HTTP status code
if the data was received successfully
'204':
"204":
description: |
Your server should return this HTTP status code if no longer interested
in further updates
Loading

0 comments on commit a69874b

Please sign in to comment.