Skip to main content

FHIRSerdeDeserialize

Derive Macro FHIRSerdeDeserialize 

Source
#[derive(FHIRSerdeDeserialize)]
{
    // Attributes available to this derive:
    #[fhir_serialize_type]
    #[rename_field]
    #[type_choice_field_name]
    #[type_choice_variants]
    #[primitive]
    #[determine_by]
    #[cardinality]
    #[reference]
    #[fhir_resource_type]
}
Expand description

Derives Serde-based FHIR JSON deserialization implementations.

The macro behavior is selected using the fhir_serialize_type attribute.

Supported deserialization types:

  • primitive
  • valueset
  • typechoice
  • complex
  • resource

§Panics

Panics if:

  • The fhir_serialize_type attribute is missing.
  • The fhir_serialize_type attribute contains an unsupported value.
  • A deserialization type other than the supported Serde deserialization variants is specified.

§Attributes

This macro supports the following attributes:

  • fhir_serialize_type - Selects the deserialization implementation.
  • rename_field - Renames a deserialized field.
  • type_choice_field_name - Defines the field name used for type choice deserialization.
  • type_choice_variants - Defines variants for type choice fields.
  • primitive - Marks primitive FHIR fields.
  • determine_by - Specifies how enum variants are determined during deserialization.
  • cardinality - Defines validation cardinality constraints.
  • reference - Marks reference fields.
  • fhir_resource_type - Overrides the FHIR resource type name.