Class: Schema
protoc_gen_openapiv2.options.Schema
Schema is a representation of OpenAPI v2 specification's Schema object.
See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#schemaObject
Implements
Constructors
constructor
• new Schema(properties?): Schema
Constructs a new Schema.
Parameters
| Name | Type | Description |
|---|---|---|
properties? | ISchema | Properties to set |
Returns
Properties
discriminator
• discriminator: string
Adds support for polymorphism. The discriminator is the schema property name that is used to differentiate between other schema that inherit this schema. The property name used MUST be defined at this schema and it MUST be in the required property list. When used, the value MUST be the name of this schema or any schema that inherits it.
Implementation of
example
• example: string
A free-form property to include an example of an instance for this schema in JSON. This is copied verbatim to the output.
Implementation of
externalDocs
• Optional externalDocs: null | IExternalDocumentation
Additional external documentation for this schema.
Implementation of
jsonSchema
• Optional jsonSchema: null | IJSONSchema
Schema jsonSchema.
Implementation of
readOnly
• readOnly: boolean
Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but MUST NOT be sent as part of the request. Properties marked as readOnly being true SHOULD NOT be in the required list of the defined schema. Default value is false.
Implementation of
Methods
toJSON
▸ toJSON(): Object
Converts this Schema to JSON.
Returns
Object
JSON object
create
▸ create(properties?): Schema
Creates a new Schema instance using the specified properties.
Parameters
| Name | Type | Description |
|---|---|---|
properties? | ISchema | Properties to set |
Returns
Schema instance
decode
▸ decode(reader, length?): Schema
Decodes a Schema message from the specified reader or buffer.
Parameters
| Name | Type | Description |
|---|---|---|
reader | Uint8Array | Reader | Reader or buffer to decode from |
length? | number | Message length if known beforehand |
Returns
Schema
Throws
If the payload is not a reader or valid buffer
Throws
If required fields are missing
decodeDelimited
▸ decodeDelimited(reader): Schema
Decodes a Schema message from the specified reader or buffer, length delimited.
Parameters
| Name | Type | Description |
|---|---|---|
reader | Uint8Array | Reader | Reader or buffer to decode from |
Returns
Schema
Throws
If the payload is not a reader or valid buffer
Throws
If required fields are missing
encode
▸ encode(message, writer?): Writer
Encodes the specified Schema message. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.Schema.verify|verify messages.
Parameters
| Name | Type | Description |
|---|---|---|
message | ISchema | Schema message or plain object to encode |
writer? | Writer | Writer to encode to |
Returns
Writer
Writer
encodeDelimited
▸ encodeDelimited(message, writer?): Writer
Encodes the specified Schema message, length delimited. Does not implicitly grpc.gateway.protoc_gen_openapiv2.options.Schema.verify|verify messages.
Parameters
| Name | Type | Description |
|---|---|---|
message | ISchema | Schema message or plain object to encode |
writer? | Writer | Writer to encode to |
Returns
Writer
Writer
fromObject
▸ fromObject(object): Schema
Creates a Schema message from a plain object. Also converts values to their respective internal types.
Parameters
| Name | Type | Description |
|---|---|---|
object | Object | Plain object |
Returns
Schema
getTypeUrl
▸ getTypeUrl(typeUrlPrefix?): string
Gets the default type url for Schema
Parameters
| Name | Type | Description |
|---|---|---|
typeUrlPrefix? | string | your custom typeUrlPrefix(default "type.googleapis.com") |
Returns
string
The default type url
toObject
▸ toObject(message, options?): Object
Creates a plain object from a Schema message. Also converts values to other types if specified.
Parameters
| Name | Type | Description |
|---|---|---|
message | Schema | Schema |
options? | IConversionOptions | Conversion options |
Returns
Object
Plain object