pub struct JsonSchema {Show 26 fields
pub ref: String,
pub title: String,
pub description: String,
pub default: String,
pub read_only: bool,
pub example: String,
pub multiple_of: f64,
pub maximum: f64,
pub exclusive_maximum: bool,
pub minimum: f64,
pub exclusive_minimum: bool,
pub max_length: u64,
pub min_length: u64,
pub pattern: String,
pub max_items: u64,
pub min_items: u64,
pub unique_items: bool,
pub max_properties: u64,
pub min_properties: u64,
pub required: Vec<String>,
pub array: Vec<String>,
pub type: Vec<i32>,
pub format: String,
pub enum: Vec<String>,
pub field_configuration: Option<FieldConfiguration>,
pub extensions: HashMap<String, Value>,
}Expand description
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."
}];}
Fields§
§ref: StringRef is used to define an external reference to include in the message.
This could be a fully qualified proto message reference, and that type must
be imported into the protofile. If no message is identified, the Ref will
be used verbatim in the output.
For example:
ref: ".google.protobuf.Timestamp".
title: StringThe title of the schema.
description: StringA short description of the schema.
default: String§read_only: bool§example: StringA 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
multiple_of: f64§maximum: f64Maximum represents an inclusive upper limit for a numeric instance. The value of MUST be a number,
exclusive_maximum: bool§minimum: f64minimum represents an inclusive lower limit for a numeric instance. The value of MUST be a number,
exclusive_minimum: bool§max_length: u64§min_length: u64§pattern: String§max_items: u64§min_items: u64§unique_items: bool§max_properties: u64§min_properties: u64§required: Vec<String>§array: Vec<String>Items in ‘array’ must be unique.
type: Vec<i32>§format: StringFormat
enum: Vec<String>Items in enum must be unique https://tools.ietf.org/html/draft-fge-json-schema-validation-00#section-5.5.1
field_configuration: Option<FieldConfiguration>Additional field level properties used when generating the OpenAPI v2 file.
extensions: HashMap<String, Value>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/
Implementations§
Source§impl JsonSchema
impl JsonSchema
Trait Implementations§
Source§impl Clone for JsonSchema
impl Clone for JsonSchema
Source§fn clone(&self) -> JsonSchema
fn clone(&self) -> JsonSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for JsonSchema
impl Debug for JsonSchema
Source§impl Default for JsonSchema
impl Default for JsonSchema
Source§impl<'de> Deserialize<'de> for JsonSchema
impl<'de> Deserialize<'de> for JsonSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Message for JsonSchema
impl Message for JsonSchema
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.Source§impl PartialEq for JsonSchema
impl PartialEq for JsonSchema
Source§impl Serialize for JsonSchema
impl Serialize for JsonSchema
impl StructuralPartialEq for JsonSchema
Auto Trait Implementations§
impl Freeze for JsonSchema
impl RefUnwindSafe for JsonSchema
impl Send for JsonSchema
impl Sync for JsonSchema
impl Unpin for JsonSchema
impl UnwindSafe for JsonSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request