ReDoc makes use of the following vendor extensions
Extend OpenAPI root Swagger Object
Backported from OpenAPI 3.0 servers
. Currently doesn't support templates.
Field Name | Type | Description |
---|---|---|
x-tagGroups | [ Tag Group Object ] | A list of tag groups |
x-tagGroups
is used to group tags in the side menu.
If you are going to use x-tagGroups
, please make sure you add all tags to a group, since a tag that is not in a group, will not be displayed at all!
Information about tags group
Field Name | Type | Description |
---|---|---|
name | string | The group name |
tags | [ string ] | List of tags to include in this group |
json
{
"x-tagGroups": [
{
"name": "User Management",
"tags": ["Users", "API keys", "Admin"]
},
{
"name": "Statistics",
"tags": ["Main Stats", "Secondary Stats"]
}
]
}
yaml
x-tagGroups:
- name: User Management
tags:
- Users
- API keys
- Admin
- name: Statistics
tags:
- Main Stats
- Secondary Stats
Extends OpenAPI Info Object
Field Name | Type | Description |
---|---|---|
x-logo | Logo Object | The information about API logo |
x-logo
is used to specify API logo. The corresponding image are displayed just above side-menu.
The information about API logo
Field Name | Type | Description |
---|---|---|
url | string | The URL pointing to the spec logo. MUST be in the format of a URL |
backgroundColor | string | background color to be used. MUST be RGB color in [hexadecimal format] (https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) |
json
{
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"x-logo": {
"url": "https://rebilly.github.io/ReDoc/petstore-logo.png",
"backgroundColor": "#FFFFFF"
}
}
}
yaml
info:
version: "1.0.0"
title: "Swagger Petstore"
x-logo:
url: "https://rebilly.github.io/ReDoc/petstore-logo.png"
backgroundColor: "#FFFFFF"
Extends OpenAPI Tag Object
Field Name | Type | Description |
---|---|---|
x-traitTag | boolean | In Swagger two operations can have multiply tags. This property distinguish between tags that are used to group operations (default) from tags that are used to mark operation with certain trait (true value) |
Field Name | Type | Description |
---|---|---|
x-displayName | string | Define the text that is used for this tag in the menu and in section headings |
Tags that have x-traitTag
set to true
are listed in side-menu but don't have any subitems (operations). Tag description
is rendered as well.
This is useful for handling out common things like Pagination, Rate-Limits, etc.
json
{
"name": "Pagination",
"description": "Pagination description (can use markdown syntax)",
"x-traitTag": true
}
yaml
name: Pagination
description: Pagination description (can use markdown syntax)
x-traitTag: true
Extends OpenAPI Operation Object
Field Name | Type | Description |
---|---|---|
x-code-samples | [ Code Sample Object ] | A list of code samples associated with operation |
x-code-samples
are rendered on the right panel of ReDoc
Operation code sample
Field Name | Type | Description |
---|---|---|
lang | string | Code sample language. Value should be one of the following list |
source | string | Code sample source code |
json
{
"lang": "JavaScript",
"source": "console.log('Hello World');"
}
yaml
lang: JavaScript
source: console.log('Hello World');
Extends OpenAPI Parameter Object
Field Name | Type | Description |
---|---|---|
x-examples | Example Object | Object that contains examples for the request. Applies when in is body and mime-type is application/json |
x-examples
are rendered in the JSON tab on the right panel of ReDoc.
Extends OpenAPI Schema Object
Field Name | Type | Description |
---|---|---|
x-nullable | boolean | marks schema as a nullable |
Schemas marked as x-nullable
are marked in ReDoc with the label Nullable
ATTENTION: This is ReDoc-specific vendor extension. It won't be supported by other tools.
Field Name | Type | Description |
---|---|---|
x-extendedDiscriminator | string | specifies extended discriminator |
ReDoc uses this vendor extension to solve name-clash issues with the standard discriminator
.
Value of this field specifies the field which will be used as a extended discriminator.
ReDoc displays definition with selectpicker using which user can select value of the x-extendedDiscriminator
-marked field.
ReDoc displays the definition which is derived from the current (using allOf
) and has enum
with only one value which is the same as the selected value of the field specified as x-extendedDiscriminator
.
Payment:
x-extendedDiscriminator: type
type: object
required:
- type
properties:
type:
type: string
name:
type: string
CashPayment:
allOf:
- $ref: "#/definitions/Payment"
- properties:
type:
type: string
enum:
- cash
currency:
type: string
PayPalPayment:
allOf:
- $ref: "#/definitions/Payment"
- properties:
type:
type: string
enum:
- paypal
userEmail:
type: string
In the example above the names of definitions (PayPalPayment
) are named differently than
names in the payload (paypal
) which is not supported by default discriminator
.