From 014eefab87e4e6028715208caed0bd651a652fe6 Mon Sep 17 00:00:00 2001 From: Nycholas de Oliveira e Oliveira Date: Wed, 10 Jul 2024 16:22:21 -0300 Subject: [PATCH] Add openrpc.json spec to example --- .../openrpc/petstore-expanded-openrpc.json | 310 +++++++++--------- 1 file changed, 153 insertions(+), 157 deletions(-) diff --git a/examples/openrpc/petstore-expanded-openrpc.json b/examples/openrpc/petstore-expanded-openrpc.json index 49ca122b..491b6e6a 100644 --- a/examples/openrpc/petstore-expanded-openrpc.json +++ b/examples/openrpc/petstore-expanded-openrpc.json @@ -1,182 +1,178 @@ { - "id": 1, - "jsonrpc": "2.0", - "result": { - "components": { - "schemas": { - "NewPet": { - "properties": { - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } + "components": { + "schemas": { + "NewPet": { + "properties": { + "name": { + "type": "string" }, - "required": [ - "name" - ], - "type": "object" + "tag": { + "type": "string" + } }, - "Pet": { - "allOf": [ - { - "$ref": "#/components/schemas/NewPet" + "required": [ + "name" + ], + "type": "object" + }, + "Pet": { + "allOf": [ + { + "$ref": "#/components/schemas/NewPet" + }, + { + "properties": { + "id": { + "type": "integer" + } }, - { - "properties": { - "id": { - "type": "integer" - } - }, - "required": [ - "id" - ] - } - ] - } + "required": [ + "id" + ] + } + ] } + } + }, + "externalDocs": { + "url": "https://github.com/open-rpc/examples/blob/master/service-descriptions/petstore-expanded-openrpc.json" + }, + "info": { + "contact": { + "email": "doesntexist@open-rpc.org", + "name": "OpenRPC Team", + "url": "https://open-rpc.org" }, - "externalDocs": { - "url": "https://github.com/open-rpc/examples/blob/master/service-descriptions/petstore-expanded-openrpc.json" + "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenRPC specification", + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" }, - "info": { - "contact": { - "email": "doesntexist@open-rpc.org", - "name": "OpenRPC Team", - "url": "https://open-rpc.org" - }, - "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenRPC specification", - "license": { - "name": "Apache 2.0", - "url": "https://www.apache.org/licenses/LICENSE-2.0.html" - }, - "termsOfService": "https://open-rpc.org", - "title": "Petstore Expanded", - "version": "1.0.0" - }, - "methods": [ - { - "name": "rpc.describe", - "params": [], - "result": { - "name": "default", - "schema": { - "type": "object" - } + "termsOfService": "https://open-rpc.org", + "title": "Petstore Expanded", + "version": "1.0.0" + }, + "methods": [ + { + "name": "rpc.describe", + "params": [], + "result": { + "name": "default", + "schema": { + "type": "object" } - }, - { - "description": "Returns an OpenRPC schema as a description of this service", - "name": "rpc.discover", - "params": [], - "result": { - "name": "OpenRPC Schema", - "schema": { - "$ref": "https://raw.githubusercontent.com/open-rpc/meta-schema/master/schema.json" - } + } + }, + { + "description": "Returns an OpenRPC schema as a description of this service", + "name": "rpc.discover", + "params": [], + "result": { + "name": "OpenRPC Schema", + "schema": { + "$ref": "https://raw.githubusercontent.com/open-rpc/meta-schema/master/schema.json" } - }, - { - "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.", - "name": "Petstore.get_pets", - "params": [ - { - "description": "tags to filter by", - "name": "tags", - "schema": { - "items": { - "type": "string" - }, - "type": "array" - } - }, - { - "description": "maximum number of results to return", - "name": "limit", - "schema": { - "type": "integer" - } - } - ], - "result": { - "description": "pet response", - "name": "pet", + } + }, + { + "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.", + "name": "Petstore.get_pets", + "params": [ + { + "description": "tags to filter by", + "name": "tags", "schema": { "items": { - "$ref": "#/components/schemas/Pet" + "type": "string" }, "type": "array" } - } - }, - { - "description": "Creates a new pet in the store. Duplicates are allowed", - "name": "Petstore.create_pet", - "params": [ - { - "description": "Pet to add to the store.", - "name": "newPet", - "schema": { - "$ref": "#/components/schemas/NewPet" - } - } - ], - "result": { - "description": "the newly created pet", - "name": "pet", + }, + { + "description": "maximum number of results to return", + "name": "limit", "schema": { - "$ref": "#/components/schemas/Pet" + "type": "integer" } } - }, - { - "description": "Returns a user based on a single ID, if the user does not have access to the pet", - "name": "Petstore.get_pet_by_id", - "params": [ - { - "description": "ID of pet to fetch", - "name": "id", - "required": true, - "schema": { - "type": "integer" - } - } - ], - "result": { - "description": "pet response", - "name": "pet", - "schema": { + ], + "result": { + "description": "pet response", + "name": "pet", + "schema": { + "items": { "$ref": "#/components/schemas/Pet" + }, + "type": "array" + } + } + }, + { + "description": "Creates a new pet in the store. Duplicates are allowed", + "name": "Petstore.create_pet", + "params": [ + { + "description": "Pet to add to the store.", + "name": "newPet", + "schema": { + "$ref": "#/components/schemas/NewPet" } } - }, - { - "description": "deletes a single pet based on the ID supplied", - "name": "Petstore.delete_pet_by_id", - "params": [ - { - "description": "ID of pet to delete", - "name": "id", - "required": true, - "schema": { - "type": "integer" - } + ], + "result": { + "description": "the newly created pet", + "name": "pet", + "schema": { + "$ref": "#/components/schemas/Pet" + } + } + }, + { + "description": "Returns a user based on a single ID, if the user does not have access to the pet", + "name": "Petstore.get_pet_by_id", + "params": [ + { + "description": "ID of pet to fetch", + "name": "id", + "required": true, + "schema": { + "type": "integer" } - ], - "result": { - "description": "pet deleted", - "name": "pet", - "schema": {} + } + ], + "result": { + "description": "pet response", + "name": "pet", + "schema": { + "$ref": "#/components/schemas/Pet" } } - ], - "openrpc": "1.0.0-rc1", - "servers": [ - { - "name": "default", - "url": "http://petstore.open-rpc.org" + }, + { + "description": "deletes a single pet based on the ID supplied", + "name": "Petstore.delete_pet_by_id", + "params": [ + { + "description": "ID of pet to delete", + "name": "id", + "required": true, + "schema": { + "type": "integer" + } + } + ], + "result": { + "description": "pet deleted", + "name": "pet", + "schema": {} } - ] - } + } + ], + "openrpc": "1.0.0-rc1", + "servers": [ + { + "name": "default", + "url": "http://petstore.open-rpc.org" + } + ] }