struct_type() | array_type() | map_type() | custom_type()Struct, array, map, and custom types
Compose container types and target-language or schema-defined contracts from registered type objects.
When to use
Use these factories for domain payloads, collections, maps, Protobuf/OpenAPI messages, and custom native definitions.
Behavior
array_typestores one value_type reference.map_typestores key_type and value_type references.struct_typesupports inline target definitions/imports and a definition format.custom_typerepresents custom target-language definitions without a container contract.
project.array_type() properties
Repeated values.
namestrHuman-readable name. A stable camelCase key is derived and registered on the Project.
Requireddescriptionstr | NoneDocumentation emitted with the generated type.
Default:Nonepublic_typebool | NoneMake the type reusable through a project Module.
Default:NonemoduleModule | LOCAL_MODULE | NoneOwner of a public type. Use an object, not a module-name string.
Default:NonepackagePackage | NoneTyped package metadata object.
Default:Nonevalue_typeTypeDefinition | DataTypeElement contract.
Requiredproject.map_type() properties
Key/value collection.
namestrHuman-readable name. A stable camelCase key is derived and registered on the Project.
Requireddescriptionstr | NoneDocumentation emitted with the generated type.
Default:Nonepublic_typebool | NoneMake the type reusable through a project Module.
Default:NonemoduleModule | LOCAL_MODULE | NoneOwner of a public type. Use an object, not a module-name string.
Default:NonepackagePackage | NoneTyped package metadata object.
Default:Nonekey_typeTypeDefinition | DataTypeMap key contract.
Requiredvalue_typeTypeDefinition | DataTypeMap value contract.
Requiredproject.struct_type() properties
Structured/message contract.
namestrHuman-readable name. A stable camelCase key is derived and registered on the Project.
Requireddescriptionstr | NoneDocumentation emitted with the generated type.
Default:Nonepublic_typebool | NoneMake the type reusable through a project Module.
Default:NonemoduleModule | LOCAL_MODULE | NoneOwner of a public type. Use an object, not a module-name string.
Default:NonepackagePackage | NoneTyped package metadata object.
Default:Nonetransfer_by_valuebool | NoneTarget-language value-transfer hint.
Default:Nonedefinition_formatTypeDefinitionFormat | NoneNative, Protobuf, FlatBuffers, CapNProto, or OpenAPI.
Default:Nonetype_definitionstr | NoneInline target/schema definition.
Default:Nonetype_importstr | NoneInline import metadata.
Default:Noneproject.custom_type() properties
Custom target definitions.
namestrHuman-readable name. A stable camelCase key is derived and registered on the Project.
Requireddescriptionstr | NoneDocumentation emitted with the generated type.
Default:Nonepublic_typebool | NoneMake the type reusable through a project Module.
Default:NonemoduleModule | LOCAL_MODULE | NoneOwner of a public type. Use an object, not a module-name string.
Default:NonepackagePackage | NoneTyped package metadata object.
Default:Nonetype_definitionstr | NoneInline target-language definition.
Default:Nonetype_importstr | NoneInline target-language import.
Default:Nonedefinition_formatTypeDefinitionFormat | NoneDefinition interpretation.
Default:NonePython example
order_list = project.array_type("Orders", value_type=order)
order_by_id = project.map_type(
"Order By ID",
key_type=DataType.STRING,
value_type=order,
)
api_order = project.struct_type(
"API Order",
definition_format=TypeDefinitionFormat.OPENAPI,
type_definition=openapi_schema,
)