Skip to content

Update JSON example files #3

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

Closed
wants to merge 14 commits into from
51 changes: 51 additions & 0 deletions .github/workflows/yaml2json.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: YAML2JSON

# run this on push to master
on:
push:
branches:
- master
- try-github-actions

jobs:
yaml2json:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1 # checkout repo content

- name: Install dependencies
run: |
cd examples/v3.0
echo '{}' > composer.json
# fix versions to ensure reproduceable runs
composer require cebe/php-openapi:1.3.1 symfony/yaml:4.2.12

- name: convert YAML examples to JSON
run: |
cd examples/v3.0
vendor/bin/php-openapi convert --read-yaml callback-example.yaml --write-json callback-example.json
vendor/bin/php-openapi convert --read-yaml link-example.yaml --write-json link-example.json
vendor/bin/php-openapi convert --read-yaml petstore.yaml --write-json petstore.json
vendor/bin/php-openapi convert --read-yaml petstore-expanded.yaml --write-json petstore-expanded.json
vendor/bin/php-openapi convert --read-yaml uspto.yaml --write-json uspto.json

- name: cleanup
run: |
cd examples/v3.0
rm -rf vendor/ composer.*

- name: Create Pull Request
uses: peter-evans/create-pull-request@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch-suffix: none
branch: update-json-examples
title: Update JSON example files
commit-message: Update JSON example files
body: |
This pull request is automatically triggered by github actions.

It seems the OpenAPI example YAML files have changed, so the JSON files are automatically being adjusted.

192 changes: 192 additions & 0 deletions examples/v3.0/api-with-examples.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
{
"openapi": "3.0.0",
"info": {
"title": "Simple API overview",
"version": "2.0.0"
},
"paths": {
"\/": {
"get": {
"summary": "List API versions",
"operationId": "listVersionsv2",
"responses": {
"200": {
"description": "200 response",
"content": {
"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"
}
]
}
]
}
}
}
}
}
},
"300": {
"description": "300 response",
"content": {
"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"
}
]
}
]
}
}
}
}
}
}
}
}
},
"\/v2": {
"get": {
"summary": "Show API version details",
"operationId": "getVersionDetailsv2",
"responses": {
"200": {
"description": "200 response",
"content": {
"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"
}
]
}
}
}
}
}
}
},
"203": {
"description": "203 response",
"content": {
"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"
}
]
}
}
}
}
}
}
}
}
}
}
}
}
84 changes: 84 additions & 0 deletions examples/v3.0/callback-example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"openapi": "3.0.0",
"info": {
"title": "Callback Example",
"version": "1.0.0"
},
"paths": {
"\/streams": {
"post": {
"description": "subscribes a client to receive out-of-band data",
"parameters": [
{
"name": "callbackUrl",
"in": "query",
"description": "the location where data will be sent. Must be network accessible\nby the source server\n",
"required": true,
"schema": {
"type": "string",
"format": "uri",
"example": "https:\/\/tonys-server.com"
}
}
],
"responses": {
"201": {
"description": "subscription successfully created",
"content": {
"application\/json": {
"schema": {
"required": [
"subscriptionId"
],
"properties": {
"subscriptionId": {
"type": "string",
"description": "this unique identifier allows management of the subscription",
"example": "2531329f-fb09-4ef7-887e-84e648214436"
}
},
"description": "subscription information"
}
}
}
}
},
"callbacks": {
"onData": {
"{$request.query.callbackUrl}\/data": {
"post": {
"requestBody": {
"description": "subscription payload",
"content": {
"application\/json": {
"schema": {
"type": "object",
"properties": {
"timestamp": {
"type": "string",
"format": "date-time"
},
"userData": {
"type": "string"
}
}
}
}
}
},
"responses": {
"202": {
"description": "Your server implementation should return this HTTP status code\nif the data was received successfully\n"
},
"204": {
"description": "Your server should return this HTTP status code if no longer interested\nin further updates\n"
}
}
}
}
}
}
}
}
}
}
Loading