Attribute Sets

An attribute set is a container that contains values for one or more attributes.

Attribute sets can be included in or references by different entity types (such as sheet layouts or products) to change the default behavior of operations that consume the given entity type.

The list of supported attributes is not defined in the specifications provided here. Instead the supported attributes are defined by the services which accept them. These services are also expected to provide static metadata (description, type, ranges…) describing the attributes they understand and editors for such attributes are expected to get the offered attributes at runtime for the addressed services.

An attribute set is defined as:

{
    "attributes": {
        "<uuid string>": {
            "description": <string>,
            "value": <any>
        },
    }
}

For example:

{
    "attributes": {
        "4a8bd010-8c8e-4ca9-9f48-899fbc3a658a": {
            "description": "CurveProcessingAlignment",
            "value": "left"
        },
        "f2218dd3-a4f7-40ed-a3d4-93947cd3766c": {
            "description": "AllowUsingMicrojoints",
            "value": false
        }
    }
}

The only relevant key for looking up an attribute value is the UUID. The description MUST NOT be used as input for any logic that depends on the specific value. The only purpose of the description is for developers or service purposes when an attribute set has to be analyzed directly by a person.

Attributed Targets

Usually, attributes are attached to resources by a list of attributed targets. An attributed target relates an attribute set to a path within the resource, where the attribute set should be applied to. The path to an item within the resource is given as an array of path elements, such as

[ "shape", "regions", 1, "outerContour" ]

If an element with child elements is addressed by the path, the corresponding attribute set is applied to that element and all its child elements, recursively.

Multiple targets can be addressed using the targets property.

For example:

{
    "attributeSet": {
        "attributes": {
            "4a8bd010-8c8e-4ca9-9f48-899fbc3a658a": {
                "description": "CurveProcessingAlignment",
                "value": "left"
            }
        }
    },
    "targets": [
        [ "shape", "regions", 1, "outerContour" ],
        [ "shape", "regions", 2, "innerContours", 0 ]
    ]
}

If a list of attributed targets contains multiple times the same attribute (ID), the first attribute in the list counts.