Pull better demo spec

This commit is contained in:
Roman Hotsiy 2016-07-18 23:49:13 +03:00
parent d629644c94
commit d75e9921c2
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -16,47 +16,28 @@ info:
name: Apache 2.0 name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html' url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
externalDocs: externalDocs:
description: Find out more about Swagger description: Find out how to create Github repo for your OpenAPI spec.
url: 'http://swagger.io' url: 'https://github.com/Rebilly/generator-openapi-repo'
tags: tags:
- name: Pagination - name: Introduction
x-traitTag: true x-traitTag: true
description: |- description: 'This API is documented in **OpenAPI format** and is based on [Pestore sample](http://petstore.swagger.io/) provided by [swagger.io](http://swagger.io) team. It was **extended** to illustrate features of [generator-openapi-repo](https://github.com/Rebilly/generator-openapi-repo) tool and [ReDoc](https://github.com/Rebilly/ReDoc) documentation. In addition to standard OpenAPI syntax we use a few [vendor extensions](https://github.com/Rebilly/ReDoc/blob/master/docs/redoc-vendor-extensions.md).'
Sometimes you just can't get enough. For this reason, we've provided a convenient way to access more data in any request for sequential data. Simply call the url in the next_url parameter and we'll respond with the next set of data. - name: OpenAPI Specification
```json description: 'The goal of The OpenAPI Specification is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service.'
{
...
"pagination": {
"next_url":
"https://api.instagram.com/v1/tags/puppy/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&max_id=13872296",
"next_max_id": "13872296"
}
}
```
On views where pagination is present, we also support the `count`
parameter. Simply set this to the number of items you'd like to receive. Note that the default values should be fine for most applications - but if you decide to increase this number there is a maximum value defined on each endpoint.
externalDocs: externalDocs:
description: Find out more description: Find out more
url: 'http://swagger.io' url: 'https://openapis.org/'
- name: JSONP - name: Cross-Origin Resource Sharing
x-traitTag: true description: |
description: "If you're writing an AJAX application, and you'd like to wrap our response with a callback, all you have to do is specify a callback parameter with any API call:\n```\n https://api.instagram.com/v1/tags/coffee/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d&callback=callbackFunction\n```\nWould respond with:\n```js\ncallbackFunction({\n ...\n});\n``` \n > Example of markdown blockquote" This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/).
externalDocs: And that allows cross-domain communication from the browser.
description: Find out more All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
url: 'http://swagger.io'
- name: pet - name: pet
description: Everything about your Pets description: Everything about your Pets
externalDocs:
description: Find out more
url: 'http://swagger.io'
- name: store - name: store
description: Access to Petstore orders description: Access to Petstore orders
- name: user - name: user
description: Operations about user description: Operations about user
externalDocs:
description: Find out more about our store
url: 'http://swagger.io'
securityDefinitions: securityDefinitions:
petstore_auth: petstore_auth:
type: oauth2 type: oauth2
@ -75,7 +56,7 @@ paths:
tags: tags:
- pet - pet
summary: Add a new pet to the store summary: Add a new pet to the store
description: '' description: Add new pet to the store inventory.
operationId: addPet operationId: addPet
consumes: consumes:
- application/json - application/json
@ -154,7 +135,6 @@ paths:
get: get:
tags: tags:
- pet - pet
- JSONP
summary: Find pet by ID summary: Find pet by ID
description: Returns a single pet description: Returns a single pet
operationId: getPetById operationId: getPetById
@ -242,40 +222,6 @@ paths:
- 'write:pets' - 'write:pets'
- 'read:pets' - 'read:pets'
'/pet/{petId}/uploadImage': '/pet/{petId}/uploadImage':
get:
tags:
- pet
summary: uploads an image
description: ''
operationId: uploadFile
consumes:
- image/jpeg
- image/png
produces:
- image/jpeg
- image/png
parameters:
- name: petId
in: path
description: ID of pet to update
required: true
type: integer
format: int64
- name: file
in: body
description: file to upload
required: false
schema:
type: file
responses:
'200':
description: successful operation
schema:
type: file
security:
- petstore_auth:
- 'write:pets'
- 'read:pets'
post: post:
tags: tags:
- pet - pet
@ -316,8 +262,6 @@ paths:
get: get:
tags: tags:
- pet - pet
- Pagination
- JSONP
summary: Finds Pets by status summary: Finds Pets by status
description: Multiple status values can be provided with comma seperated strings description: Multiple status values can be provided with comma seperated strings
operationId: findPetsByStatus operationId: findPetsByStatus
@ -355,8 +299,6 @@ paths:
get: get:
tags: tags:
- pet - pet
- Pagination
- JSONP
summary: Finds Pets by tags summary: Finds Pets by tags
description: 'Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.' description: 'Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.'
operationId: findPetsByTags operationId: findPetsByTags
@ -389,7 +331,6 @@ paths:
get: get:
tags: tags:
- store - store
- JSONP
summary: Returns pet inventories by status summary: Returns pet inventories by status
description: Returns a map of status codes to quantities description: Returns a map of status codes to quantities
operationId: getInventory operationId: getInventory
@ -434,7 +375,6 @@ paths:
get: get:
tags: tags:
- store - store
- JSONP
summary: Find purchase order by ID summary: Find purchase order by ID
description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions' description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions'
operationId: getOrderById operationId: getOrderById
@ -504,7 +444,6 @@ paths:
get: get:
tags: tags:
- user - user
- JSONP
summary: Get user by user name summary: Get user by user name
description: '' description: ''
operationId: getUserByName operationId: getUserByName
@ -642,6 +581,8 @@ paths:
description: successful operation description: successful operation
schema: schema:
type: string type: string
examples:
application/json: OK
headers: headers:
X-Rate-Limit: X-Rate-Limit:
type: integer type: integer
@ -699,10 +640,13 @@ definitions:
type: object type: object
properties: properties:
id: id:
type: integer description: Category ID
format: int64 allOf:
- $ref: '#/definitions/Id'
name: name:
description: Category name
type: string type: string
minLength: 1
xml: xml:
name: Category name: Category
Dog: Dog:
@ -714,24 +658,44 @@ definitions:
packSize: packSize:
type: integer type: integer
format: int32 format: int32
description: the size of the pack the dog is from description: The size of the pack the dog is from
default: 0 default: 1
minimum: 0 minimum: 1
required: required:
- packSize - packSize
HoneyBee:
description: A representation of a honey bee
allOf:
- $ref: '#/definitions/Pet'
- type: object
properties:
honeyPerDay:
type: number
description: Average amount of honey produced per day in ounces
example: 3.14
required:
- honeyPerDay
Id:
type: integer
format: int64
Order: Order:
type: object type: object
properties: properties:
id: id:
type: integer description: Order ID
format: int64 allOf:
- $ref: '#/definitions/Id'
petId: petId:
type: integer description: Pet ID
format: int64 allOf:
- $ref: '#/definitions/Id'
quantity: quantity:
type: integer type: integer
format: int32 format: int32
minimum: 1
default: 1
shipDate: shipDate:
description: Estimated ship date
type: string type: string
format: date-time format: date-time
status: status:
@ -742,6 +706,7 @@ definitions:
- approved - approved
- delivered - delivered
complete: complete:
description: Indicates whenever order was completed or not
type: boolean type: boolean
default: false default: false
xml: xml:
@ -754,23 +719,31 @@ definitions:
discriminator: petType discriminator: petType
properties: properties:
petType: petType:
description: Type of a pet
type: string type: string
id: id:
type: integer description: Pet ID
format: int64 allOf:
- $ref: '#/definitions/Id'
category: category:
$ref: '#/definitions/Category' description: Categories this pet belongs to
allOf:
- $ref: '#/definitions/Category'
name: name:
description: The name given to a pet
type: string type: string
example: doggie example: Guru
photoUrls: photoUrls:
description: The list of URL to a cute photos featuring pet
type: array type: array
xml: xml:
name: photoUrl name: photoUrl
wrapped: true wrapped: true
items: items:
type: string type: string
format: url
tags: tags:
description: Tags attached to the pet
type: array type: array
xml: xml:
name: tag name: tag
@ -779,7 +752,7 @@ definitions:
$ref: '#/definitions/Tag' $ref: '#/definitions/Tag'
status: status:
type: string type: string
description: pet status in the store description: Pet status in the store
enum: enum:
- available - available
- pending - pending
@ -790,33 +763,56 @@ definitions:
type: object type: object
properties: properties:
id: id:
type: integer description: Tag ID
format: int64 allOf:
- $ref: '#/definitions/Id'
name: name:
description: Tag name
type: string type: string
minLength: 1
xml: xml:
name: Tag name: Tag
User: User:
type: object type: object
properties: properties:
id: id:
type: integer description: User ID
format: int64 $ref: '#/definitions/Id'
username: username:
description: User supplied username
type: string type: string
minLength: 4
example: John78
firstName: firstName:
description: User first name
type: string type: string
minLength: 1
example: John
lastName: lastName:
description: User last name
type: string type: string
minLength: 1
example: Smith
email: email:
description: User email address
type: string type: string
format: email
example: john.smith@example.com
password: password:
type: string type: string
description: 'User password, MUST contain a mix of upper and lower case letters, as well as digits'
format: password
minLength: 8
pattern: '(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])'
example: drowssaP123
phone: phone:
description: User phone number in international format
type: string type: string
pattern: "^\\+(?:[0-9]-?){6,14}[0-9]$"
example: +1-202-555-0192
userStatus: userStatus:
description: User status
type: integer type: integer
format: int32 format: int32
description: User Status
xml: xml:
name: User name: User