Skip to content

Instantly share code, notes, and snippets.

@jfuerth
Last active April 21, 2021 21:53
Show Gist options
  • Save jfuerth/42f432cc602cac5dcfb8ebc6baa512d3 to your computer and use it in GitHub Desktop.
Save jfuerth/42f432cc602cac5dcfb8ebc6baa512d3 to your computer and use it in GitHub Desktop.
An OpenAPI spec for a type that has an which is a JSON Schema
openapi: "3.0.2"
paths:
/table/{tableName}:
get:
responses:
'200':
content:
application/json:
schema:
$ref: "#/components/schemas/Table"
components:
schemas:
Table:
properties:
data_model:
$ref: "https://json-schema.org/draft-07/schema#"
data:
type: array
description: Array of rows, each adhering to the schema given in the `data_model` property
items:
# Each item must conform to the schema provided in the "data_model" section of this Table.
# Not sure if this constraint can be expressed better in OpenAPI 3.0.
type: object
openapi: "3.0.2"
paths:
/table/{tableName}:
get:
responses:
'200':
content:
application/json:
schema:
$ref: "#/components/schemas/Table"
components:
schemas:
Table:
properties:
data_model:
allOf:
- description: A JSON Schema that defines the structure of each row in the data array
- $ref: "https://json-schema.org/draft-07/schema#"
data:
type: array
description: Array of rows, each adhering to the schema given in the `data_model` property
items:
# Each item must conform to the schema provided in the "data_model" section of this Table.
# Not sure if this constraint can be expressed better in OpenAPI 3.0.
type: object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment