From 92a2ac1706e27bcd86997e33b3353b7fb57af375 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 09:30:28 +0100 Subject: [PATCH 01/14] Create yaml2json.yml --- .github/workflows/yaml2json.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/yaml2json.yml diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml new file mode 100644 index 0000000000..ab9cdaa747 --- /dev/null +++ b/.github/workflows/yaml2json.yml @@ -0,0 +1,25 @@ +name: YAML2JSON + +on: + push: + # Sequence of patterns matched against refs/heads + branches: + - master + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Install dependencies + run: | + cd examples/v3.0 + echo '{}' > composer.json + composer require cebe/php-openapi + + - name: convert YAML examples to JSON + run: | + cd examples/v3.0 + vendor/bin/php-openapi convert --read-yaml petstore.yaml --write-json petstore.json + From dbd1bacb25e68b6689f126aedf3009f15cdd7747 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 09:32:39 +0100 Subject: [PATCH 02/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index ab9cdaa747..b474946e34 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -1,10 +1,10 @@ name: YAML2JSON -on: - push: - # Sequence of patterns matched against refs/heads - branches: - - master +on: [push] +# push: +# # Sequence of patterns matched against refs/heads +# branches: +# - master jobs: build: From 0c0c18e2f02e6b5c8ce5774c894210b8502d39bc Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 09:36:03 +0100 Subject: [PATCH 03/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index b474946e34..7427420862 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -12,6 +12,9 @@ jobs: runs-on: ubuntu-latest steps: + # checkout repo content + - uses: actions/checkout@v1 + - name: Install dependencies run: | cd examples/v3.0 From d8300a948bd83c35863ca7950f35221ba0f479cd Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 09:45:20 +0100 Subject: [PATCH 04/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index 7427420862..f0afd32ccc 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -25,4 +25,12 @@ jobs: run: | cd examples/v3.0 vendor/bin/php-openapi convert --read-yaml petstore.yaml --write-json petstore.json + + - name: compare and upload + run: | + if (git status -s --porcelain | grep '.json' > /dev/null); + echo "upload" + else + echo "no changes" + fi From 770fa3c4e1b8e65656013b83faa5ff58f1c921be Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 09:46:40 +0100 Subject: [PATCH 05/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index f0afd32ccc..88a3874c98 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -28,7 +28,7 @@ jobs: - name: compare and upload run: | - if (git status -s --porcelain | grep '.json' > /dev/null); + if (git status -s --porcelain | grep '.json' > /dev/null); then echo "upload" else echo "no changes" From 86cc5ffabf303ad96f7bb22a3c35503a6232061c Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 10:00:33 +0100 Subject: [PATCH 06/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index 88a3874c98..8d0ce7dbc8 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -29,8 +29,17 @@ jobs: - name: compare and upload run: | if (git status -s --porcelain | grep '.json' > /dev/null); then - echo "upload" + echo "adding JSON changes" + git add *.json + git clean -f else echo "no changes" fi + - name: Create Pull Request + uses: peter-evans/create-pull-request@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch-suffix: none + branch: update-json-examples + commit-message: Update JSON example files From f9a099e7a1b12e9f403211ba5a5a7216934a33f8 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 10:04:58 +0100 Subject: [PATCH 07/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index 8d0ce7dbc8..0a8c90d7e7 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -28,10 +28,11 @@ jobs: - name: compare and upload run: | + cd examples/v3.0 + rm -rf vendor/ composer.* if (git status -s --porcelain | grep '.json' > /dev/null); then echo "adding JSON changes" git add *.json - git clean -f else echo "no changes" fi @@ -42,4 +43,5 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} branch-suffix: none branch: update-json-examples + title: Update JSON example files commit-message: Update JSON example files From 4080c38c5d2985122b9fbfa9730cf6f84d5858de Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 10:09:00 +0100 Subject: [PATCH 08/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index 0a8c90d7e7..ddcc8f2466 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -26,12 +26,12 @@ jobs: cd examples/v3.0 vendor/bin/php-openapi convert --read-yaml petstore.yaml --write-json petstore.json - - name: compare and upload + - name: compare and cleanup run: | cd examples/v3.0 rm -rf vendor/ composer.* if (git status -s --porcelain | grep '.json' > /dev/null); then - echo "adding JSON changes" + echo "adding JSON file changes" git add *.json else echo "no changes" From 93a091be70372e77b7297834c17c927889a9bbd3 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 10:18:46 +0100 Subject: [PATCH 09/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index ddcc8f2466..115fbbf957 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -1,41 +1,39 @@ name: YAML2JSON +# run this on push to master on: [push] # push: -# # Sequence of patterns matched against refs/heads # branches: # - master jobs: - build: + yaml2json: runs-on: ubuntu-latest steps: - # checkout repo content - - uses: actions/checkout@v1 + - uses: actions/checkout@v1 # checkout repo content - name: Install dependencies run: | cd examples/v3.0 - echo '{}' > composer.json - composer require cebe/php-openapi + 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 petstore.yaml --write-json petstore.json + 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: compare and cleanup + - name: cleanup run: | cd examples/v3.0 rm -rf vendor/ composer.* - if (git status -s --porcelain | grep '.json' > /dev/null); then - echo "adding JSON file changes" - git add *.json - else - echo "no changes" - fi - name: Create Pull Request uses: peter-evans/create-pull-request@v1 @@ -45,3 +43,8 @@ jobs: 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. + From 9c98e819ae876af92c2a9112dcfa6dfcb929e7dc Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 10:25:57 +0100 Subject: [PATCH 10/14] Update yaml2json.yml --- .github/workflows/yaml2json.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/yaml2json.yml b/.github/workflows/yaml2json.yml index 115fbbf957..1ada95f7bd 100644 --- a/.github/workflows/yaml2json.yml +++ b/.github/workflows/yaml2json.yml @@ -1,10 +1,11 @@ name: YAML2JSON # run this on push to master -on: [push] -# push: -# branches: -# - master +on: + push: + branches: + - master + - try-github-actions jobs: yaml2json: From 196a1fbc69fc785f976022058ba055a551f8f472 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 27 Nov 2019 09:26:40 +0000 Subject: [PATCH 11/14] Update JSON example files --- examples/v3.0/callback-example.json | 83 +++++ examples/v3.0/link-example.json | 487 +++++++++++++++++++++++++++ examples/v3.0/petstore-expanded.json | 382 +++++++++++++++++++++ examples/v3.0/petstore.json | 262 ++++++++++++++ examples/v3.0/uspto.json | 283 ++++++++++++++++ 5 files changed, 1497 insertions(+) create mode 100644 examples/v3.0/callback-example.json create mode 100644 examples/v3.0/link-example.json create mode 100644 examples/v3.0/petstore-expanded.json create mode 100644 examples/v3.0/petstore.json create mode 100644 examples/v3.0/uspto.json diff --git a/examples/v3.0/callback-example.json b/examples/v3.0/callback-example.json new file mode 100644 index 0000000000..40985f09dd --- /dev/null +++ b/examples/v3.0/callback-example.json @@ -0,0 +1,83 @@ +{ + "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": { + "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" + } + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/examples/v3.0/link-example.json b/examples/v3.0/link-example.json new file mode 100644 index 0000000000..5f1761e52e --- /dev/null +++ b/examples/v3.0/link-example.json @@ -0,0 +1,487 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Link Example", + "version": "1.0.0" + }, + "paths": { + "\/2.0\/users\/{username}": { + "get": { + "operationId": "getUserByName", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The User", + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + }, + "links": { + "userRepositories": { + "operationId": "getRepositoriesByOwner", + "parameters": { + "username": "$response.body#\/username" + } + } + } + } + } + } + }, + "\/2.0\/repositories\/{username}": { + "get": { + "operationId": "getRepositoriesByOwner", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "repositories owned by the supplied user", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + } + } + } + }, + "links": { + "userRepository": { + "operationId": "getRepository", + "parameters": { + "username": "$response.body#\/owner\/username", + "slug": "$response.body#\/slug" + } + } + } + } + } + } + }, + "\/2.0\/repositories\/{username}\/{slug}": { + "get": { + "operationId": "getRepository", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The repository", + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + } + } + }, + "links": { + "repositoryPullRequests": { + "operationId": "getPullRequestsByRepository", + "parameters": { + "username": "$response.body#\/owner\/username", + "slug": "$response.body#\/slug" + } + } + } + } + } + } + }, + "\/2.0\/repositories\/{username}\/{slug}\/pullrequests": { + "get": { + "operationId": "getPullRequestsByRepository", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "state", + "in": "query", + "schema": { + "enum": [ + "open", + "merged", + "declined" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "an array of pull request objects", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "repository": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + }, + "author": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + } + }, + "\/2.0\/repositories\/{username}\/{slug}\/pullrequests\/{pid}": { + "get": { + "operationId": "getPullRequestsById", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "pid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "a pull request object", + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "repository": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + }, + "author": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + } + } + }, + "links": { + "pullRequestMerge": { + "operationId": "mergePullRequest", + "parameters": { + "username": "$response.body#\/author\/username", + "slug": "$response.body#\/repository\/slug", + "pid": "$response.body#\/id" + } + } + } + } + } + } + }, + "\/2.0\/repositories\/{username}\/{slug}\/pullrequests\/{pid}\/merge": { + "post": { + "operationId": "mergePullRequest", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "pid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "204": { + "description": "the PR was successfully merged" + } + } + } + } + }, + "components": { + "schemas": { + "user": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, + "repository": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + }, + "pullrequest": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "repository": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + }, + "author": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + } + }, + "links": { + "UserRepositories": { + "operationId": "getRepositoriesByOwner", + "parameters": { + "username": "$response.body#\/username" + } + }, + "UserRepository": { + "operationId": "getRepository", + "parameters": { + "username": "$response.body#\/owner\/username", + "slug": "$response.body#\/slug" + } + }, + "RepositoryPullRequests": { + "operationId": "getPullRequestsByRepository", + "parameters": { + "username": "$response.body#\/owner\/username", + "slug": "$response.body#\/slug" + } + }, + "PullRequestMerge": { + "operationId": "mergePullRequest", + "parameters": { + "username": "$response.body#\/author\/username", + "slug": "$response.body#\/repository\/slug", + "pid": "$response.body#\/id" + } + } + } + } +} \ No newline at end of file diff --git a/examples/v3.0/petstore-expanded.json b/examples/v3.0/petstore-expanded.json new file mode 100644 index 0000000000..93068fb344 --- /dev/null +++ b/examples/v3.0/petstore-expanded.json @@ -0,0 +1,382 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Swagger Petstore", + "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification", + "termsOfService": "http:\/\/swagger.io\/terms\/", + "contact": { + "name": "Swagger API Team", + "url": "http:\/\/swagger.io", + "email": "apiteam@swagger.io" + }, + "license": { + "name": "Apache 2.0", + "url": "https:\/\/www.apache.org\/licenses\/LICENSE-2.0.html" + }, + "version": "1.0.0" + }, + "servers": [ + { + "url": "http:\/\/petstore.swagger.io\/api" + } + ], + "paths": { + "\/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", + "operationId": "findPets", + "parameters": [ + { + "name": "tags", + "in": "query", + "description": "tags to filter by", + "required": false, + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "limit", + "in": "query", + "description": "maximum number of results to return", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "allOf": [ + { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + { + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + ] + } + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + }, + "post": { + "description": "Creates a new pet in the store. Duplicates are allowed", + "operationId": "addPet", + "requestBody": { + "description": "Pet to add to the store", + "content": { + "application\/json": { + "schema": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "pet response", + "content": { + "application\/json": { + "schema": { + "allOf": [ + { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + { + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + ] + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "\/pets\/{id}": { + "get": { + "description": "Returns a user based on a single ID, if the user does not have access to the pet", + "operationId": "find pet by id", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to fetch", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "content": { + "application\/json": { + "schema": { + "allOf": [ + { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + { + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + ] + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + }, + "delete": { + "description": "deletes a single pet based on the ID supplied", + "operationId": "deletePet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "pet deleted" + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Pet": { + "allOf": [ + { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + { + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + ] + }, + "NewPet": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "Error": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/examples/v3.0/petstore.json b/examples/v3.0/petstore.json new file mode 100644 index 0000000000..f15a39cf4b --- /dev/null +++ b/examples/v3.0/petstore.json @@ -0,0 +1,262 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Swagger Petstore", + "license": { + "name": "MIT" + }, + "version": "1.0.0" + }, + "servers": [ + { + "url": "http:\/\/petstore.swagger.io\/v1" + } + ], + "paths": { + "\/pets": { + "get": { + "tags": [ + "pets" + ], + "summary": "List all pets", + "operationId": "listPets", + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "How many items to return at one time (max 100)", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "A paged array of pets", + "headers": { + "x-next": { + "description": "A link to the next page of responses", + "schema": { + "type": "string" + } + } + }, + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + } + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + }, + "post": { + "tags": [ + "pets" + ], + "summary": "Create a pet", + "operationId": "createPets", + "responses": { + "201": { + "description": "Null response" + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "\/pets\/{petId}": { + "get": { + "tags": [ + "pets" + ], + "summary": "Info for a specific pet", + "operationId": "showPetById", + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "The id of the pet to retrieve", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Expected response to a valid request", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + } + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Pet": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "Pets": { + "type": "array", + "items": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + } + }, + "Error": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/examples/v3.0/uspto.json b/examples/v3.0/uspto.json new file mode 100644 index 0000000000..99eaa110d4 --- /dev/null +++ b/examples/v3.0/uspto.json @@ -0,0 +1,283 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "USPTO Data Set API", + "description": "The Data Set API (DSAPI) allows the public users to discover and search USPTO exported data sets. This is a generic API that allows USPTO users to make any CSV based data files searchable through API. With the help of GET call, it returns the list of data fields that are searchable. With the help of POST call, data can be fetched based on the filters on the field names. Please note that POST call is used to search the actual data. The reason for the POST call is that it allows users to specify any complex search criteria without worry about the GET size limitations as well as encoding of the input parameters.", + "contact": { + "name": "Open Data Portal", + "url": "https:\/\/developer.uspto.gov", + "email": "developer@uspto.gov" + }, + "version": "1.0.0" + }, + "servers": [ + { + "url": "{scheme}:\/\/developer.uspto.gov\/ds-api", + "variables": { + "scheme": { + "enum": [ + "https", + "http" + ], + "default": "https", + "description": "The Data Set API is accessible via https and http" + } + } + } + ], + "paths": { + "\/": { + "get": { + "tags": [ + "metadata" + ], + "summary": "List available data sets", + "operationId": "list-data-sets", + "responses": { + "200": { + "description": "Returns a list of data sets", + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "total": { + "type": "integer" + }, + "apis": { + "type": "array", + "items": { + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "description": "To be used as a dataset parameter value" + }, + "apiVersionNumber": { + "type": "string", + "description": "To be used as a version parameter value" + }, + "apiUrl": { + "type": "string", + "description": "The URL describing the dataset's fields", + "format": "uriref" + }, + "apiDocumentationUrl": { + "type": "string", + "description": "A URL to the API console for each API", + "format": "uriref" + } + } + } + } + } + }, + "example": { + "total": 2, + "apis": [ + { + "apiKey": "oa_citations", + "apiVersionNumber": "v1", + "apiUrl": "https:\/\/developer.uspto.gov\/ds-api\/oa_citations\/v1\/fields", + "apiDocumentationUrl": "https:\/\/developer.uspto.gov\/ds-api-docs\/index.html?url=https:\/\/developer.uspto.gov\/ds-api\/swagger\/docs\/oa_citations.json" + }, + { + "apiKey": "cancer_moonshot", + "apiVersionNumber": "v1", + "apiUrl": "https:\/\/developer.uspto.gov\/ds-api\/cancer_moonshot\/v1\/fields", + "apiDocumentationUrl": "https:\/\/developer.uspto.gov\/ds-api-docs\/index.html?url=https:\/\/developer.uspto.gov\/ds-api\/swagger\/docs\/cancer_moonshot.json" + } + ] + } + } + } + } + } + } + }, + "\/{dataset}\/{version}\/fields": { + "get": { + "tags": [ + "metadata" + ], + "summary": "Provides the general information about the API and the list of fields that can be used to query the dataset.", + "description": "This GET API returns the list of all the searchable field names that are in the oa_citations. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the syntax options shown below.", + "operationId": "list-searchable-fields", + "parameters": [ + { + "name": "dataset", + "in": "path", + "description": "Name of the dataset.", + "required": true, + "schema": { + "type": "string" + }, + "example": "oa_citations" + }, + { + "name": "version", + "in": "path", + "description": "Version of the dataset.", + "required": true, + "schema": { + "type": "string" + }, + "example": "v1" + } + ], + "responses": { + "200": { + "description": "The dataset API for the given version is found and it is accessible to consume.", + "content": { + "application\/json": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "The combination of dataset name and version is not found in the system or it is not published yet to be consumed by public.", + "content": { + "application\/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "\/{dataset}\/{version}\/records": { + "post": { + "tags": [ + "search" + ], + "summary": "Provides search capability for the data set with the given search criteria.", + "description": "This API is based on Solr\/Lucense Search. The data is indexed using SOLR. This GET API returns the list of all the searchable field names that are in the Solr Index. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the Solr\/Lucene Syntax. Please refer https:\/\/lucene.apache.org\/core\/3_6_2\/queryparsersyntax.html#Overview for the query syntax. List of field names that are searchable can be determined using above GET api.", + "operationId": "perform-search", + "parameters": [ + { + "name": "version", + "in": "path", + "description": "Version of the dataset.", + "required": true, + "schema": { + "type": "string", + "default": "v1" + } + }, + { + "name": "dataset", + "in": "path", + "description": "Name of the dataset. In this case, the default value is oa_citations", + "required": true, + "schema": { + "type": "string", + "default": "oa_citations" + } + } + ], + "requestBody": { + "content": { + "application\/x-www-form-urlencoded": { + "schema": { + "required": [ + "criteria" + ], + "type": "object", + "properties": { + "criteria": { + "type": "string", + "description": "Uses Lucene Query Syntax in the format of propertyName:value, propertyName:[num1 TO num2] and date range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the response please see the 'docs' element which has the list of record objects. Each record structure would consist of all the fields and their corresponding values.", + "default": "*:*" + }, + "start": { + "type": "integer", + "description": "Starting record number. Default value is 0.", + "default": 0 + }, + "rows": { + "type": "integer", + "description": "Specify number of rows to be returned. If you run the search with default values, in the response you will see 'numFound' attribute which will tell the number of records available in the dataset.", + "default": 100 + } + } + } + } + } + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "object" + } + } + } + } + } + }, + "404": { + "description": "No matching record found for the given criteria." + } + } + } + } + }, + "components": { + "schemas": { + "dataSetList": { + "type": "object", + "properties": { + "total": { + "type": "integer" + }, + "apis": { + "type": "array", + "items": { + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "description": "To be used as a dataset parameter value" + }, + "apiVersionNumber": { + "type": "string", + "description": "To be used as a version parameter value" + }, + "apiUrl": { + "type": "string", + "description": "The URL describing the dataset's fields", + "format": "uriref" + }, + "apiDocumentationUrl": { + "type": "string", + "description": "A URL to the API console for each API", + "format": "uriref" + } + } + } + } + } + } + } + }, + "tags": [ + { + "name": "metadata", + "description": "Find out about the data sets" + }, + { + "name": "search", + "description": "Search a data set" + } + ] +} \ No newline at end of file From 91c2378756ce9769888d63460e55e70f559c97d7 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Fri, 6 Dec 2019 08:11:20 +0000 Subject: [PATCH 12/14] Update JSON example files --- examples/v3.0/callback-example.json | 146 ++--- examples/v3.0/link-example.json | 870 +++++++++++++-------------- examples/v3.0/petstore-expanded.json | 678 ++++++++++----------- examples/v3.0/petstore.json | 462 +++++++------- examples/v3.0/uspto.json | 520 ++++++++-------- 5 files changed, 1338 insertions(+), 1338 deletions(-) diff --git a/examples/v3.0/callback-example.json b/examples/v3.0/callback-example.json index 40985f09dd..28734489ae 100644 --- a/examples/v3.0/callback-example.json +++ b/examples/v3.0/callback-example.json @@ -1,83 +1,83 @@ { - "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" - } + "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" } - ], - "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" - } - } + }, + "description": "subscription information" + } + } + } + } + }, + "callbacks": { + "onData": { + "{$request.query.callbackUrl}\/data": { + "post": { + "requestBody": { + "description": "subscription payload", + "content": { + "application\/json": { + "schema": { + "properties": { + "timestamp": { + "type": "string", + "format": "date-time" + }, + "userData": { + "type": "string" + } } + } } + } }, - "callbacks": { - "onData": { - "{$request.query.callbackUrl}\/data": { - "post": { - "requestBody": { - "description": "subscription payload", - "content": { - "application\/json": { - "schema": { - "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" - } - } - } - } - } + "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" + } } + } } + } } + } } + } } \ No newline at end of file diff --git a/examples/v3.0/link-example.json b/examples/v3.0/link-example.json index 5f1761e52e..c3f1535a0d 100644 --- a/examples/v3.0/link-example.json +++ b/examples/v3.0/link-example.json @@ -1,487 +1,487 @@ { - "openapi": "3.0.0", - "info": { - "title": "Link Example", - "version": "1.0.0" - }, - "paths": { - "\/2.0\/users\/{username}": { - "get": { - "operationId": "getUserByName", - "parameters": [ - { - "name": "username", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "The User", - "content": { - "application\/json": { - "schema": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - } - } - }, - "links": { - "userRepositories": { - "operationId": "getRepositoriesByOwner", - "parameters": { - "username": "$response.body#\/username" - } - } - } + "openapi": "3.0.0", + "info": { + "title": "Link Example", + "version": "1.0.0" + }, + "paths": { + "\/2.0\/users\/{username}": { + "get": { + "operationId": "getUserByName", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The User", + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" } + } } - } - }, - "\/2.0\/repositories\/{username}": { - "get": { + } + }, + "links": { + "userRepositories": { "operationId": "getRepositoriesByOwner", - "parameters": [ - { - "name": "username", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "repositories owned by the supplied user", - "content": { - "application\/json": { - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "slug": { - "type": "string" - }, - "owner": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - } - } - } - } - } - }, - "links": { - "userRepository": { - "operationId": "getRepository", - "parameters": { - "username": "$response.body#\/owner\/username", - "slug": "$response.body#\/slug" - } - } - } - } + "parameters": { + "username": "$response.body#\/username" } + } } - }, - "\/2.0\/repositories\/{username}\/{slug}": { - "get": { - "operationId": "getRepository", - "parameters": [ - { - "name": "username", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "slug", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "The repository", - "content": { - "application\/json": { - "schema": { - "type": "object", - "properties": { - "slug": { - "type": "string" - }, - "owner": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - } - } - } - } - }, - "links": { - "repositoryPullRequests": { - "operationId": "getPullRequestsByRepository", - "parameters": { - "username": "$response.body#\/owner\/username", - "slug": "$response.body#\/slug" - } - } - } - } - } + } + } + } + }, + "\/2.0\/repositories\/{username}": { + "get": { + "operationId": "getRepositoriesByOwner", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" } - }, - "\/2.0\/repositories\/{username}\/{slug}\/pullrequests": { - "get": { - "operationId": "getPullRequestsByRepository", - "parameters": [ - { - "name": "username", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "slug", - "in": "path", - "required": true, - "schema": { + } + ], + "responses": { + "200": { + "description": "repositories owned by the supplied user", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { "type": "string" - } - }, - { - "name": "state", - "in": "query", - "schema": { - "enum": [ - "open", - "merged", - "declined" - ], + }, + "uuid": { "type": "string" + } } + } } - ], - "responses": { - "200": { - "description": "an array of pull request objects", - "content": { - "application\/json": { - "schema": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "repository": { - "type": "object", - "properties": { - "slug": { - "type": "string" - }, - "owner": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - } - } - }, - "author": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - } - } - } - } - } - } - } + } + } + } + }, + "links": { + "userRepository": { + "operationId": "getRepository", + "parameters": { + "username": "$response.body#\/owner\/username", + "slug": "$response.body#\/slug" } + } } - }, - "\/2.0\/repositories\/{username}\/{slug}\/pullrequests\/{pid}": { - "get": { - "operationId": "getPullRequestsById", - "parameters": [ - { - "name": "username", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "slug", - "in": "path", - "required": true, - "schema": { - "type": "string" - } + } + } + } + }, + "\/2.0\/repositories\/{username}\/{slug}": { + "get": { + "operationId": "getRepository", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "The repository", + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "slug": { + "type": "string" }, - { - "name": "pid", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "a pull request object", - "content": { - "application\/json": { - "schema": { - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "repository": { - "type": "object", - "properties": { - "slug": { - "type": "string" - }, - "owner": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - } - } - }, - "author": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - } - } - } - } + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" }, - "links": { - "pullRequestMerge": { - "operationId": "mergePullRequest", - "parameters": { - "username": "$response.body#\/author\/username", - "slug": "$response.body#\/repository\/slug", - "pid": "$response.body#\/id" - } - } + "uuid": { + "type": "string" } + } } + } } - } - }, - "\/2.0\/repositories\/{username}\/{slug}\/pullrequests\/{pid}\/merge": { - "post": { - "operationId": "mergePullRequest", - "parameters": [ - { - "name": "username", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "slug", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "pid", - "in": "path", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "204": { - "description": "the PR was successfully merged" - } + } + }, + "links": { + "repositoryPullRequests": { + "operationId": "getPullRequestsByRepository", + "parameters": { + "username": "$response.body#\/owner\/username", + "slug": "$response.body#\/slug" } + } } + } } + } }, - "components": { - "schemas": { - "user": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } - }, - "repository": { - "type": "object", - "properties": { - "slug": { + "\/2.0\/repositories\/{username}\/{slug}\/pullrequests": { + "get": { + "operationId": "getPullRequestsByRepository", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "state", + "in": "query", + "schema": { + "enum": [ + "open", + "merged", + "declined" + ], + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "an array of pull request objects", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "title": { "type": "string" - }, - "owner": { + }, + "repository": { "type": "object", "properties": { - "username": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { "type": "string" - }, - "uuid": { + }, + "uuid": { "type": "string" + } } + } } + }, + "author": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } } + } } - }, - "pullrequest": { - "type": "object", - "properties": { + } + } + } + } + } + }, + "\/2.0\/repositories\/{username}\/{slug}\/pullrequests\/{pid}": { + "get": { + "operationId": "getPullRequestsById", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "pid", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "a pull request object", + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { "id": { - "type": "integer" + "type": "integer" }, "title": { - "type": "string" + "type": "string" }, "repository": { - "type": "object", - "properties": { - "slug": { - "type": "string" + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" }, - "owner": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } - } + "uuid": { + "type": "string" } + } } + } }, "author": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "uuid": { - "type": "string" - } + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" } + } } + } } - } - }, - "links": { - "UserRepositories": { - "operationId": "getRepositoriesByOwner", - "parameters": { - "username": "$response.body#\/username" - } - }, - "UserRepository": { - "operationId": "getRepository", - "parameters": { - "username": "$response.body#\/owner\/username", - "slug": "$response.body#\/slug" - } - }, - "RepositoryPullRequests": { - "operationId": "getPullRequestsByRepository", - "parameters": { - "username": "$response.body#\/owner\/username", - "slug": "$response.body#\/slug" - } + } }, - "PullRequestMerge": { + "links": { + "pullRequestMerge": { "operationId": "mergePullRequest", "parameters": { - "username": "$response.body#\/author\/username", - "slug": "$response.body#\/repository\/slug", - "pid": "$response.body#\/id" + "username": "$response.body#\/author\/username", + "slug": "$response.body#\/repository\/slug", + "pid": "$response.body#\/id" } + } + } + } + } + } + }, + "\/2.0\/repositories\/{username}\/{slug}\/pullrequests\/{pid}\/merge": { + "post": { + "operationId": "mergePullRequest", + "parameters": [ + { + "name": "username", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "pid", + "in": "path", + "required": true, + "schema": { + "type": "string" } + } + ], + "responses": { + "204": { + "description": "the PR was successfully merged" + } + } + } + } + }, + "components": { + "schemas": { + "user": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + }, + "repository": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + }, + "pullrequest": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "repository": { + "type": "object", + "properties": { + "slug": { + "type": "string" + }, + "owner": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + }, + "author": { + "type": "object", + "properties": { + "username": { + "type": "string" + }, + "uuid": { + "type": "string" + } + } + } + } + } + }, + "links": { + "UserRepositories": { + "operationId": "getRepositoriesByOwner", + "parameters": { + "username": "$response.body#\/username" + } + }, + "UserRepository": { + "operationId": "getRepository", + "parameters": { + "username": "$response.body#\/owner\/username", + "slug": "$response.body#\/slug" + } + }, + "RepositoryPullRequests": { + "operationId": "getPullRequestsByRepository", + "parameters": { + "username": "$response.body#\/owner\/username", + "slug": "$response.body#\/slug" + } + }, + "PullRequestMerge": { + "operationId": "mergePullRequest", + "parameters": { + "username": "$response.body#\/author\/username", + "slug": "$response.body#\/repository\/slug", + "pid": "$response.body#\/id" } + } } + } } \ No newline at end of file diff --git a/examples/v3.0/petstore-expanded.json b/examples/v3.0/petstore-expanded.json index 93068fb344..aacba7145d 100644 --- a/examples/v3.0/petstore-expanded.json +++ b/examples/v3.0/petstore-expanded.json @@ -1,382 +1,382 @@ { - "openapi": "3.0.0", - "info": { - "title": "Swagger Petstore", - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification", - "termsOfService": "http:\/\/swagger.io\/terms\/", - "contact": { - "name": "Swagger API Team", - "url": "http:\/\/swagger.io", - "email": "apiteam@swagger.io" - }, - "license": { - "name": "Apache 2.0", - "url": "https:\/\/www.apache.org\/licenses\/LICENSE-2.0.html" - }, - "version": "1.0.0" + "openapi": "3.0.0", + "info": { + "title": "Swagger Petstore", + "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification", + "termsOfService": "http:\/\/swagger.io\/terms\/", + "contact": { + "name": "Swagger API Team", + "url": "http:\/\/swagger.io", + "email": "apiteam@swagger.io" }, - "servers": [ - { - "url": "http:\/\/petstore.swagger.io\/api" - } - ], - "paths": { - "\/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", - "operationId": "findPets", - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "tags to filter by", - "required": false, - "style": "form", - "schema": { - "type": "array", - "items": { - "type": "string" - } + "license": { + "name": "Apache 2.0", + "url": "https:\/\/www.apache.org\/licenses\/LICENSE-2.0.html" + }, + "version": "1.0.0" + }, + "servers": [ + { + "url": "http:\/\/petstore.swagger.io\/api" + } + ], + "paths": { + "\/pets": { + "get": { + "description": "Returns all pets from the system that the user has access to\nNam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia.\n\nSed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien.\n", + "operationId": "findPets", + "parameters": [ + { + "name": "tags", + "in": "query", + "description": "tags to filter by", + "required": false, + "style": "form", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "limit", + "in": "query", + "description": "maximum number of results to return", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "allOf": [ + { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } } - }, - { - "name": "limit", - "in": "query", - "description": "maximum number of results to return", - "required": false, - "schema": { + }, + { + "required": [ + "id" + ], + "properties": { + "id": { "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application\/json": { - "schema": { - "type": "array", - "items": { - "allOf": [ - { - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - { - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - } - } - } - ] - } - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application\/json": { - "schema": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } + "format": "int64" + } } - } + } + ] + } } - }, - "post": { - "description": "Creates a new pet in the store. Duplicates are allowed", - "operationId": "addPet", - "requestBody": { - "description": "Pet to add to the store", - "content": { - "application\/json": { - "schema": { - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application\/json": { - "schema": { - "allOf": [ - { - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - { - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - } - } - } - ] - } - } - } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" }, - "default": { - "description": "unexpected error", - "content": { - "application\/json": { - "schema": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } + "message": { + "type": "string" } + } } + } } + } + } + }, + "post": { + "description": "Creates a new pet in the store. Duplicates are allowed", + "operationId": "addPet", + "requestBody": { + "description": "Pet to add to the store", + "content": { + "application\/json": { + "schema": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + } + } + }, + "required": true }, - "\/pets\/{id}": { - "get": { - "description": "Returns a user based on a single ID, if the user does not have access to the pet", - "operationId": "find pet by id", - "parameters": [ + "responses": { + "200": { + "description": "pet response", + "content": { + "application\/json": { + "schema": { + "allOf": [ { - "name": "id", - "in": "path", - "description": "ID of pet to fetch", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application\/json": { - "schema": { - "allOf": [ - { - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - { - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - } - } - } - ] - } - } + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" } + } }, - "default": { - "description": "unexpected error", - "content": { - "application\/json": { - "schema": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - }, - "delete": { - "description": "deletes a single pet based on the ID supplied", - "operationId": "deletePet", - "parameters": [ { - "name": "id", - "in": "path", - "description": "ID of pet to delete", - "required": true, - "schema": { - "type": "integer", - "format": "int64" + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" } + } } - ], - "responses": { - "204": { - "description": "pet deleted" + ] + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" }, - "default": { - "description": "unexpected error", - "content": { - "application\/json": { - "schema": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } + "message": { + "type": "string" } + } } + } } + } } + } }, - "components": { - "schemas": { - "Pet": { - "allOf": [ + "\/pets\/{id}": { + "get": { + "description": "Returns a user based on a single ID, if the user does not have access to the pet", + "operationId": "find pet by id", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to fetch", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "pet response", + "content": { + "application\/json": { + "schema": { + "allOf": [ { - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" } + } }, { - "required": [ - "id" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - } + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" } + } } - ] - }, - "NewPet": { - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" + ] + } + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" }, - "tag": { - "type": "string" + "message": { + "type": "string" } + } } - }, - "Error": { - "required": [ + } + } + } + } + }, + "delete": { + "description": "deletes a single pet based on the ID supplied", + "operationId": "deletePet", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "ID of pet to delete", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "204": { + "description": "pet deleted" + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ "code", "message" - ], - "properties": { + ], + "properties": { "code": { - "type": "integer", - "format": "int32" + "type": "integer", + "format": "int32" }, "message": { - "type": "string" + "type": "string" } + } } + } } + } + } + } + } + }, + "components": { + "schemas": { + "Pet": { + "allOf": [ + { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + { + "required": [ + "id" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + } + } + } + ] + }, + "NewPet": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "Error": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } } + } } + } } \ No newline at end of file diff --git a/examples/v3.0/petstore.json b/examples/v3.0/petstore.json index f15a39cf4b..b74218f433 100644 --- a/examples/v3.0/petstore.json +++ b/examples/v3.0/petstore.json @@ -1,262 +1,262 @@ { - "openapi": "3.0.0", - "info": { - "title": "Swagger Petstore", - "license": { - "name": "MIT" - }, - "version": "1.0.0" + "openapi": "3.0.0", + "info": { + "title": "Swagger Petstore", + "license": { + "name": "MIT" }, - "servers": [ - { - "url": "http:\/\/petstore.swagger.io\/v1" - } - ], - "paths": { - "\/pets": { - "get": { - "tags": [ - "pets" - ], - "summary": "List all pets", - "operationId": "listPets", - "parameters": [ - { - "name": "limit", - "in": "query", - "description": "How many items to return at one time (max 100)", - "required": false, - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "A paged array of pets", - "headers": { - "x-next": { - "description": "A link to the next page of responses", - "schema": { - "type": "string" - } - } - }, - "content": { - "application\/json": { - "schema": { - "type": "array", - "items": { - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - } - } - } - }, - "default": { - "description": "unexpected error", - "content": { - "application\/json": { - "schema": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - } + "version": "1.0.0" + }, + "servers": [ + { + "url": "http:\/\/petstore.swagger.io\/v1" + } + ], + "paths": { + "\/pets": { + "get": { + "tags": [ + "pets" + ], + "summary": "List all pets", + "operationId": "listPets", + "parameters": [ + { + "name": "limit", + "in": "query", + "description": "How many items to return at one time (max 100)", + "required": false, + "schema": { + "type": "integer", + "format": "int32" + } + } + ], + "responses": { + "200": { + "description": "A paged array of pets", + "headers": { + "x-next": { + "description": "A link to the next page of responses", + "schema": { + "type": "string" } + } }, - "post": { - "tags": [ - "pets" - ], - "summary": "Create a pet", - "operationId": "createPets", - "responses": { - "201": { - "description": "Null response" - }, - "default": { - "description": "unexpected error", - "content": { - "application\/json": { - "schema": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } } + } } + } } - }, - "\/pets\/{petId}": { - "get": { - "tags": [ - "pets" - ], - "summary": "Info for a specific pet", - "operationId": "showPetById", - "parameters": [ - { - "name": "petId", - "in": "path", - "description": "The id of the pet to retrieve", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Expected response to a valid request", - "content": { - "application\/json": { - "schema": { - "type": "array", - "items": { - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - } - } - } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" }, - "default": { - "description": "unexpected error", - "content": { - "application\/json": { - "schema": { - "required": [ - "code", - "message" - ], - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } + "message": { + "type": "string" } + } } + } } + } } - }, - "components": { - "schemas": { - "Pet": { - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" + }, + "post": { + "tags": [ + "pets" + ], + "summary": "Create a pet", + "operationId": "createPets", + "responses": { + "201": { + "description": "Null response" + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" }, - "tag": { - "type": "string" + "message": { + "type": "string" } + } } - }, - "Pets": { - "type": "array", - "items": { + } + } + } + } + } + }, + "\/pets\/{petId}": { + "get": { + "tags": [ + "pets" + ], + "summary": "Info for a specific pet", + "operationId": "showPetById", + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "The id of the pet to retrieve", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Expected response to a valid request", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { "required": [ - "id", - "name" + "id", + "name" ], "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } } + } } - }, - "Error": { - "required": [ + } + } + }, + "default": { + "description": "unexpected error", + "content": { + "application\/json": { + "schema": { + "required": [ "code", "message" - ], - "properties": { + ], + "properties": { "code": { - "type": "integer", - "format": "int32" + "type": "integer", + "format": "int32" }, "message": { - "type": "string" + "type": "string" } + } } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Pet": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "Pets": { + "type": "array", + "items": { + "required": [ + "id", + "name" + ], + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" } + } + } + }, + "Error": { + "required": [ + "code", + "message" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } } + } } + } } \ No newline at end of file diff --git a/examples/v3.0/uspto.json b/examples/v3.0/uspto.json index 99eaa110d4..ae87606579 100644 --- a/examples/v3.0/uspto.json +++ b/examples/v3.0/uspto.json @@ -1,283 +1,283 @@ { - "openapi": "3.0.1", - "info": { - "title": "USPTO Data Set API", - "description": "The Data Set API (DSAPI) allows the public users to discover and search USPTO exported data sets. This is a generic API that allows USPTO users to make any CSV based data files searchable through API. With the help of GET call, it returns the list of data fields that are searchable. With the help of POST call, data can be fetched based on the filters on the field names. Please note that POST call is used to search the actual data. The reason for the POST call is that it allows users to specify any complex search criteria without worry about the GET size limitations as well as encoding of the input parameters.", - "contact": { - "name": "Open Data Portal", - "url": "https:\/\/developer.uspto.gov", - "email": "developer@uspto.gov" - }, - "version": "1.0.0" + "openapi": "3.0.1", + "info": { + "title": "USPTO Data Set API", + "description": "The Data Set API (DSAPI) allows the public users to discover and search USPTO exported data sets. This is a generic API that allows USPTO users to make any CSV based data files searchable through API. With the help of GET call, it returns the list of data fields that are searchable. With the help of POST call, data can be fetched based on the filters on the field names. Please note that POST call is used to search the actual data. The reason for the POST call is that it allows users to specify any complex search criteria without worry about the GET size limitations as well as encoding of the input parameters.", + "contact": { + "name": "Open Data Portal", + "url": "https:\/\/developer.uspto.gov", + "email": "developer@uspto.gov" }, - "servers": [ - { - "url": "{scheme}:\/\/developer.uspto.gov\/ds-api", - "variables": { - "scheme": { - "enum": [ - "https", - "http" - ], - "default": "https", - "description": "The Data Set API is accessible via https and http" - } - } + "version": "1.0.0" + }, + "servers": [ + { + "url": "{scheme}:\/\/developer.uspto.gov\/ds-api", + "variables": { + "scheme": { + "enum": [ + "https", + "http" + ], + "default": "https", + "description": "The Data Set API is accessible via https and http" } - ], - "paths": { - "\/": { - "get": { - "tags": [ - "metadata" - ], - "summary": "List available data sets", - "operationId": "list-data-sets", - "responses": { - "200": { - "description": "Returns a list of data sets", - "content": { - "application\/json": { - "schema": { - "type": "object", - "properties": { - "total": { - "type": "integer" - }, - "apis": { - "type": "array", - "items": { - "type": "object", - "properties": { - "apiKey": { - "type": "string", - "description": "To be used as a dataset parameter value" - }, - "apiVersionNumber": { - "type": "string", - "description": "To be used as a version parameter value" - }, - "apiUrl": { - "type": "string", - "description": "The URL describing the dataset's fields", - "format": "uriref" - }, - "apiDocumentationUrl": { - "type": "string", - "description": "A URL to the API console for each API", - "format": "uriref" - } - } - } - } - } - }, - "example": { - "total": 2, - "apis": [ - { - "apiKey": "oa_citations", - "apiVersionNumber": "v1", - "apiUrl": "https:\/\/developer.uspto.gov\/ds-api\/oa_citations\/v1\/fields", - "apiDocumentationUrl": "https:\/\/developer.uspto.gov\/ds-api-docs\/index.html?url=https:\/\/developer.uspto.gov\/ds-api\/swagger\/docs\/oa_citations.json" - }, - { - "apiKey": "cancer_moonshot", - "apiVersionNumber": "v1", - "apiUrl": "https:\/\/developer.uspto.gov\/ds-api\/cancer_moonshot\/v1\/fields", - "apiDocumentationUrl": "https:\/\/developer.uspto.gov\/ds-api-docs\/index.html?url=https:\/\/developer.uspto.gov\/ds-api\/swagger\/docs\/cancer_moonshot.json" - } - ] - } - } - } - } - } - } - }, - "\/{dataset}\/{version}\/fields": { - "get": { - "tags": [ - "metadata" - ], - "summary": "Provides the general information about the API and the list of fields that can be used to query the dataset.", - "description": "This GET API returns the list of all the searchable field names that are in the oa_citations. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the syntax options shown below.", - "operationId": "list-searchable-fields", - "parameters": [ - { - "name": "dataset", - "in": "path", - "description": "Name of the dataset.", - "required": true, - "schema": { - "type": "string" - }, - "example": "oa_citations" - }, - { - "name": "version", - "in": "path", - "description": "Version of the dataset.", - "required": true, - "schema": { - "type": "string" - }, - "example": "v1" - } - ], - "responses": { - "200": { - "description": "The dataset API for the given version is found and it is accessible to consume.", - "content": { - "application\/json": { - "schema": { - "type": "string" - } - } - } + } + } + ], + "paths": { + "\/": { + "get": { + "tags": [ + "metadata" + ], + "summary": "List available data sets", + "operationId": "list-data-sets", + "responses": { + "200": { + "description": "Returns a list of data sets", + "content": { + "application\/json": { + "schema": { + "type": "object", + "properties": { + "total": { + "type": "integer" }, - "404": { - "description": "The combination of dataset name and version is not found in the system or it is not published yet to be consumed by public.", - "content": { - "application\/json": { - "schema": { - "type": "string" - } - } - } - } - } - } - }, - "\/{dataset}\/{version}\/records": { - "post": { - "tags": [ - "search" - ], - "summary": "Provides search capability for the data set with the given search criteria.", - "description": "This API is based on Solr\/Lucense Search. The data is indexed using SOLR. This GET API returns the list of all the searchable field names that are in the Solr Index. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the Solr\/Lucene Syntax. Please refer https:\/\/lucene.apache.org\/core\/3_6_2\/queryparsersyntax.html#Overview for the query syntax. List of field names that are searchable can be determined using above GET api.", - "operationId": "perform-search", - "parameters": [ - { - "name": "version", - "in": "path", - "description": "Version of the dataset.", - "required": true, - "schema": { + "apis": { + "type": "array", + "items": { + "type": "object", + "properties": { + "apiKey": { "type": "string", - "default": "v1" - } - }, - { - "name": "dataset", - "in": "path", - "description": "Name of the dataset. In this case, the default value is oa_citations", - "required": true, - "schema": { + "description": "To be used as a dataset parameter value" + }, + "apiVersionNumber": { "type": "string", - "default": "oa_citations" - } - } - ], - "requestBody": { - "content": { - "application\/x-www-form-urlencoded": { - "schema": { - "required": [ - "criteria" - ], - "type": "object", - "properties": { - "criteria": { - "type": "string", - "description": "Uses Lucene Query Syntax in the format of propertyName:value, propertyName:[num1 TO num2] and date range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the response please see the 'docs' element which has the list of record objects. Each record structure would consist of all the fields and their corresponding values.", - "default": "*:*" - }, - "start": { - "type": "integer", - "description": "Starting record number. Default value is 0.", - "default": 0 - }, - "rows": { - "type": "integer", - "description": "Specify number of rows to be returned. If you run the search with default values, in the response you will see 'numFound' attribute which will tell the number of records available in the dataset.", - "default": 100 - } - } - } + "description": "To be used as a version parameter value" + }, + "apiUrl": { + "type": "string", + "description": "The URL describing the dataset's fields", + "format": "uriref" + }, + "apiDocumentationUrl": { + "type": "string", + "description": "A URL to the API console for each API", + "format": "uriref" + } } + } } + } }, - "responses": { - "200": { - "description": "successful operation", - "content": { - "application\/json": { - "schema": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": { - "type": "object" - } - } - } - } - } + "example": { + "total": 2, + "apis": [ + { + "apiKey": "oa_citations", + "apiVersionNumber": "v1", + "apiUrl": "https:\/\/developer.uspto.gov\/ds-api\/oa_citations\/v1\/fields", + "apiDocumentationUrl": "https:\/\/developer.uspto.gov\/ds-api-docs\/index.html?url=https:\/\/developer.uspto.gov\/ds-api\/swagger\/docs\/oa_citations.json" }, - "404": { - "description": "No matching record found for the given criteria." + { + "apiKey": "cancer_moonshot", + "apiVersionNumber": "v1", + "apiUrl": "https:\/\/developer.uspto.gov\/ds-api\/cancer_moonshot\/v1\/fields", + "apiDocumentationUrl": "https:\/\/developer.uspto.gov\/ds-api-docs\/index.html?url=https:\/\/developer.uspto.gov\/ds-api\/swagger\/docs\/cancer_moonshot.json" } + ] } + } } + } } + } }, - "components": { - "schemas": { - "dataSetList": { + "\/{dataset}\/{version}\/fields": { + "get": { + "tags": [ + "metadata" + ], + "summary": "Provides the general information about the API and the list of fields that can be used to query the dataset.", + "description": "This GET API returns the list of all the searchable field names that are in the oa_citations. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the syntax options shown below.", + "operationId": "list-searchable-fields", + "parameters": [ + { + "name": "dataset", + "in": "path", + "description": "Name of the dataset.", + "required": true, + "schema": { + "type": "string" + }, + "example": "oa_citations" + }, + { + "name": "version", + "in": "path", + "description": "Version of the dataset.", + "required": true, + "schema": { + "type": "string" + }, + "example": "v1" + } + ], + "responses": { + "200": { + "description": "The dataset API for the given version is found and it is accessible to consume.", + "content": { + "application\/json": { + "schema": { + "type": "string" + } + } + } + }, + "404": { + "description": "The combination of dataset name and version is not found in the system or it is not published yet to be consumed by public.", + "content": { + "application\/json": { + "schema": { + "type": "string" + } + } + } + } + } + } + }, + "\/{dataset}\/{version}\/records": { + "post": { + "tags": [ + "search" + ], + "summary": "Provides search capability for the data set with the given search criteria.", + "description": "This API is based on Solr\/Lucense Search. The data is indexed using SOLR. This GET API returns the list of all the searchable field names that are in the Solr Index. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the Solr\/Lucene Syntax. Please refer https:\/\/lucene.apache.org\/core\/3_6_2\/queryparsersyntax.html#Overview for the query syntax. List of field names that are searchable can be determined using above GET api.", + "operationId": "perform-search", + "parameters": [ + { + "name": "version", + "in": "path", + "description": "Version of the dataset.", + "required": true, + "schema": { + "type": "string", + "default": "v1" + } + }, + { + "name": "dataset", + "in": "path", + "description": "Name of the dataset. In this case, the default value is oa_citations", + "required": true, + "schema": { + "type": "string", + "default": "oa_citations" + } + } + ], + "requestBody": { + "content": { + "application\/x-www-form-urlencoded": { + "schema": { + "required": [ + "criteria" + ], "type": "object", "properties": { - "total": { - "type": "integer" - }, - "apis": { - "type": "array", - "items": { - "type": "object", - "properties": { - "apiKey": { - "type": "string", - "description": "To be used as a dataset parameter value" - }, - "apiVersionNumber": { - "type": "string", - "description": "To be used as a version parameter value" - }, - "apiUrl": { - "type": "string", - "description": "The URL describing the dataset's fields", - "format": "uriref" - }, - "apiDocumentationUrl": { - "type": "string", - "description": "A URL to the API console for each API", - "format": "uriref" - } - } - } + "criteria": { + "type": "string", + "description": "Uses Lucene Query Syntax in the format of propertyName:value, propertyName:[num1 TO num2] and date range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the response please see the 'docs' element which has the list of record objects. Each record structure would consist of all the fields and their corresponding values.", + "default": "*:*" + }, + "start": { + "type": "integer", + "description": "Starting record number. Default value is 0.", + "default": 0 + }, + "rows": { + "type": "integer", + "description": "Specify number of rows to be returned. If you run the search with default values, in the response you will see 'numFound' attribute which will tell the number of records available in the dataset.", + "default": 100 + } + } + } + } + } + }, + "responses": { + "200": { + "description": "successful operation", + "content": { + "application\/json": { + "schema": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": { + "type": "object" } + } } + } } + }, + "404": { + "description": "No matching record found for the given criteria." + } } - }, - "tags": [ - { - "name": "metadata", - "description": "Find out about the data sets" - }, - { - "name": "search", - "description": "Search a data set" + } + } + }, + "components": { + "schemas": { + "dataSetList": { + "type": "object", + "properties": { + "total": { + "type": "integer" + }, + "apis": { + "type": "array", + "items": { + "type": "object", + "properties": { + "apiKey": { + "type": "string", + "description": "To be used as a dataset parameter value" + }, + "apiVersionNumber": { + "type": "string", + "description": "To be used as a version parameter value" + }, + "apiUrl": { + "type": "string", + "description": "The URL describing the dataset's fields", + "format": "uriref" + }, + "apiDocumentationUrl": { + "type": "string", + "description": "A URL to the API console for each API", + "format": "uriref" + } + } + } + } } - ] + } + } + }, + "tags": [ + { + "name": "metadata", + "description": "Find out about the data sets" + }, + { + "name": "search", + "description": "Search a data set" + } + ] } \ No newline at end of file From 2603b62e3a454986fb77799fb281a5cecd177575 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Fri, 6 Dec 2019 08:29:31 +0000 Subject: [PATCH 13/14] Update JSON example files --- examples/v3.0/callback-example.json | 1 + examples/v3.0/petstore-expanded.json | 15 +++++++++++ examples/v3.0/petstore.json | 39 ++++++++++++++++------------ 3 files changed, 38 insertions(+), 17 deletions(-) diff --git a/examples/v3.0/callback-example.json b/examples/v3.0/callback-example.json index 28734489ae..939cd0e855 100644 --- a/examples/v3.0/callback-example.json +++ b/examples/v3.0/callback-example.json @@ -52,6 +52,7 @@ "content": { "application\/json": { "schema": { + "type": "object", "properties": { "timestamp": { "type": "string", diff --git a/examples/v3.0/petstore-expanded.json b/examples/v3.0/petstore-expanded.json index aacba7145d..90737d997f 100644 --- a/examples/v3.0/petstore-expanded.json +++ b/examples/v3.0/petstore-expanded.json @@ -63,6 +63,7 @@ "required": [ "name" ], + "type": "object", "properties": { "name": { "type": "string" @@ -76,6 +77,7 @@ "required": [ "id" ], + "type": "object", "properties": { "id": { "type": "integer", @@ -98,6 +100,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", @@ -124,6 +127,7 @@ "required": [ "name" ], + "type": "object", "properties": { "name": { "type": "string" @@ -148,6 +152,7 @@ "required": [ "name" ], + "type": "object", "properties": { "name": { "type": "string" @@ -161,6 +166,7 @@ "required": [ "id" ], + "type": "object", "properties": { "id": { "type": "integer", @@ -182,6 +188,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", @@ -225,6 +232,7 @@ "required": [ "name" ], + "type": "object", "properties": { "name": { "type": "string" @@ -238,6 +246,7 @@ "required": [ "id" ], + "type": "object", "properties": { "id": { "type": "integer", @@ -259,6 +268,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", @@ -302,6 +312,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", @@ -327,6 +338,7 @@ "required": [ "name" ], + "type": "object", "properties": { "name": { "type": "string" @@ -340,6 +352,7 @@ "required": [ "id" ], + "type": "object", "properties": { "id": { "type": "integer", @@ -353,6 +366,7 @@ "required": [ "name" ], + "type": "object", "properties": { "name": { "type": "string" @@ -367,6 +381,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", diff --git a/examples/v3.0/petstore.json b/examples/v3.0/petstore.json index b74218f433..7fde36fb0f 100644 --- a/examples/v3.0/petstore.json +++ b/examples/v3.0/petstore.json @@ -52,6 +52,7 @@ "id", "name" ], + "type": "object", "properties": { "id": { "type": "integer", @@ -78,6 +79,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", @@ -112,6 +114,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", @@ -152,23 +155,21 @@ "content": { "application\/json": { "schema": { - "type": "array", - "items": { - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } + "required": [ + "id", + "name" + ], + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "tag": { + "type": "string" } } } @@ -184,6 +185,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", @@ -208,6 +210,7 @@ "id", "name" ], + "type": "object", "properties": { "id": { "type": "integer", @@ -228,6 +231,7 @@ "id", "name" ], + "type": "object", "properties": { "id": { "type": "integer", @@ -247,6 +251,7 @@ "code", "message" ], + "type": "object", "properties": { "code": { "type": "integer", From c8c133e84768ab30df2bf252e56d051bc034e74e Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Fri, 6 Dec 2019 13:36:38 +0000 Subject: [PATCH 14/14] Update JSON example files --- examples/v3.0/api-with-examples.json | 192 +++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 examples/v3.0/api-with-examples.json diff --git a/examples/v3.0/api-with-examples.json b/examples/v3.0/api-with-examples.json new file mode 100644 index 0000000000..1ca5282f2c --- /dev/null +++ b/examples/v3.0/api-with-examples.json @@ -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" + } + ] + } + } + } + } + } + } + } + } + } + } + } +} \ No newline at end of file