2016-02-01 20:23:13 +03:00
# ReDoc vendor extensions
2018-11-30 11:09:40 +03:00
ReDoc makes use of the following [vendor extensions ](https://swagger.io/specification/#specificationExtensions )
2016-02-01 20:23:13 +03:00
2016-12-26 00:47:33 +03:00
### Swagger Object vendor extensions
2018-11-30 11:09:40 +03:00
Extend OpenAPI root [Swagger Object ](https://swagger.io/specification/#oasObject )
2017-02-26 00:44:19 +03:00
#### x-servers
2020-05-24 23:06:08 +03:00
Backported from OpenAPI 3.0 [`servers` ](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#serverObject ). Currently doesn't support templates.
2017-02-26 00:44:19 +03:00
2016-12-26 00:47:33 +03:00
#### x-tagGroups
| Field Name | Type | Description |
| :------------- | :-----------: | :---------- |
| x-tagGroups | [ [Tag Group Object ](#tagGroupObject ) ] | A list of tag groups |
###### Usage in Redoc
2017-02-28 23:04:24 +03:00
`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!
2016-12-26 00:47:33 +03:00
#### <a name="tagGroupObject"></a>Tag Group Object
Information about tags group
###### Fixed fields
| Field Name | Type | Description |
| :---------- | :--------: | :---------- |
| name | string | The group name |
| tags | [ string ] | List of tags to include in this group
###### x-tagGroups example
json
```json
{
"x-tagGroups": [
{
"name": "User Management",
"tags": ["Users", "API keys", "Admin"]
},
{
"name": "Statistics",
"tags": ["Main Stats", "Secondary Stats"]
}
]
}
```
yaml
```yaml
x-tagGroups:
- name: User Management
tags:
- Users
- API keys
- Admin
- name: Statistics
tags:
- Main Stats
- Secondary Stats
```
2017-09-21 01:18:38 +03:00
#### x-ignoredHeaderParameters
| Field Name | Type | Description |
| :-------------------------- | :-----------: | :---------- |
| x-ignoredHeaderParameters | [ string ] | A list of ignored headers |
###### Usage in Redoc
`x-ignoredHeaderParameters` is used to specify header parameter names which are ignored by ReDoc
###### x-ignoredHeaderParameters example
```yaml
swagger: '2.0'
info:
...
tags: [...]
x-ignoredHeaderParameters:
- Accept
- User-Agent
- X-Test-Header
```
2016-12-26 00:47:33 +03:00
2016-07-17 21:48:56 +03:00
### Info Object vendor extensions
Extends OpenAPI [Info Object ](http://swagger.io/specification/#infoObject )
2016-07-17 19:02:27 +03:00
#### x-logo
2016-02-01 20:38:21 +03:00
| Field Name | Type | Description |
| :------------- | :-----------: | :---------- |
| x-logo | [Logo Object ](#logoObject ) | The information about API logo |
2016-02-01 20:23:13 +03:00
2016-02-01 20:49:57 +03:00
###### Usage in Redoc
2016-02-01 20:23:13 +03:00
`x-logo` is used to specify API logo. The corresponding image are displayed just above side-menu.
2016-02-01 20:49:57 +03:00
#### <a name="logoObject"></a>Logo Object
2016-02-01 20:23:13 +03:00
The information about API logo
2016-02-01 20:49:57 +03:00
###### Fixed fields
2016-02-01 20:38:21 +03:00
| Field Name | Type | Description |
| :-------------- | :------: | :---------- |
2017-11-28 11:10:06 +03:00
| url | string | The URL pointing to the spec logo. MUST be in the format of a URL. It SHOULD be an absolute URL so your API definition is usable from any location
2016-04-16 14:34:19 +03:00
| backgroundColor | string | background color to be used. MUST be RGB color in [hexadecimal format] (https://en.wikipedia.org/wiki/Web_colors#Hex_triplet)
2018-08-02 15:27:38 +03:00
| altText | string | Text to use for alt tag on the logo. Defaults to 'logo' if nothing is provided.
2018-11-27 12:27:10 +03:00
| href | string | The URL pointing to the contact page. Default to 'info.contact.url' field of the OAS.
2016-02-01 20:23:13 +03:00
2016-02-01 20:49:57 +03:00
###### x-logo example
json
```json
2016-02-01 20:23:13 +03:00
{
"info": {
"version": "1.0.0",
"title": "Swagger Petstore",
"x-logo": {
2019-06-04 15:47:22 +03:00
"url": "https://redocly.github.io/redoc/petstore-logo.png",
2018-08-02 15:27:38 +03:00
"backgroundColor": "#FFFFFF",
"altText": "Petstore logo"
2016-02-01 20:23:13 +03:00
}
}
}
```
2016-02-01 20:49:57 +03:00
yaml
2016-02-01 20:23:13 +03:00
```yaml
2016-02-01 20:49:57 +03:00
info:
version: "1.0.0"
title: "Swagger Petstore"
x-logo:
2019-06-04 15:47:22 +03:00
url: "https://redocly.github.io/redoc/petstore-logo.png"
2016-04-22 16:33:27 +03:00
backgroundColor: "#FFFFFF"
2018-08-02 15:27:38 +03:00
altText: "Petstore logo"
2016-02-01 20:23:13 +03:00
```
2016-07-17 21:48:56 +03:00
### Tag Object vendor extensions
Extends OpenAPI [Tag Object ](http://swagger.io/specification/#tagObject )
2017-02-03 00:24:00 +03:00
#### x-traitTag
2016-02-01 20:38:21 +03:00
| Field Name | Type | Description |
| :------------- | :------: | :---------- |
2019-01-10 18:28:21 +03:00
| x-traitTag | boolean | In Swagger two operations can have multiple tags. This property distinguishes between tags that are used to group operations (default) from tags that are used to mark operation with certain trait (`true` value) |
2016-02-01 20:23:13 +03:00
2016-02-01 20:49:57 +03:00
###### Usage in Redoc
2016-02-01 20:23:13 +03:00
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.
2016-02-01 20:49:57 +03:00
###### x-traitTag example
json
2016-02-01 20:23:13 +03:00
```json
{
"name": "Pagination",
"description": "Pagination description (can use markdown syntax)",
"x-traitTag": true
}
```
2016-02-01 20:49:57 +03:00
yaml
2016-02-01 20:23:13 +03:00
```yaml
name: Pagination
description: Pagination description (can use markdown syntax)
x-traitTag: true
```
2019-02-26 10:58:18 +03:00
#### x-displayName
| Field Name | Type | Description |
| :------------- | :------: | :---------- |
| x-displayName | string | Defines the text that is used for this tag in the menu and in section headings |
2016-07-17 21:48:56 +03:00
### Operation Object vendor extensions
Extends OpenAPI [Operation Object ](http://swagger.io/specification/#operationObject )
2020-05-10 22:11:01 +03:00
#### x-codeSamples
2016-02-01 20:38:21 +03:00
| Field Name | Type | Description |
| :------------- | :------: | :---------- |
2020-05-10 22:11:01 +03:00
| x-codeSamples | [ [Code Sample Object ](#codeSampleObject ) ] | A list of code samples associated with operation |
2016-02-01 20:23:13 +03:00
2016-02-01 20:49:57 +03:00
###### Usage in ReDoc
2020-05-10 22:11:01 +03:00
`x-codeSamples` are rendered on the right panel of ReDoc
2016-02-01 20:23:13 +03:00
2016-02-01 20:49:57 +03:00
#### <a name="codeSampleObject"></a>Code Sample Object
2016-02-01 20:23:13 +03:00
Operation code sample
2016-02-01 20:49:57 +03:00
###### Fixed fields
2016-02-01 20:38:21 +03:00
| Field Name | Type | Description |
| :---------- | :------: | :----------- |
| lang | string | Code sample language. Value should be one of the following [list ](https://github.com/github/linguist/blob/master/lib/linguist/popular.yml ) |
2018-08-01 10:20:15 +03:00
| label | string? | Code sample label e.g. `Node` or `Python2.7` , _optional_ , `lang` will be used by default |
2016-02-01 20:38:21 +03:00
| source | string | Code sample source code |
2016-02-01 20:23:13 +03:00
2016-02-01 20:49:57 +03:00
###### Code Sample Object example
json
```json
2016-02-01 20:23:13 +03:00
{
"lang": "JavaScript",
"source": "console.log('Hello World');"
}
```
2016-02-01 20:49:57 +03:00
yaml
2016-02-01 20:23:13 +03:00
```yaml
2016-02-01 20:49:57 +03:00
lang: JavaScript
source: console.log('Hello World');
2016-02-01 20:23:13 +03:00
```
2016-08-31 22:45:34 +03:00
2017-03-09 13:55:23 +03:00
### Parameter Object vendor extensions
Extends OpenAPI [Parameter Object ](http://swagger.io/specification/#parameterObject )
#### x-examples
| Field Name | Type | Description |
| :------------- | :------: | :---------- |
| x-examples | [Example Object ](http://swagger.io/specification/#exampleObject ) | Object that contains examples for the request. Applies when `in` is `body` and mime-type is `application/json` |
###### Usage in ReDoc
`x-examples` are rendered in the JSON tab on the right panel of ReDoc.
2018-06-01 16:50:07 +03:00
### Response Object vendor extensions
2018-12-18 00:07:33 +03:00
Extends OpenAPI [Response Object ](https://swagger.io/specification/#responseObject )
2018-06-01 16:50:07 +03:00
#### x-summary
| Field Name | Type | Description |
| :------------- | :------: | :---------- |
| x-summary | string | a short summary of the response |
###### Usage in ReDoc
If specified, `x-summary` is used as the response button text. Description is rendered under the button.
2017-03-09 13:55:23 +03:00
2016-08-31 22:45:34 +03:00
### Schema Object vendor extensions
Extends OpenAPI [Schema Object ](http://swagger.io/specification/#schemaObject )
2016-12-08 12:40:00 +03:00
#### x-nullable
2016-08-31 22:45:34 +03:00
| Field Name | Type | Description |
| :------------- | :------: | :---------- |
| x-nullable | boolean | marks schema as a nullable |
###### Usage in ReDoc
Schemas marked as `x-nullable` are marked in ReDoc with the label Nullable
2017-02-26 03:17:22 +03:00
#### x-extendedDiscriminator
**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 |
###### Usage in ReDoc
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` .
###### x-extendedDiscriminator example
```yaml
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` .
2019-06-18 11:41:48 +03:00
#### x-additionalPropertiesName
**ATTENTION**: This is ReDoc-specific vendor extension. It won't be supported by other tools.
Extends the `additionalProperties` property of the schema object.
| Field Name | Type | Description |
| :------------- | :------: | :---------- |
| x-additionalPropertiesName | string | descriptive name of additional properties keys |
###### Usage in ReDoc
ReDoc uses this extension to display a more descriptive property name in objects with `additionalProperties` when viewing the property list with an `object` .
###### x-additionalPropertiesName example
```yaml
Player:
required:
- name
properties:
name:
type: string
additionalProperties:
x-additionalPropertiesName: attribute-name
type: string
```
2020-03-27 13:09:44 +03:00
#### x-explicitMappingOnly
**ATTENTION**: This is ReDoc-specific vendor extension. It won't be supported by other tools.
Extends the `discriminator` property of the schema object.
| Field Name | Type | Description |
| :------------- | :------: | :---------- |
| x-explicitMappingOnly | boolean | limit the discriminator selectpicker to the explicit mappings only |
###### Usage in ReDoc
ReDoc uses this extension to filter the `discriminator` mappings shown in the selectpicker.
When set to `true` , the selectpicker will only list the the explicitly defined mappings. When `false` ,
the default behavior is kept, i.e. explicit and implicit mappings will be shown.
###### x-explicitMappingOnly example
```yaml
Pet:
type: object
required:
- name
- photoUrls
discriminator:
propertyName: petType
x-explicitMappingOnly: true
mapping:
cat: "#/components/schemas/Cat"
bee: "#/components/schemas/HoneyBee"
```
Will show in the selectpicker only the items `cat` and `bee` , even though the `Dog` class inherits from
the `Pet` class.