Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pages for OAD examples #105

Merged
merged 15 commits into from
Aug 21, 2024
2 changes: 1 addition & 1 deletion .github/workflows/examples-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: schema-test
name: examples-test

# Author: @MikeRalphson / runs @jdesrosiers tests
# Issue: https://github.com/OAI/OpenAPI-Specification/pull/2489
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ GEM

PLATFORMS
arm64-darwin-21
arm64-darwin-23
x86_64-darwin-23
x86_64-linux

Expand Down
15 changes: 15 additions & 0 deletions _includes/example-api-description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# {{ include.name }}

{{ include.description }}

## JSON

```json
{% include_relative {{ include.name | append: ".json" }} %}
```

## YAML

```yaml
{% include_relative {{ include.name | append: ".yaml" }} %}
```
8 changes: 6 additions & 2 deletions _sass/custom/custom.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ object {
width: 100%;
}


.nav-list .nav-list-item .nav-list-expander {
color: #1d781d !important;
}
}

.highlight .err {
color: inherit;
background-color: inherit;
}
9 changes: 9 additions & 0 deletions examples/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
layout: default
title: Example API Descriptions
nav_order: 6
has_children: true
has_toc: true
---

# Example API Descriptions
2 changes: 1 addition & 1 deletion examples/v3.0/api-with-examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,4 +164,4 @@
}
}
}
}
}
13 changes: 13 additions & 0 deletions examples/v3.0/api-with-examples.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: default
title: api-with-examples
parent: Example API Descriptions
---

{% comment %}
{% capture description %}
Insert description here, then remove comment tag above and endcomment tag below
ralfhandl marked this conversation as resolved.
Show resolved Hide resolved
{% endcapture %}
{% endcomment %}

{% include example-api-description.md name=page.title description=description %}
232 changes: 120 additions & 112 deletions examples/v3.0/api-with-examples.yaml
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't yamlize examples

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
openapi: "3.0.0"
openapi: 3.0.0
info:
title: Simple API overview
version: 2.0.0
Expand All @@ -9,162 +9,170 @@ paths:
summary: List API versions
responses:
'200':
description: |-
200 response
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':
description: |-
300 response
description: 300 response
content:
application/json:
examples:
application/json:
examples:
foo:
value: |
{
"versions": [
value:
{
"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"
}
]
}
]
}
]
}
]
}
/v2:
get:
operationId: getVersionDetailsv2
summary: Show API version details
responses:
'200':
description: |-
200 response
"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':
description: |-
203 response
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"
}
]
}
}
6 changes: 2 additions & 4 deletions examples/v3.0/callback-example.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
"application/json": {
"schema": {
"description": "subscription information",
"required": [
"subscriptionId"
],
"required": ["subscriptionId"],
"properties": {
"subscriptionId": {
"description": "this unique identifier allows management of the subscription",
Expand Down Expand Up @@ -81,4 +79,4 @@
}
}
}
}
}
13 changes: 13 additions & 0 deletions examples/v3.0/callback-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: default
title: callback-example
parent: Example API Descriptions
---

{% comment %}
{% capture description %}
Insert description here, then remove comment tag above and endcomment tag below
{% endcapture %}
{% endcomment %}

{% include example-api-description.md name=page.title description=description %}
Loading