Skip to content

Drop the idea of automatically combining annotations #906

Closed
@handrews

Description

@handrews

We have this idea that some annotations get combined (e.g. if multiple readOnly keywords apply to the same location, the overall annotation is true if any of them are true).

However, our output recommendations don't support that. They just return all of the information needed to implement it (all of the annotation values, where they come from, and to where they are applied).

Since annotations are intended to be processed by the application anyway, we can get the necessary effect for keywords like readOnly by directing applications on how they process the results. For readOnly and writeOnly, our language actually supports that anyway:

The value of these keywords MUST be a boolean. When multiple occurrences of these keywords are applicable to a single sub-instance, the resulting behavior SHOULD be as for a true value if any occurrence specifies a true value, and SHOULD be as for a false value otherwise.

Note that this doesn't say anything about implementations combining things, just about the resulting behavior.


This would involve some changes to the Core spec:

In section 7.7.1 Collecting Annotations, we would change:

If the same keyword attaches values from multiple schema locations to the same instance location, and the annotation defines a process for combining such values, then the combined value MUST also be associated with the instance location. The output formats described in this specification that include annotation information meet this requirement.

to something like:

When the same annotation keyword attaches values from multiple schema locations to the same instance location, the keyword MAY specify how applications SHOULD or MUST interpret the different values.

In section 7.5 Applicators, we would drop:

Annotation results are combined according to the rules specified by each annotation keyword.

There are probably other spots, but this gets the idea across. The whole "combine annotations" thing was never really thought through all the way in the context of output formats and other things that were added after the initial idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions