1. Types
2. vapi
3. metadata
4. metamodel

## vapi metadata metamodel: type

The `type` structure describes the type information of a typed element in the interface definiton language. The following elements in the metamodel are typed:

- Field element in a structure element. See vapi.metadata.metamodel.structure_info.fields
- Parameter element in an operation element. See vapi.metadata.metamodel.operation_info.params
- Result element in an operation element. See vapi.metadata.metamodel.operation_info.output

The type could be one of the three following categories:

- Built-in types: These are types present in the interface definition language type system. They are provided by the infrastructure.
- User defined named type: API designers can create custom types and use them for the typed elements. These types have a unique identifier.
- Generic type instantiation: The language infrastructure also provides generic types such as list, map, set and so on. An instantiation of one of these generic types could also be used for the typed elements.

### Representations:

- JSON
- XML

{
"builtin_type": "VOID",
"category": "BUILTIN",
"generic_instantiation": {
"element_type": {
"builtin_type": "VOID",
"category": "BUILTIN",
"generic_instantiation": {
"element_type": {
"builtin_type": "VOID",
"category": "BUILTIN",
"user_defined_type": {
"resource_id": "obj-103",
"resource_type": "string"
}
},
"generic_type": "LIST"
},
"user_defined_type": {
"resource_id": "obj-103",
"resource_type": "string"
}
},
"generic_type": "LIST",
"map_key_type": {
"builtin_type": "VOID",
"category": "BUILTIN",
"user_defined_type": {
"resource_id": "obj-103",
"resource_type": "string"
}
},
"map_value_type": {
"builtin_type": "VOID",
"category": "BUILTIN",
"user_defined_type": {
"resource_id": "obj-103",
"resource_type": "string"
}
}
},
"user_defined_type": {
"resource_id": "obj-103",
"resource_type": "string"
}
}
<?xml version="1.0" ?>
<ns0:Type xmlns:ns0="http://vmware.com/vapi/metadata/metamodel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<user_defined_type>
<resource_id>obj-103</resource_id>
<resource_type>string</resource_type>
</user_defined_type>
<category>BUILTIN</category>
<generic_instantiation>
<map_key_type>
<user_defined_type>
<resource_id>obj-103</resource_id>
<resource_type>string</resource_type>
</user_defined_type>
<category>BUILTIN</category>
<builtin_type>VOID</builtin_type>
</map_key_type>
<map_value_type>
<user_defined_type>
<resource_id>obj-103</resource_id>
<resource_type>string</resource_type>
</user_defined_type>
<category>BUILTIN</category>
<builtin_type>VOID</builtin_type>
</map_value_type>
<generic_type>LIST</generic_type>
<element_type>
<user_defined_type>
<resource_id>obj-103</resource_id>
<resource_type>string</resource_type>
</user_defined_type>
<category>BUILTIN</category>
<generic_instantiation>
<generic_type>LIST</generic_type>
<element_type>
<user_defined_type>
<resource_id>obj-103</resource_id>
<resource_type>string</resource_type>
</user_defined_type>
<category>BUILTIN</category>
<builtin_type>VOID</builtin_type>
</element_type>
</generic_instantiation>
<builtin_type>VOID</builtin_type>
</element_type>
</generic_instantiation>
<builtin_type>VOID</builtin_type>
</ns0:Type>

#### Attributes:

Name | Type | Description
--- | --- | ---
Required
category | string | Category of this type. Provides enumeration value for each category of the type. Value is one of: BUILTIN: The type is one of the built-in types specified in vapi.metadata.metamodel.type.builtin_type USER_DEFINED: The type is one of the user defined named types. GENERIC: The type is an instantiation of one of the generic types.
Optional
builtin_type | string | Category of the built-in type. Provides enumeration value for each of the built-in types present in the interface definition language type system. Value is one of: VOID: The built-in type is a void. The value is unset. BOOLEAN: The built-in type is a boolean. The value is true or false. LONG: The built-in type is a long. The value is a 64 bit signed integer. DOUBLE: The built-in type is a double. The value is a 64 bit floating point number. STRING: The built-in type is a string. The value is a variable-length sequence of zero or more unicode characters. BINARY: The built-in type is a binary. The value is a variable-length sequence of zero or more bytes. SECRET: The built-in type is a secret. The value is a variable-length sequence of zero or more unicode characters. The value contains sensitive data that should not be printed or displayed anywhere. DATE_TIME: The built-in type is a datetime. The value should be in the UTC timezone and the precision is milliseconds. ID: The built-in type is an ID. The value represents an identifier for a resource. URI: The built-in type is an URI. The value follows the IRI specification in RFC 3987. ANY_ERROR: The built-in type is an arbitrary error type. This is used if the value of a typed element can be one of any user defined named type which is an error. DYNAMIC_STRUCTURE: The built-in type is a dynamic structure. This is used if the value of a typed element can be one of any user defined named type. OPAQUE: The built-in type is an opaque. This is used if the value of a typed element could be of any type and the actual type will be known only during the execution of the API. This is mostly used in infrastructure services.Optional. It is only relevant when category has value BUILTIN. This field is optional and it is only relevant when the value of `category` is BUILTIN.
user_defined_type | user_defined_type | Identifier and type of the user defined type. Optional. It is only relevant when category has value USER_DEFINED. This field is optional and it is only relevant when the value of `category` is USER_DEFINED.
generic_instantiation | generic_instantiation | Instantiation of one of the generic types available in the interface definition language. Optional. It is only relevant when category has value GENERIC. This field is optional and it is only relevant when the value of `category` is GENERIC.