-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
OpenAPI 3.1 and greater defines a Schema Object which is an extension of JSON Schema 2020-12 in https://github.com/OAI/OpenAPI-Specification/blob/7bf50655066feef4240575b80ab4fcc6b5e1b3b9/src/schemas/validation/schema.yaml#L726-L731
$defs:
schema:
$comment: https://spec.openapis.org/oas/v3.2#schema-object
$dynamicAnchor: meta
type:
- object
- boolean
This definition is dynamically referenced several times using its $dynamicAnchor
via $dynamicRef: '#meta'
and never statically referenced.
It is reported as "not covered" despite being evaluated when validating instances and collecting schema coverage.
Is this a bug of the schema coverage tool, or a feature?
And if it is a feature of the schema coverage tool, is it a "bug" in our use of JSON Schema?
Side note: that definition is reported as covered if I statically reference it at least once, for example as
components:
$comment: https://spec.openapis.org/oas/v3.2#components-object
type: object
properties:
schemas:
type: object
additionalProperties:
$dynamicRef: '#meta'
$ref: '#/$defs/schema' # just to satisfy schema coverage
This seems to work, with all "pass" test cases still passing, and all "fail" test cases still failing, but I'm no JSON Schema expert and can't judge whether referencing something both statically and dynamically is a problem, or whether "duplicating" the $dynamicAnchor
by statically pulling it in via $ref
has side effects or just works by accident here.