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
propertiesandadditionalPropertiesunder 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
propertiesare properties in Apex with the same name and property data type. -
OpenAPI
additionalPropertiesare grouped as the Apex property with name properties and type Map<String, Type>, where Type is the declaredadditionalPropertiestype. The Map property type is a collection of key-value pairs. -
OpenAPI
additionalPropertiesare 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 withadditionalProperties. -
OpenAPI
propertiesandadditionalPropertiescan both be declared under an OpenAPI parameter schema or schema in the definitions section. The OpenAPI parser ignores eitherpropertiesoradditionalPropertiesif declared as an object property type. An object property type must only define namedpropertiesoradditionalProperties, 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, oradditionalProperties: {}are interpreted as untyped. UntypedadditionalPropertiesare ignored. There isn't a workaround to defineadditionalPropertiesthat 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" } } } }