Supported Extensions
x-code-samples
Use x-code-samples (or x-codeSamples) to provide custom code snippets for an API operation. When
present, these samples appear in the sidecar panel alongside the auto-generated request examples.
Location
The extension is added at the Operation Object level.
| Option | Type | Description |
|---|---|---|
x-code-samples | [Code Sample Object] | Array of custom code samples. |
x-codeSamples | [Code Sample Object] | Alias for x-code-samples. |
Code Sample Object
| Property | Type | Required | Description |
|---|---|---|---|
lang | string | Yes | Language identifier used for syntax highlighting. |
label | string | No | Display label for the tab. Defaults to lang value. |
source | string | Yes | The code snippet content. |
Example
Code
Last modified on