pub struct Extension {
pub ty: ExtensionTypeId,
pub entity_ty: Option<EntityTypeId>,
pub description: String,
pub extension: Value,
}Expand description
Extension on a type. The extension allows to extend information
Fields§
§ty: ExtensionTypeIdThe fully qualified namespace of the extension.
entity_ty: Option<EntityTypeId>The fully qualified namespace of the entity type which is the type constraint of the extension.
description: StringTextual description of the extension.
extension: ValueThe extension as JSON representation.
Implementations§
Source§impl Extension
impl Extension
Sourcepub fn new<T: Into<ExtensionTypeId>, S: Into<String>>(
ty: T,
description: S,
extension: Value,
) -> Extension
pub fn new<T: Into<ExtensionTypeId>, S: Into<String>>( ty: T, description: S, extension: Value, ) -> Extension
Constructs an extension from the given namespaced type with the given description, components, properties and extensions.
Sourcepub fn new_with_type_constraint<T: Into<ExtensionTypeId>, ET: Into<EntityTypeId>, S: Into<String>>(
ty: T,
entity_ty: ET,
description: S,
extension: Value,
) -> Extension
pub fn new_with_type_constraint<T: Into<ExtensionTypeId>, ET: Into<EntityTypeId>, S: Into<String>>( ty: T, entity_ty: ET, description: S, extension: Value, ) -> Extension
Constructs an extension from the given namespaced type with the given description, components, properties and extensions.
pub fn json_schema( &self, entity_type: &EntityType, ) -> Result<Schema, ExtensionJsonSchemaError>
Trait Implementations§
Source§impl AsRef<ExtensionTypeId> for Extension
impl AsRef<ExtensionTypeId> for Extension
Source§fn as_ref(&self) -> &ExtensionTypeId
fn as_ref(&self) -> &ExtensionTypeId
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl<'de> Deserialize<'de> for Extension
impl<'de> Deserialize<'de> for Extension
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&Extension> for TypeDefinition
impl From<&Extension> for TypeDefinition
Source§impl FromIterator<Extension> for Extensions
impl FromIterator<Extension> for Extensions
Source§impl JsonSchema for Extension
impl JsonSchema for Extension
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl NamespacedTypeGetter for Extension
impl NamespacedTypeGetter for Extension
Source§fn namespaced_type(&self) -> NamespacedType
fn namespaced_type(&self) -> NamespacedType
Returns the namespaced type.
Source§fn type_name(&self) -> NamespaceSegment
fn type_name(&self) -> NamespaceSegment
Returns the name of the type.
Source§fn fully_qualified_type_name(&self) -> String
fn fully_qualified_type_name(&self) -> String
Returns the fully qualified type name in pascal case. Read more
Source§impl Ord for Extension
impl Ord for Extension
Source§impl PartialEq<ExtensionTypeId> for Extension
impl PartialEq<ExtensionTypeId> for Extension
Source§impl PartialOrd for Extension
impl PartialOrd for Extension
Source§impl TypeDefinitionGetter for Extension
impl TypeDefinitionGetter for Extension
Source§fn type_definition(&self) -> TypeDefinition
fn type_definition(&self) -> TypeDefinition
Returns the type definition of the type.
Source§fn type_id_type() -> TypeIdType
fn type_id_type() -> TypeIdType
Returns the type id type.
Source§impl TypeDescriptionGetter for Extension
impl TypeDescriptionGetter for Extension
Source§fn description(&self) -> String
fn description(&self) -> String
Returns the description of the type.
impl Eq for Extension
impl StructuralPartialEq for Extension
Auto Trait Implementations§
impl Freeze for Extension
impl RefUnwindSafe for Extension
impl Send for Extension
impl Sync for Extension
impl Unpin for Extension
impl UnwindSafe for Extension
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> JsonSchemaIdGetter for Twhere
T: TypeDefinitionGetter,
impl<T> JsonSchemaIdGetter for Twhere
T: TypeDefinitionGetter,
Source§fn json_schema_id(&self) -> JsonSchemaId
fn json_schema_id(&self) -> JsonSchemaId
Returns the JSON Schema identifier ($id).