Skip to content

Choice elements incorrectly require all alternatives instead of one #613

@david-waltermire

Description

@david-waltermire

Description

When deserializing OSCAL YAML/JSON content, metaschema-java incorrectly requires properties from both alternatives of a choice element, rather than accepting one or the other.

Example

In OSCAL's control-selection assembly, there is a choice between:

  • include-all (empty element)
  • include-controls (array of control references)

Similarly, control-objective-selection has a choice between:

  • include-all
  • include-objectives

When providing valid YAML with include-controls:

reviewed-controls:
  control-selections:
    - include-controls:
        - control-id: ac-8

metaschema-java throws:

Missing required property 'include-all' in 'control-selection'

The same occurs for control-objective-selection when using include-objectives.

Expected Behavior

A choice element should accept one of its alternatives, not require all of them. The presence of include-controls should satisfy the choice without requiring include-all.

Environment

Workaround

Currently, using include-all: {} instead of include-controls or include-objectives works, but this changes the semantics (selects all vs. specific items).

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem rightwontfixThis will not be worked on

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions