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
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 %}
245 changes: 127 additions & 118 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
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",
},
],
},
}
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