From e95e9773850bae12582b91a9f96392d3355da5c4 Mon Sep 17 00:00:00 2001 From: Tony Tam Date: Thu, 31 Jul 2014 23:12:08 -0700 Subject: [PATCH] added linked example per #5 --- .../resourceWithLinkedDefinitions.json | 62 +++++++++++++++++++ .../resourceWithLinkedDefinitions_part1.json | 38 ++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 samples/v2.0/json/resources/resourceWithLinkedDefinitions.json create mode 100644 samples/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json diff --git a/samples/v2.0/json/resources/resourceWithLinkedDefinitions.json b/samples/v2.0/json/resources/resourceWithLinkedDefinitions.json new file mode 100644 index 0000000000..0bf2f64753 --- /dev/null +++ b/samples/v2.0/json/resources/resourceWithLinkedDefinitions.json @@ -0,0 +1,62 @@ +{ + "swagger": 2.0, + "info": { + "version": "1.0.9-abcd", + "title": "Swagger Sample API", + "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", + "termsOfService": "http://helloreverb.com/terms/", + "contact": { + "name": "wordnik api team", + "url": "http://developer.wordnik.com" + }, + "license": { + "name": "Creative Commons 4.0 International", + "url": "http://creativecommons.org/licenses/by/4.0/" + } + }, + "host": "my.api.com", + "basePath": "/v1", + "schemes": [ + "http", + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json", + "application/xml" + ], + "paths": { + "/pets/{petId}": { + "$ref": "https://raw.githubusercontent.com/reverb/swagger-spec/master/samples/2.0/json/resources/resourceWithLinkedDefinitions_part1.json" + } + }, + "definitions": { + "Pet": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "tag": { + "type": "string" + } + } + }, + "ErrorModel": { + "required": [ "code", "message" ], + "properties": { + "code": { + "type": "integer", + "format": "int32" + }, + "message": { + "type": "string" + } + } + } + } +} diff --git a/samples/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json b/samples/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json new file mode 100644 index 0000000000..5b7f5b9ad3 --- /dev/null +++ b/samples/v2.0/json/resources/resourceWithLinkedDefinitions_part1.json @@ -0,0 +1,38 @@ +{ + "get": { + "description": "Returns a pet based on ID", + "summary": "Find pet by ID", + "operationId": "getPetsById", + "produces": [ + "application/json", + "text/html" + ], + "parameters": [ + { + "name": "petId", + "in": "path", + "description": "ID of pet that needs to be fetched", + "required": true, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "csv" + } + ], + "responses": { + "200": { + "description": "pet response", + "schema": { + "$ref": "Pet" + } + }, + "default": { + "description": "error payload", + "schema": { + "$ref": "ErrorModel" + } + } + } + } +} \ No newline at end of file