Redoc
You can display the whole OpenAPI documentation using a React component
You cannot import a React component inside a .md
file.
Change your file extension to .mdx
before importing the React Component.
Read more here about MDX in Docusaurus.
Import
import Redoc from '@theme/Redoc';
Props
Name | Type | Description |
---|---|---|
spec | OpenAPI spec | A JSON content spec to use |
url | String | External URL to load spec file from |
Examples
External URL example
import Redoc from '@theme/Redoc';
<Redoc url="https://redocly.github.io/redoc/openapi.yaml"/>
Webpack loader example
You can provide a JSON spec to the component like this. Webpack will load the file directly,
you don't need to use redocusaurus configuration inside docusaurus.config.js
.
import Redoc from '@theme/Redoc';
import openApi from './api-with-examples.json'
<Redoc spec={openApi} />
Swagger Petstore (1.0.0)
Download OpenAPI specification:Download
This is a sample server Petstore server.
You can find out more about Swagger at
http://swagger.io or on irc.freenode.net, #swagger.
For this sample, you can use the api key special-key
to test the authorization filters.
This API is documented in OpenAPI format and is based on Petstore sample provided by swagger.io team. It was extended to illustrate features of generator-openapi-repo tool and ReDoc documentation. In addition to standard OpenAPI syntax we use a few vendor extensions.
This API is documented in OpenAPI format and is based on Petstore sample provided by swagger.io team. It was extended to illustrate features of generator-openapi-repo tool and ReDoc documentation. In addition to standard OpenAPI syntax we use a few vendor extensions.
This API features Cross-Origin Resource Sharing (CORS) implemented in compliance with W3C spec. And that allows cross-domain communication from the browser. All responses have a wildcard same-origin which makes them completely public and accessible to everyone, including any code on any site.
Petstore offers two forms of authentication:
- API Key
- OAuth2 OAuth2 - an open protocol to allow secure authorization in a simple and standard method from web, mobile and desktop applications.
petstore_auth
Get access to data while protecting your account credentials. OAuth2 is also a safer and more secure way to give you access.
implicit
http://petstore.swagger.io/api/oauth/dialog
write:pets
-modify pets in your account
read:pets
-read your pets
id | |
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items [ items <url > ] Default: [] The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
{- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
New pet Webhook
Information about a new pet in the systems
Authorizations:
Request Body schema: application/json
id | |
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items [ items <url > ] Default: [] The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
Responses
Request samples
- Payload
{- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
Add a new pet to the store
Add new pet to the store inventory.
Authorizations:
cookie Parameters
cookieParam required | integer <int64> Some cookie |
header Parameters
Accept-Language | string Default: en-AU Example: en-US The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US |
Request Body schema: required
Pet object that needs to be added to the store
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items [ items <url > ] Default: [] The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
Responses
Request samples
- Payload
- C#
- PHP
{- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
Update an existing pet
Authorizations:
cookie Parameters
cookieParam required | integer <int64> Some cookie |
header Parameters
Accept-Language | string Default: en-AU Example: en-US The language you prefer for messages. Supported values are en-AU, en-CA, en-GB, en-US |
Request Body schema: required
Pet object that needs to be added to the store
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items [ items <url > ] Default: [] The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
Responses
Request samples
- Payload
- PHP
{- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
Find pet by ID
Returns a single pet
Authorizations:
path Parameters
petId required | integer <int64> Deprecated ID of pet to return |
Responses
Response samples
- 200
{- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
Finds Pets by status
Multiple status values can be provided with comma separated strings
Authorizations:
query Parameters
status required | Array of strings [ 1 .. 3 ] items Items Enum: "available" "pending" "sold" Status values that need to be considered for filter |
Responses
Response samples
- 200
[- {
- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}
]
Finds Pets by tags Deprecated
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Authorizations:
query Parameters
tags required | Array of strings Tags to filter by |
Responses
Response samples
- 200
[- {
- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}
]
Place an order for a pet
Authorizations:
Request Body schema: application/jsonrequired
order placed for purchasing the pet
quantity | integer <int32> >= 1 Default: 1 |
shipDate | string <date-time> Estimated ship date |
status | string Enum: "placed" "approved" "delivered" Order Status |
requestId | string Unique Request Id |
Responses
Request samples
- Payload
{- "quantity": 1,
- "shipDate": "2019-08-24T14:15:22Z",
- "status": "placed",
- "requestId": "string"
}
Response samples
- 200
- 400
{- "id": 0,
- "petId": 0,
- "quantity": 1,
- "shipDate": "2019-08-24T14:15:22Z",
- "status": "placed",
- "complete": false
}
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
Authorizations:
path Parameters
orderId required | integer <int64> [ 1 .. 5 ] ID of pet that needs to be fetched |
Responses
Response samples
- 200
{- "id": 0,
- "petId": 0,
- "quantity": 1,
- "shipDate": "2019-08-24T14:15:22Z",
- "status": "placed",
- "complete": false
}
Subscribe to the Store events
Add subscription for a store events
Authorizations:
Request Body schema: application/json
callbackUrl required | string <uri> This URL will be called by the server when the desired event will occur |
eventName required | string Enum: "orderInProgress" "orderShipped" "orderDelivered" Event name for the subscription |
Responses
Callbacks
Request samples
- Payload
{- "eventName": "orderInProgress"
}
Response samples
- 201
{- "subscriptionId": "AAA-123-BBB-456"
}
Callback payload samples
{- "orderId": "123",
- "timestamp": "2018-10-19T16:46:45Z",
- "status": "inProgress"
}
Create user
This can only be done by the logged in user.
Authorizations:
Request Body schema: application/jsonrequired
Created user object
Pet (object) or Tag (object) | |
username | string >= 4 characters User supplied username |
firstName | string non-empty User first name |
lastName | string non-empty User last name |
string <email> User email address | |
password | string <password> >= 8 characters /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ User password, MUST contain a mix of upper and lower case letters, as well as digits |
phone | string/^\+(?:[0-9]-?){6,14}[0-9]$/ User phone number in international format |
userStatus | integer <int32> User status |
Array of items <= 10 characters >= 0 items |
Responses
Request samples
- Payload
{- "pet": {
- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0,
- "addresses": [
- {
- "city": "string",
- "country": "string",
- "street": "string"
}, - 0
]
}
Get user by user name
Authorizations:
path Parameters
username required | string The name that needs to be fetched. Use user1 for testing. |
Responses
Response samples
- 200
{- "id": 0,
- "pet": {
- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0,
- "addresses": [
- {
- "city": "string",
- "country": "string",
- "street": "string"
}, - 0
]
}
Updated user
This can only be done by the logged in user.
Authorizations:
path Parameters
username required | string name that need to be deleted |
Request Body schema: application/jsonrequired
Updated user object
Pet (object) or Tag (object) | |
username | string >= 4 characters User supplied username |
firstName | string non-empty User first name |
lastName | string non-empty User last name |
string <email> User email address | |
password | string <password> >= 8 characters /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ User password, MUST contain a mix of upper and lower case letters, as well as digits |
phone | string/^\+(?:[0-9]-?){6,14}[0-9]$/ User phone number in international format |
userStatus | integer <int32> User status |
Array of items <= 10 characters >= 0 items |
Responses
Request samples
- Payload
{- "pet": {
- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0,
- "addresses": [
- {
- "city": "string",
- "country": "string",
- "street": "string"
}, - 0
]
}
Creates list of users with given input array
Authorizations:
Request Body schema: application/jsonrequired
List of user object
Pet (object) or Tag (object) | |
username | string >= 4 characters User supplied username |
firstName | string non-empty User first name |
lastName | string non-empty User last name |
string <email> User email address | |
password | string <password> >= 8 characters /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ User password, MUST contain a mix of upper and lower case letters, as well as digits |
phone | string/^\+(?:[0-9]-?){6,14}[0-9]$/ User phone number in international format |
userStatus | integer <int32> User status |
Array of items <= 10 characters >= 0 items |
Responses
Request samples
- Payload
[- {
- "pet": {
- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0,
- "addresses": [
- {
- "city": "string",
- "country": "string",
- "street": "string"
}, - 0
]
}
]
Creates list of users with given input array
Authorizations:
Request Body schema: application/jsonrequired
List of user object
Pet (object) or Tag (object) | |
username | string >= 4 characters User supplied username |
firstName | string non-empty User first name |
lastName | string non-empty User last name |
string <email> User email address | |
password | string <password> >= 8 characters /(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])/ User password, MUST contain a mix of upper and lower case letters, as well as digits |
phone | string/^\+(?:[0-9]-?){6,14}[0-9]$/ User phone number in international format |
userStatus | integer <int32> User status |
Array of items <= 10 characters >= 0 items |
Responses
Request samples
- Payload
[- {
- "pet": {
- "category": {
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "name": "string"
}
], - "status": "available",
- "petType": "string"
}, - "username": "John78",
- "firstName": "John",
- "lastName": "Smith",
- "email": "john.smith@example.com",
- "password": "drowssaP123",
- "phone": "+1-202-555-0192",
- "userStatus": 0,
- "addresses": [
- {
- "city": "string",
- "country": "string",
- "street": "string"
}, - 0
]
}
]
id | |
object Categories this pet belongs to | |
name required | string The name given to a pet |
photoUrls required | Array of strings <url> <= 20 items [ items <url > ] Default: [] The list of URL to a cute photos featuring pet |
friend | object Recursive |
Array of objects (Tag) non-empty Tags attached to the pet | |
status | string Enum: "available" "pending" "sold" Pet status in the store |
petType | string Type of a pet |
huntingSkill required | string Default: "lazy" Enum: "clueless" "lazy" "adventurous" "aggressive" The measured skill for hunting |
{- "id": 0,
- "category": {
- "id": 0,
- "name": "string",
- "sub": {
- "prop1": "string"
}
}, - "name": "Guru",
- "photoUrls": [ ],
- "friend": { },
- "tags": [
- {
- "id": 0,
- "name": "string"
}
], - "status": "available",
- "petType": "cat",
- "huntingSkill": "adventurous"
}
id | integer <int64> Order ID |
petId | integer <int64> Pet ID |
quantity | integer <int32> >= 1 Default: 1 |
shipDate | string <date-time> Estimated ship date |
status | string Enum: "placed" "approved" "delivered" Order Status |
complete | boolean Default: false Indicates whenever order was completed or not |
requestId | string Unique Request Id |
{- "quantity": 1,
- "shipDate": "2018-10-19T16:46:45Z",
- "status": "placed",
- "complete": false
}
You cannot load yaml file like this:
import openApi from './api-with-examples.yaml'
Without the right webpack configuration to handle such file format.