Structure Data Using properties and additionalProperties
In an Open API specification, the properties keyword defines one or more properties on
an object including the property name and data type. The additionalProperties keyword gives you
the flexibility to add additional properties with an undefined schema. The named properties are
accessible as Apex properties with a matching data type. The additionalProperties in the spec
are accessible in Apex as a Map property.
Required Editions
Available in: Lightning Experience
Available in: Enterprise, Performance,
Unlimited, and Developer Editions
The properties and additionalProperties under an
OpenAPI schema directive show as formal object properties and as a dictionary property.
If declared under a property or additionalProperties type, then the OpenAPI parser
ignores one or the other. The registration process doesn't throw an error.
OpenAPI named properties are properties in Apex with the same name and
property data type.
OpenAPI additionalProperties are grouped as the Apex property with
name properties and type Map<String, Type>, where Type is the
declared additionalProperties type. The Map property type is a
collection of key-value pairs.
OpenAPI additionalProperties are always declared as an Apex object map
property, even if it could be declared as a standalone Apex Map type. The result is
consistently handled named object properties defined together with
additionalProperties.
OpenAPI properties and additionalProperties can both
be declared under an OpenAPI parameter schema or schema in the definitions section. The
OpenAPI parser ignores either properties or
additionalProperties if declared as an object property type. An
object property type must only define named properties or
additionalProperties, but not both. To work around, place the object
property definition as a named schema under definitions and reference it by name.
The OpenAPI parser doesn't differentiate between literal declarations or untyped
schemas. Declarations like additionalProperties: true,
additionalProperties: false, or additionalProperties:
{} are interpreted as untyped. Untyped additionalProperties
are ignored. There isn't a workaround to define additionalProperties
that can be of any type.
Flow doesn't allow access or manipulation of Apex object types with Map properties, but
transparently preserves the content when assigned to variables of the same Apex object
type. To manipulate map data structure in flow, call an Apex invocable action that can
access the map data structure. For an example with External Service maps in action, see
Example 9 in External Services OpenAPI 2.0 Schema.
In any external service registration you create in system version 7 and later, you
can define a property with a name that begins with a number. When that property is
accessed in Flow or Apex code, the encoding process adjusts the name of the
property.
{
"UserAvatarUrls": {
"type": "object",
"properties": {
"24x24": {
"type": "string",
"description": "The URL of the user's 24x24 pixel avatar.",
"format": "uri"
},
"32x32": {
"type": "string",
"description": "The URL of the user's 32x32 pixel avatar.",
"format": "uri"
},
"16x16": {
"type": "string",
"description": "The URL of the user's 16x16 pixel avatar.",
"format": "uri"
},
"48x48": {
"type": "string",
"description": "The URL of the user's 48x48 pixel avatar.",
"format": "uri"
}
}
}
}
We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required Cookies
Always Active
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional Cookies
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising Cookies
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.