We’re expecting the passed specification to adhere to the Swagger 2.0, OpenAPI 3.0 or OpenAPI 3.1 specification.
On top of that, we’ve added a few things for your convenience:
We provide examples for a lot of popular HTTP clients and frameworks. For something completly custom, for example to show the use of your own SDK, you can use x-codeSamples
:
openapi: 3.1.0
info:
title: Val Town API
version: '1.0'
paths:
'/v1/eval':
post:
+ x-codeSamples:
+ - label: ValTown JS SDK
+ lang: JavaScript
+ source: |-
+ import ValTown from '@valtown/sdk';
+
+ const valTown = new ValTown();
+
+ async function main() {
+ const valRunAnonymousResponse = await valTown.vals.runAnonymous({ code: 'console.log(1);' });
+
+ console.log(valRunAnonymousResponse);
+ }
+
+ main();
You can overwrite tag names with x-displayName
.
openapi: 3.1.0
info:
title: Example
version: '1.0'
tags:
- name: pl4n3t5
+ x-displayName: planets
paths:
'/planets':
get:
summary: Get all planets
tags:
- pl4n3t5
You can group your tags with x-tagGroup
.
openapi: 3.1.0
info:
title: Example
version: '1.0'
tags:
- name: planets
+x-tagGroups:
+ - name: galaxy
+ tags:
+ - planets
paths:
'/planets':
get:
summary: Get all planets
tags:
- planets
You can hide operations from the reference with x-internal
.
openapi: 3.1.0
info:
title: Example
version: '1.0'
paths:
'/planets':
get:
summary: Get all planets
post:
summary: Create a new planet
+ x-internal: true
You can add a custom attribute name to additionalProperties
with x-additionalPropertiesName
.
openapi: 3.1.0
info:
title: Example
version: '1.0'
components:
schemas:
Planet:
required:
- name
properties:
name:
type: string
additionalProperties:
+ x-additionalPropertiesName: anyCustomAttribute
type: string