Skip to content

Instantly share code, notes, and snippets.

@eiel
Last active May 22, 2018 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiel/99c29911e7c4fe6714977e0eed973bab to your computer and use it in GitHub Desktop.
Save eiel/99c29911e7c4fe6714977e0eed973bab to your computer and use it in GitHub Desktop.
const { parseSchema } = require('json-schema-to-flow-type')
const schema = require('./opeanapi.json')
const flow = parseSchema(schema, {'http://json-schema.org/draft-04/schema': 'scheama.json'})
console.log(`// @flow\n\n${flow}`)
// @flow
export type Info = {|
title: string,
description?: string,
termsOfService?: string,
contact?: Contact,
license?: License,
version: string,
[key: any]: SpecificationExtension,
|};
export type Contact = {|
name?: string,
url?: string,
email?: string,
[key: any]: SpecificationExtension,
|};
export type License = {|
name: string,
url?: string,
[key: any]: SpecificationExtension,
|};
export type Server = {|
url: string,
description?: string,
variables?: ServerVariables,
[key: any]: SpecificationExtension,
|};
export type ServerVariable = {|
enum?: Array<string>,
default: string,
description?: string,
[key: any]: SpecificationExtension,
|};
export type Components = {|
schemas?: SchemasOrReferences,
responses?: ResponsesOrReferences,
parameters?: ParametersOrReferences,
examples?: ExamplesOrReferences,
requestBodies?: RequestBodiesOrReferences,
headers?: HeadersOrReferences,
securitySchemes?: SecuritySchemesOrReferences,
links?: LinksOrReferences,
callbacks?: CallbacksOrReferences,
[key: any]: SpecificationExtension,
|};
export type Paths = {|
[key: any]: PathItem | SpecificationExtension
|};
export type PathItem = {|
$ref?: string,
summary?: string,
description?: string,
get?: Operation,
put?: Operation,
post?: Operation,
delete?: Operation,
options?: Operation,
head?: Operation,
patch?: Operation,
trace?: Operation,
servers?: Array<Server>,
parameters?: Array<ParameterOrReference>,
[key: any]: SpecificationExtension,
|};
export type Operation = {|
tags?: Array<string>,
summary?: string,
description?: string,
externalDocs?: ExternalDocs,
operationId?: string,
parameters?: Array<ParameterOrReference>,
requestBody?: RequestBodyOrReference,
responses: Responses,
callbacks?: CallbacksOrReferences,
deprecated?: boolean,
security?: Array<SecurityRequirement>,
servers?: Array<Server>,
[key: any]: SpecificationExtension,
|};
export type ExternalDocs = {|
description?: string,
url: string,
[key: any]: SpecificationExtension,
|};
export type Parameter = {|
name: string,
in: string,
description?: string,
required?: boolean,
deprecated?: boolean,
allowEmptyValue?: boolean,
style?: string,
explode?: boolean,
allowReserved?: boolean,
schema?: SchemaOrReference,
example?: Any,
examples?: ExamplesOrReferences,
content?: MediaTypes,
[key: any]: SpecificationExtension,
|};
export type RequestBody = {|
description?: string,
content: MediaTypes,
required?: boolean,
[key: any]: SpecificationExtension,
|};
export type MediaType = {|
schema?: SchemaOrReference,
example?: Any,
examples?: ExamplesOrReferences,
encoding?: Encodings,
[key: any]: SpecificationExtension,
|};
export type Encoding = {|
contentType?: string,
headers?: Headers,
style?: string,
explode?: boolean,
allowReserved?: boolean,
[key: any]: SpecificationExtension,
|};
export type Responses = {|
default?: ResponseOrReference,
[key: any]: ResponseOrReference | SpecificationExtension,
|};
export type Response = {|
description: string,
headers?: HeadersOrReferences,
content?: MediaTypes,
links?: LinksOrReferences,
[key: any]: SpecificationExtension,
|};
export type Callback = {|
[key: any]: PathItem | SpecificationExtension
|};
export type Example = {|
summary?: string,
description?: string,
value?: Any,
externalValue?: string,
[key: any]: SpecificationExtension,
|};
export type Link = {|
operationRef?: string,
operationId?: string,
parameters?: AnysOrExpressions,
requestBody?: AnyOrExpression,
description?: string,
server?: Server,
[key: any]: SpecificationExtension,
|};
export type Header = {|
description?: string,
required?: boolean,
deprecated?: boolean,
allowEmptyValue?: boolean,
style?: string,
explode?: boolean,
allowReserved?: boolean,
schema?: SchemaOrReference,
example?: Any,
examples?: ExamplesOrReferences,
content?: MediaTypes,
[key: any]: SpecificationExtension,
|};
export type Tag = {|
name: string,
description?: string,
externalDocs?: ExternalDocs,
[key: any]: SpecificationExtension,
|};
export type Examples = {||};
export type Reference = {|
$ref: string
|};
export type Schema = {|
nullable?: boolean,
discriminator?: Discriminator,
readOnly?: boolean,
writeOnly?: boolean,
xml?: Xml,
externalDocs?: ExternalDocs,
example?: Any,
deprecated?: boolean,
title?: HttpJsonSchemaOrgDraft04SchemaPropertiesTitle,
multipleOf?: HttpJsonSchemaOrgDraft04SchemaPropertiesMultipleOf,
maximum?: HttpJsonSchemaOrgDraft04SchemaPropertiesMaximum,
exclusiveMaximum?: HttpJsonSchemaOrgDraft04SchemaPropertiesExclusiveMaximum,
minimum?: HttpJsonSchemaOrgDraft04SchemaPropertiesMinimum,
exclusiveMinimum?: HttpJsonSchemaOrgDraft04SchemaPropertiesExclusiveMinimum,
maxLength?: HttpJsonSchemaOrgDraft04SchemaPropertiesMaxLength,
minLength?: HttpJsonSchemaOrgDraft04SchemaPropertiesMinLength,
pattern?: HttpJsonSchemaOrgDraft04SchemaPropertiesPattern,
maxItems?: HttpJsonSchemaOrgDraft04SchemaPropertiesMaxItems,
minItems?: HttpJsonSchemaOrgDraft04SchemaPropertiesMinItems,
uniqueItems?: HttpJsonSchemaOrgDraft04SchemaPropertiesUniqueItems,
maxProperties?: HttpJsonSchemaOrgDraft04SchemaPropertiesMaxProperties,
minProperties?: HttpJsonSchemaOrgDraft04SchemaPropertiesMinProperties,
required?: HttpJsonSchemaOrgDraft04SchemaPropertiesRequired,
enum?: HttpJsonSchemaOrgDraft04SchemaPropertiesEnum,
type?: string,
allOf?: Array<SchemaOrReference>,
oneOf?: Array<SchemaOrReference>,
anyOf?: Array<SchemaOrReference>,
not?: Schema,
items?: SchemaOrReference | Array<SchemaOrReference>,
properties?: {
[key: any]: SchemaOrReference
},
additionalProperties?: SchemaOrReference | boolean,
default?: DefaultType,
description?: string,
format?: string,
[key: any]: SpecificationExtension,
|};
export type Discriminator = {|
propertyName: string,
mapping?: Strings,
|};
export type Xml = {|
name?: string,
namespace?: string,
prefix?: string,
attribute?: boolean,
wrapped?: boolean,
[key: any]: SpecificationExtension,
|};
export type SecurityScheme = {|
type: string,
description?: string,
name?: string,
in?: string,
scheme?: string,
bearerFormat?: string,
flows?: OauthFlows,
openIdConnectUrl?: string,
[key: any]: SpecificationExtension,
|};
export type OauthFlows = {|
implicit?: OauthFlow,
password?: OauthFlow,
clientCredentials?: OauthFlow,
authorizationCode?: OauthFlow,
[key: any]: SpecificationExtension,
|};
export type OauthFlow = {|
authorizationUrl?: string,
tokenUrl?: string,
refreshUrl?: string,
scopes?: Strings,
[key: any]: SpecificationExtension,
|};
export type SecurityRequirement = {|
[key: any]: Array<string>
|};
export type AnyOrExpression = Any | Expression;
export type CallbackOrReference = Callback | Reference;
export type ExampleOrReference = Example | Reference;
export type HeaderOrReference = Header | Reference;
export type LinkOrReference = Link | Reference;
export type ParameterOrReference = Parameter | Reference;
export type RequestBodyOrReference = RequestBody | Reference;
export type ResponseOrReference = Response | Reference;
export type SchemaOrReference = Schema | Reference;
export type SecuritySchemeOrReference = SecurityScheme | Reference;
export type AnysOrExpressions = {
[key: any]: AnyOrExpression
};
export type CallbacksOrReferences = {
[key: any]: CallbackOrReference
};
export type Encodings = {
[key: any]: Encoding
};
export type ExamplesOrReferences = {
[key: any]: ExampleOrReference
};
export type Headers = {
[key: any]: Header
};
export type HeadersOrReferences = {
[key: any]: HeaderOrReference
};
export type LinksOrReferences = {
[key: any]: LinkOrReference
};
export type MediaTypes = {
[key: any]: MediaType
};
export type ParametersOrReferences = {
[key: any]: ParameterOrReference
};
export type RequestBodiesOrReferences = {
[key: any]: RequestBodyOrReference
};
export type ResponsesOrReferences = {
[key: any]: ResponseOrReference
};
export type SchemasOrReferences = {
[key: any]: SchemaOrReference
};
export type SecuritySchemesOrReferences = {
[key: any]: SecuritySchemeOrReference
};
export type ServerVariables = {
[key: any]: ServerVariable
};
export type Strings = {
[key: any]: string
};
export type Object = {
[key: any]: any
};
export type Any = {
[key: any]: any
};
export type Expression = {
[key: any]: any
};
export type SpecificationExtension = null | number | boolean | string | any | any;
export type DefaultType = null | any | any | number | boolean | string;
export type HttpOpenapisOrgV3SchemaJson = {|
openapi: string,
info: Info,
servers?: Array<Server>,
paths: Paths,
components?: Components,
security?: Array<SecurityRequirement>,
tags?: Array<Tag>,
externalDocs?: ExternalDocs,
[key: any]: SpecificationExtension,
|};
{
"title": "A JSON Schema for OpenAPI 3.0.",
"id": "http://openapis.org/v3/schema.json#",
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "This is the root document object of the OpenAPI definition file.",
"required": [
"openapi",
"info",
"paths"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"openapi": {
"type": "string"
},
"info": {
"$ref": "#/definitions/info"
},
"servers": {
"type": "array",
"items": {
"$ref": "#/definitions/server"
},
"uniqueItems": true
},
"paths": {
"$ref": "#/definitions/paths"
},
"components": {
"$ref": "#/definitions/components"
},
"security": {
"type": "array",
"items": {
"$ref": "#/definitions/securityRequirement"
},
"uniqueItems": true
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/tag"
},
"uniqueItems": true
},
"externalDocs": {
"$ref": "#/definitions/externalDocs"
}
},
"definitions": {
"info": {
"type": "object",
"description": "The object provides metadata about the API. The metadata can be used by the clients if needed, and can be presented in editing or documentation generation tools for convenience.",
"required": [
"title",
"version"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"termsOfService": {
"type": "string"
},
"contact": {
"$ref": "#/definitions/contact"
},
"license": {
"$ref": "#/definitions/license"
},
"version": {
"type": "string"
}
}
},
"contact": {
"type": "object",
"description": "Contact information for the exposed API.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string"
},
"email": {
"type": "string"
}
}
},
"license": {
"type": "object",
"description": "License information for the exposed API.",
"required": [
"name"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"name": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"server": {
"type": "object",
"description": "An object representing a Server.",
"required": [
"url"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"url": {
"type": "string"
},
"description": {
"type": "string"
},
"variables": {
"$ref": "#/definitions/serverVariables"
}
}
},
"serverVariable": {
"type": "object",
"description": "An object representing a Server Variable for server URL template substitution.",
"required": [
"default"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"enum": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"default": {
"type": "string"
},
"description": {
"type": "string"
}
}
},
"components": {
"type": "object",
"description": "Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"schemas": {
"$ref": "#/definitions/schemasOrReferences"
},
"responses": {
"$ref": "#/definitions/responsesOrReferences"
},
"parameters": {
"$ref": "#/definitions/parametersOrReferences"
},
"examples": {
"$ref": "#/definitions/examplesOrReferences"
},
"requestBodies": {
"$ref": "#/definitions/requestBodiesOrReferences"
},
"headers": {
"$ref": "#/definitions/headersOrReferences"
},
"securitySchemes": {
"$ref": "#/definitions/securitySchemesOrReferences"
},
"links": {
"$ref": "#/definitions/linksOrReferences"
},
"callbacks": {
"$ref": "#/definitions/callbacksOrReferences"
}
}
},
"paths": {
"type": "object",
"description": "Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.",
"additionalProperties": false,
"patternProperties": {
"^/": {
"$ref": "#/definitions/pathItem"
},
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
}
},
"pathItem": {
"type": "object",
"description": "Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"$ref": {
"type": "string"
},
"summary": {
"type": "string"
},
"description": {
"type": "string"
},
"get": {
"$ref": "#/definitions/operation"
},
"put": {
"$ref": "#/definitions/operation"
},
"post": {
"$ref": "#/definitions/operation"
},
"delete": {
"$ref": "#/definitions/operation"
},
"options": {
"$ref": "#/definitions/operation"
},
"head": {
"$ref": "#/definitions/operation"
},
"patch": {
"$ref": "#/definitions/operation"
},
"trace": {
"$ref": "#/definitions/operation"
},
"servers": {
"type": "array",
"items": {
"$ref": "#/definitions/server"
},
"uniqueItems": true
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/definitions/parameterOrReference"
},
"uniqueItems": true
}
}
},
"operation": {
"type": "object",
"description": "Describes a single API operation on a path.",
"required": [
"responses"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
},
"summary": {
"type": "string"
},
"description": {
"type": "string"
},
"externalDocs": {
"$ref": "#/definitions/externalDocs"
},
"operationId": {
"type": "string"
},
"parameters": {
"type": "array",
"items": {
"$ref": "#/definitions/parameterOrReference"
},
"uniqueItems": true
},
"requestBody": {
"$ref": "#/definitions/requestBodyOrReference"
},
"responses": {
"$ref": "#/definitions/responses"
},
"callbacks": {
"$ref": "#/definitions/callbacksOrReferences"
},
"deprecated": {
"type": "boolean"
},
"security": {
"type": "array",
"items": {
"$ref": "#/definitions/securityRequirement"
},
"uniqueItems": true
},
"servers": {
"type": "array",
"items": {
"$ref": "#/definitions/server"
},
"uniqueItems": true
}
}
},
"externalDocs": {
"type": "object",
"description": "Allows referencing an external resource for extended documentation.",
"required": [
"url"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"description": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"parameter": {
"type": "object",
"description": "Describes a single operation parameter. A unique parameter is defined by a combination of a name and location.",
"required": [
"name",
"in"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"name": {
"type": "string"
},
"in": {
"type": "string"
},
"description": {
"type": "string"
},
"required": {
"type": "boolean"
},
"deprecated": {
"type": "boolean"
},
"allowEmptyValue": {
"type": "boolean"
},
"style": {
"type": "string"
},
"explode": {
"type": "boolean"
},
"allowReserved": {
"type": "boolean"
},
"schema": {
"$ref": "#/definitions/schemaOrReference"
},
"example": {
"$ref": "#/definitions/any"
},
"examples": {
"$ref": "#/definitions/examplesOrReferences"
},
"content": {
"$ref": "#/definitions/mediaTypes"
}
}
},
"requestBody": {
"type": "object",
"description": "Describes a single request body.",
"required": [
"content"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"description": {
"type": "string"
},
"content": {
"$ref": "#/definitions/mediaTypes"
},
"required": {
"type": "boolean"
}
}
},
"mediaType": {
"type": "object",
"description": "Each Media Type Object provides schema and examples for the media type identified by its key.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"schema": {
"$ref": "#/definitions/schemaOrReference"
},
"example": {
"$ref": "#/definitions/any"
},
"examples": {
"$ref": "#/definitions/examplesOrReferences"
},
"encoding": {
"$ref": "#/definitions/encodings"
}
}
},
"encoding": {
"type": "object",
"description": "A single encoding definition applied to a single schema property.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"contentType": {
"type": "string"
},
"headers": {
"$ref": "#/definitions/headers"
},
"style": {
"type": "string"
},
"explode": {
"type": "boolean"
},
"allowReserved": {
"type": "boolean"
}
}
},
"responses": {
"type": "object",
"description": "A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.",
"additionalProperties": false,
"patternProperties": {
"^([0-9X]{3})$": {
"$ref": "#/definitions/responseOrReference"
},
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"default": {
"$ref": "#/definitions/responseOrReference"
}
}
},
"response": {
"type": "object",
"description": "Describes a single response from an API Operation, including design-time, static `links` to operations based on the response.",
"required": [
"description"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"description": {
"type": "string"
},
"headers": {
"$ref": "#/definitions/headersOrReferences"
},
"content": {
"$ref": "#/definitions/mediaTypes"
},
"links": {
"$ref": "#/definitions/linksOrReferences"
}
}
},
"callback": {
"type": "object",
"description": "A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.",
"additionalProperties": false,
"patternProperties": {
"^": {
"$ref": "#/definitions/pathItem"
},
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
}
},
"example": {
"type": "object",
"description": "",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"summary": {
"type": "string"
},
"description": {
"type": "string"
},
"value": {
"$ref": "#/definitions/any"
},
"externalValue": {
"type": "string"
}
}
},
"link": {
"type": "object",
"description": "The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"operationRef": {
"type": "string"
},
"operationId": {
"type": "string"
},
"parameters": {
"$ref": "#/definitions/anysOrExpressions"
},
"requestBody": {
"$ref": "#/definitions/anyOrExpression"
},
"description": {
"type": "string"
},
"server": {
"$ref": "#/definitions/server"
}
}
},
"header": {
"type": "object",
"description": "The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`).",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"description": {
"type": "string"
},
"required": {
"type": "boolean"
},
"deprecated": {
"type": "boolean"
},
"allowEmptyValue": {
"type": "boolean"
},
"style": {
"type": "string"
},
"explode": {
"type": "boolean"
},
"allowReserved": {
"type": "boolean"
},
"schema": {
"$ref": "#/definitions/schemaOrReference"
},
"example": {
"$ref": "#/definitions/any"
},
"examples": {
"$ref": "#/definitions/examplesOrReferences"
},
"content": {
"$ref": "#/definitions/mediaTypes"
}
}
},
"tag": {
"type": "object",
"description": "Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.",
"required": [
"name"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"name": {
"type": "string"
},
"description": {
"type": "string"
},
"externalDocs": {
"$ref": "#/definitions/externalDocs"
}
}
},
"examples": {
"type": "object",
"description": "",
"additionalProperties": false
},
"reference": {
"type": "object",
"description": "A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.",
"required": [
"$ref"
],
"additionalProperties": false,
"properties": {
"$ref": {
"type": "string"
}
}
},
"schema": {
"type": "object",
"description": "The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"nullable": {
"type": "boolean"
},
"discriminator": {
"$ref": "#/definitions/discriminator"
},
"readOnly": {
"type": "boolean"
},
"writeOnly": {
"type": "boolean"
},
"xml": {
"$ref": "#/definitions/xml"
},
"externalDocs": {
"$ref": "#/definitions/externalDocs"
},
"example": {
"$ref": "#/definitions/any"
},
"deprecated": {
"type": "boolean"
},
"title": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/title"
},
"multipleOf": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/multipleOf"
},
"maximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/maximum"
},
"exclusiveMaximum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
},
"minimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/minimum"
},
"exclusiveMinimum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
},
"maxLength": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/maxLength"
},
"minLength": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/minLength"
},
"pattern": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/pattern"
},
"maxItems": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/maxItems"
},
"minItems": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/minItems"
},
"uniqueItems": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
},
"maxProperties": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/maxProperties"
},
"minProperties": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/minProperties"
},
"required": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/required"
},
"enum": {
"$ref": "http://json-schema.org/draft-04/schema#/properties/enum"
},
"type": {
"type": "string"
},
"allOf": {
"type": "array",
"items": {
"$ref": "#/definitions/schemaOrReference"
},
"minItems": 1
},
"oneOf": {
"type": "array",
"items": {
"$ref": "#/definitions/schemaOrReference"
},
"minItems": 1
},
"anyOf": {
"type": "array",
"items": {
"$ref": "#/definitions/schemaOrReference"
},
"minItems": 1
},
"not": {
"$ref": "#/definitions/schema"
},
"items": {
"anyOf": [
{
"$ref": "#/definitions/schemaOrReference"
},
{
"type": "array",
"items": {
"$ref": "#/definitions/schemaOrReference"
},
"minItems": 1
}
]
},
"properties": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/schemaOrReference"
}
},
"additionalProperties": {
"oneOf": [
{
"$ref": "#/definitions/schemaOrReference"
},
{
"type": "boolean"
}
]
},
"default": {
"$ref": "#/definitions/defaultType"
},
"description": {
"type": "string"
},
"format": {
"type": "string"
}
}
},
"discriminator": {
"type": "object",
"description": "When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered.",
"required": [
"propertyName"
],
"additionalProperties": false,
"properties": {
"propertyName": {
"type": "string"
},
"mapping": {
"$ref": "#/definitions/strings"
}
}
},
"xml": {
"type": "object",
"description": "A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"name": {
"type": "string"
},
"namespace": {
"type": "string"
},
"prefix": {
"type": "string"
},
"attribute": {
"type": "boolean"
},
"wrapped": {
"type": "boolean"
}
}
},
"securityScheme": {
"type": "object",
"description": "Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header or as a query parameter) and OAuth2's common flows (implicit, password, application and access code).",
"required": [
"type"
],
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"type": {
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"in": {
"type": "string"
},
"scheme": {
"type": "string"
},
"bearerFormat": {
"type": "string"
},
"flows": {
"$ref": "#/definitions/oauthFlows"
},
"openIdConnectUrl": {
"type": "string"
}
}
},
"oauthFlows": {
"type": "object",
"description": "Allows configuration of the supported OAuth Flows.",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"implicit": {
"$ref": "#/definitions/oauthFlow"
},
"password": {
"$ref": "#/definitions/oauthFlow"
},
"clientCredentials": {
"$ref": "#/definitions/oauthFlow"
},
"authorizationCode": {
"$ref": "#/definitions/oauthFlow"
}
}
},
"oauthFlow": {
"type": "object",
"description": "Configuration details for a supported OAuth Flow",
"additionalProperties": false,
"patternProperties": {
"^x-": {
"$ref": "#/definitions/specificationExtension"
}
},
"properties": {
"authorizationUrl": {
"type": "string"
},
"tokenUrl": {
"type": "string"
},
"refreshUrl": {
"type": "string"
},
"scopes": {
"$ref": "#/definitions/strings"
}
}
},
"securityRequirement": {
"type": "object",
"description": "Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.",
"additionalProperties": false,
"patternProperties": {
"^[a-zA-Z0-9\\.\\-_]+$": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
}
},
"anyOrExpression": {
"oneOf": [
{
"$ref": "#/definitions/any"
},
{
"$ref": "#/definitions/expression"
}
]
},
"callbackOrReference": {
"oneOf": [
{
"$ref": "#/definitions/callback"
},
{
"$ref": "#/definitions/reference"
}
]
},
"exampleOrReference": {
"oneOf": [
{
"$ref": "#/definitions/example"
},
{
"$ref": "#/definitions/reference"
}
]
},
"headerOrReference": {
"oneOf": [
{
"$ref": "#/definitions/header"
},
{
"$ref": "#/definitions/reference"
}
]
},
"linkOrReference": {
"oneOf": [
{
"$ref": "#/definitions/link"
},
{
"$ref": "#/definitions/reference"
}
]
},
"parameterOrReference": {
"oneOf": [
{
"$ref": "#/definitions/parameter"
},
{
"$ref": "#/definitions/reference"
}
]
},
"requestBodyOrReference": {
"oneOf": [
{
"$ref": "#/definitions/requestBody"
},
{
"$ref": "#/definitions/reference"
}
]
},
"responseOrReference": {
"oneOf": [
{
"$ref": "#/definitions/response"
},
{
"$ref": "#/definitions/reference"
}
]
},
"schemaOrReference": {
"oneOf": [
{
"$ref": "#/definitions/schema"
},
{
"$ref": "#/definitions/reference"
}
]
},
"securitySchemeOrReference": {
"oneOf": [
{
"$ref": "#/definitions/securityScheme"
},
{
"$ref": "#/definitions/reference"
}
]
},
"anysOrExpressions": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/anyOrExpression"
}
},
"callbacksOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/callbackOrReference"
}
},
"encodings": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/encoding"
}
},
"examplesOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/exampleOrReference"
}
},
"headers": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/header"
}
},
"headersOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/headerOrReference"
}
},
"linksOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/linkOrReference"
}
},
"mediaTypes": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/mediaType"
}
},
"parametersOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/parameterOrReference"
}
},
"requestBodiesOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/requestBodyOrReference"
}
},
"responsesOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/responseOrReference"
}
},
"schemasOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/schemaOrReference"
}
},
"securitySchemesOrReferences": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/securitySchemeOrReference"
}
},
"serverVariables": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/serverVariable"
}
},
"strings": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"object": {
"type": "object",
"additionalProperties": true
},
"any": {
"additionalProperties": true
},
"expression": {
"type": "object",
"additionalProperties": true
},
"specificationExtension": {
"description": "Any property starting with x- is valid.",
"oneOf": [
{
"type": "null"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "string"
},
{
"type": "object"
},
{
"type": "array"
}
]
},
"defaultType": {
"oneOf": [
{
"type": "null"
},
{
"type": "array"
},
{
"type": "object"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "string"
}
]
}
}
}
{
"dependencies": {
"json-schema-to-flow-type": "^0.4.0"
}
}
{
"id": "http://json-schema.org/draft-04/schema#",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Core schema meta-schema",
"definitions": {
"schemaArray": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#" }
},
"positiveInteger": {
"type": "integer",
"minimum": 0
},
"positiveIntegerDefault0": {
"allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ]
},
"simpleTypes": {
"enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ]
},
"stringArray": {
"type": "array",
"items": { "type": "string" },
"minItems": 1,
"uniqueItems": true
}
},
"type": "object",
"properties": {
"id": {
"type": "string"
},
"$schema": {
"type": "string"
},
"title": {
"type": "string"
},
"description": {
"type": "string"
},
"default": {},
"multipleOf": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
},
"maximum": {
"type": "number"
},
"exclusiveMaximum": {
"type": "boolean",
"default": false
},
"minimum": {
"type": "number"
},
"exclusiveMinimum": {
"type": "boolean",
"default": false
},
"maxLength": { "$ref": "#/definitions/positiveInteger" },
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" },
"pattern": {
"type": "string",
"format": "regex"
},
"additionalItems": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"items": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/schemaArray" }
],
"default": {}
},
"maxItems": { "$ref": "#/definitions/positiveInteger" },
"minItems": { "$ref": "#/definitions/positiveIntegerDefault0" },
"uniqueItems": {
"type": "boolean",
"default": false
},
"maxProperties": { "$ref": "#/definitions/positiveInteger" },
"minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" },
"required": { "$ref": "#/definitions/stringArray" },
"additionalProperties": {
"anyOf": [
{ "type": "boolean" },
{ "$ref": "#" }
],
"default": {}
},
"definitions": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"properties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"patternProperties": {
"type": "object",
"additionalProperties": { "$ref": "#" },
"default": {}
},
"dependencies": {
"type": "object",
"additionalProperties": {
"anyOf": [
{ "$ref": "#" },
{ "$ref": "#/definitions/stringArray" }
]
}
},
"enum": {
"type": "array",
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
{ "$ref": "#/definitions/simpleTypes" },
{
"type": "array",
"items": { "$ref": "#/definitions/simpleTypes" },
"minItems": 1,
"uniqueItems": true
}
]
},
"format": { "type": "string" },
"allOf": { "$ref": "#/definitions/schemaArray" },
"anyOf": { "$ref": "#/definitions/schemaArray" },
"oneOf": { "$ref": "#/definitions/schemaArray" },
"not": { "$ref": "#" }
},
"dependencies": {
"exclusiveMaximum": [ "maximum" ],
"exclusiveMinimum": [ "minimum" ]
},
"default": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment