Class: JSONSchema
protoc_gen_openapiv2.options.JSONSchema
JSONSchema represents properties from JSON Schema taken, and as used, in
the OpenAPI v2 spec.
This includes changes made by OpenAPI v2.
See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject
See also: https://cswr.github.io/JsonSchema/spec/basic_types/, https://github.com/json-schema-org/json-schema-spec/blob/master/schema.json
Example:
message SimpleMessage { option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_schema) = { json_schema: { title: "SimpleMessage" description: "A simple message." required: ["id"] } };
// Id represents the message identifier. string id = 1; [ (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = { description: "The unique identifier of the simple message." }]; }
Implements
Constructors
constructor
• new JSONSchema(properties?): JSONSchema
Constructs a new JSONSchema.
Parameters
| Name | Type | Description |
|---|---|---|
properties? | IJSONSchema | Properties to set |
Returns
Properties
array
• array: string[]
Items in 'array' must be unique.
Implementation of
default
• default: string
JSONSchema default.
Implementation of
description
• description: string
A short description of the schema.
Implementation of
enum
• enum: string[]
Items in enum must be unique https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1
Implementation of
example
• example: string
A free-form property to include a JSON example of this field. This is copied verbatim to the output swagger.json. Quotes must be escaped. This property is the same for 2.0 and 3.0.0 https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/3.0.0.md#schemaObject https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject
Implementation of
exclusiveMaximum
• exclusiveMaximum: boolean
JSONSchema exclusiveMaximum.
Implementation of
exclusiveMinimum
• exclusiveMinimum: boolean
JSONSchema exclusiveMinimum.
Implementation of
extensions
• extensions: Object
Custom properties that start with "x-" such as "x-foo" used to describe extra functionality that is not covered by the standard OpenAPI Specification. See: https://swagger.io/docs/specification/2-0/swagger-extensions/
Index signature
▪ [k: string]: IValue
Implementation of
fieldConfiguration
• Optional fieldConfiguration: null | IFieldConfiguration
Additional field level properties used when generating the OpenAPI v2 file.
Implementation of
IJSONSchema.fieldConfiguration
format
• format: string
Format
Implementation of
maxItems
• maxItems: Long
JSONSchema maxItems.
Implementation of
maxLength
• maxLength: Long
JSONSchema maxLength.