GeezerVison is showing github.com — feat: add $ref bundling to OpenAPI/Swagger command (#342) · readmeio/rdme@af3c7c2
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +179Lines changed: 179 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "requestBodies": { | | 3 | + "Pet": { | | 4 | + "content": { | | 5 | + "application/json": { | | 6 | + "schema": { | | 7 | + "$ref": "#/schemas/Pet" | | 8 | + } | | 9 | + }, | | 10 | + "application/xml": { | | 11 | + "schema": { | | 12 | + "$ref": "#/schemas/Pet" | | 13 | + } | | 14 | + } | | 15 | + }, | | 16 | + "description": "Pet object that needs to be added to the store", | | 17 | + "required": true | | 18 | + } | | 19 | + }, | | 20 | + "schemas": { | | 21 | + "Order": { | | 22 | + "type": "object", | | 23 | + "properties": { | | 24 | + "id": { | | 25 | + "type": "integer", | | 26 | + "format": "int64" | | 27 | + }, | | 28 | + "petId": { | | 29 | + "type": "integer", | | 30 | + "format": "int64" | | 31 | + }, | | 32 | + "quantity": { | | 33 | + "type": "integer", | | 34 | + "format": "int32" | | 35 | + }, | | 36 | + "shipDate": { | | 37 | + "type": "string", | | 38 | + "format": "date-time" | | 39 | + }, | | 40 | + "status": { | | 41 | + "type": "string", | | 42 | + "description": "Order Status", | | 43 | + "enum": [ | | 44 | + "placed", | | 45 | + "approved", | | 46 | + "delivered" | | 47 | + ] | | 48 | + }, | | 49 | + "complete": { | | 50 | + "type": "boolean", | | 51 | + "default": false | | 52 | + } | | 53 | + }, | | 54 | + "xml": { | | 55 | + "name": "Order" | | 56 | + } | | 57 | + }, | | 58 | + "Category": { | | 59 | + "type": "object", | | 60 | + "properties": { | | 61 | + "id": { | | 62 | + "type": "integer", | | 63 | + "format": "int64" | | 64 | + }, | | 65 | + "name": { | | 66 | + "type": "string" | | 67 | + } | | 68 | + }, | | 69 | + "xml": { | | 70 | + "name": "Category" | | 71 | + } | | 72 | + }, | | 73 | + "User": { | | 74 | + "type": "object", | | 75 | + "properties": { | | 76 | + "id": { | | 77 | + "type": "integer", | | 78 | + "format": "int64" | | 79 | + }, | | 80 | + "username": { | | 81 | + "type": "string" | | 82 | + }, | | 83 | + "firstName": { | | 84 | + "type": "string" | | 85 | + }, | | 86 | + "lastName": { | | 87 | + "type": "string" | | 88 | + }, | | 89 | + "email": { | | 90 | + "type": "string" | | 91 | + }, | | 92 | + "password": { | | 93 | + "type": "string" | | 94 | + }, | | 95 | + "phone": { | | 96 | + "type": "string" | | 97 | + }, | | 98 | + "userStatus": { | | 99 | + "type": "integer", | | 100 | + "format": "int32", | | 101 | + "description": "User Status" | | 102 | + } | | 103 | + }, | | 104 | + "xml": { | | 105 | + "name": "User" | | 106 | + } | | 107 | + }, | | 108 | + "Tag": { | | 109 | + "type": "object", | | 110 | + "properties": { | | 111 | + "id": { | | 112 | + "type": "integer", | | 113 | + "format": "int64" | | 114 | + }, | | 115 | + "name": { | | 116 | + "type": "string" | | 117 | + } | | 118 | + }, | | 119 | + "xml": { | | 120 | + "name": "Tag" | | 121 | + } | | 122 | + }, | | 123 | + "Pet": { | | 124 | + "type": "object", | | 125 | + "required": [ | | 126 | + "name", | | 127 | + "photoUrls" | | 128 | + ], | | 129 | + "properties": { | | 130 | + "id": { | | 131 | + "type": "integer", | | 132 | + "format": "int64", | | 133 | + "default": 40, | | 134 | + "example": 25 | | 135 | + }, | | 136 | + "category": { | | 137 | + "$ref": "#/schemas/Category" | | 138 | + }, | | 139 | + "name": { | | 140 | + "type": "string", | | 141 | + "example": "doggie" | | 142 | + }, | | 143 | + "photoUrls": { | | 144 | + "type": "array", | | 145 | + "xml": { | | 146 | + "name": "photoUrl", | | 147 | + "wrapped": true | | 148 | + }, | | 149 | + "items": { | | 150 | + "type": "string", | | 151 | + "example": "https://example.com/photo.png" | | 152 | + } | | 153 | + }, | | 154 | + "tags": { | | 155 | + "type": "array", | | 156 | + "xml": { | | 157 | + "name": "tag", | | 158 | + "wrapped": true | | 159 | + }, | | 160 | + "items": { | | 161 | + "$ref": "#/schemas/Tag" | | 162 | + } | | 163 | + }, | | 164 | + "status": { | | 165 | + "type": "string", | | 166 | + "description": "pet status in the store", | | 167 | + "enum": [ | | 168 | + "available", | | 169 | + "pending", | | 170 | + "sold" | | 171 | + ] | | 172 | + } | | 173 | + }, | | 174 | + "xml": { | | 175 | + "name": "Pet" | | 176 | + } | | 177 | + } | | 178 | + } | | 179 | +} |
Collapse file Copy file name to clipboard +132Lines changed: 132 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "openapi": "3.0.0", | | 3 | + "info": { | | 4 | + "version": "1.0.0", | | 5 | + "title": "Example petstore to demo our handling of external $ref pointers" | | 6 | + }, | | 7 | + "servers": [ | | 8 | + { | | 9 | + "url": "http://petstore.swagger.io/v2" | | 10 | + } | | 11 | + ], | | 12 | + "paths": { | | 13 | + "/pet": { | | 14 | + "post": { | | 15 | + "tags": ["pet"], | | 16 | + "summary": "Add a new pet to the store", | | 17 | + "description": "", | | 18 | + "operationId": "addPet", | | 19 | + "requestBody": { | | 20 | + "$ref": "__tests__/__fixtures__/ref-oas/external-components.json#/requestBodies/Pet" | | 21 | + }, | | 22 | + "responses": { | | 23 | + "405": { | | 24 | + "description": "Invalid input" | | 25 | + } | | 26 | + }, | | 27 | + "security": [ | | 28 | + { | | 29 | + "petstore_auth": ["write:pets", "read:pets"] | | 30 | + } | | 31 | + ] | | 32 | + }, | | 33 | + "put": { | | 34 | + "tags": ["pet"], | | 35 | + "summary": "Update an existing pet", | | 36 | + "description": "", | | 37 | + "operationId": "updatePet", | | 38 | + "requestBody": { | | 39 | + "$ref": "__tests__/__fixtures__/ref-oas/external-components.json#/requestBodies/Pet" | | 40 | + }, | | 41 | + "responses": { | | 42 | + "400": { | | 43 | + "description": "Invalid ID supplied" | | 44 | + }, | | 45 | + "404": { | | 46 | + "description": "Pet not found" | | 47 | + }, | | 48 | + "405": { | | 49 | + "description": "Validation exception" | | 50 | + } | | 51 | + }, | | 52 | + "security": [ | | 53 | + { | | 54 | + "petstore_auth": ["write:pets", "read:pets"] | | 55 | + } | | 56 | + ] | | 57 | + } | | 58 | + }, | | 59 | + "/pet/{petId}": { | | 60 | + "get": { | | 61 | + "tags": ["pet"], | | 62 | + "summary": "Find pet by ID", | | 63 | + "description": "Returns a single pet", | | 64 | + "operationId": "getPetById", | | 65 | + "parameters": [ | | 66 | + { | | 67 | + "name": "petId", | | 68 | + "in": "path", | | 69 | + "description": "ID of pet to return", | | 70 | + "required": true, | | 71 | + "schema": { | | 72 | + "type": "integer", | | 73 | + "format": "int64" | | 74 | + } | | 75 | + } | | 76 | + ], | | 77 | + "responses": { | | 78 | + "200": { | | 79 | + "description": "successful operation", | | 80 | + "content": { | | 81 | + "application/xml": { | | 82 | + "schema": { | | 83 | + "$ref": "__tests__/__fixtures__/ref-oas/external-components.json#/schemas/Pet" | | 84 | + } | | 85 | + }, | | 86 | + "application/json": { | | 87 | + "schema": { | | 88 | + "$ref": "__tests__/__fixtures__/ref-oas/external-components.json#/schemas/Pet" | | 89 | + } | | 90 | + } | | 91 | + } | | 92 | + }, | | 93 | + "400": { | | 94 | + "description": "Invalid ID supplied" | | 95 | + }, | | 96 | + "404": { | | 97 | + "description": "Pet not found" | | 98 | + }, | | 99 | + "default": { | | 100 | + "description": "successful response" | | 101 | + } | | 102 | + }, | | 103 | + "security": [ | | 104 | + { | | 105 | + "api_key": [] | | 106 | + } | | 107 | + ] | | 108 | + } | | 109 | + } | | 110 | + }, | | 111 | + "components": { | | 112 | + "securitySchemes": { | | 113 | + "petstore_auth": { | | 114 | + "type": "oauth2", | | 115 | + "flows": { | | 116 | + "implicit": { | | 117 | + "authorizationUrl": "http://petstore.swagger.io/oauth/dialog", | | 118 | + "scopes": { | | 119 | + "write:pets": "modify pets in your account", | | 120 | + "read:pets": "read your pets" | | 121 | + } | | 122 | + } | | 123 | + } | | 124 | + }, | | 125 | + "api_key": { | | 126 | + "type": "apiKey", | | 127 | + "name": "api_key", | | 128 | + "in": "header" | | 129 | + } | | 130 | + } | | 131 | + } | | 132 | +} |
|