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
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.
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.
externalDocs
• Optional externalDocs: null | $Properties
Additional external documentation for this schema.
jsonSchema
• Optional jsonSchema: null | $Properties
Schema jsonSchema.
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.
Methods
toJSON
▸ toJSON(): Object
Converts this Schema to JSON.
Returns
Object
JSON object
create
▸ create(properties?): Schema & $Shape
Creates a new Schema instance using the specified properties.
Parameters
| Name | Type | Description |
|---|---|---|
properties? | $Shape | Properties to set |
Returns
Schema instance
▸ create(properties?): Schema
Parameters
| Name | Type |
|---|---|
properties? | $Properties |
Returns
decode
▸ decode(reader, length?): Schema & $Shape
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 & $Shape
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 | $Properties | 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 | $Properties | 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 |