Skip to content

OAS 3.1: Suggest rephrasing data-types section for format keyword and primitive types. #2301

@sebastien-rosset

Description

@sebastien-rosset

The OAS 3.1 data types section states:

Primitives have an optional modifier property: format, which is defined by JSON Schema.

Implied in that sentence is that the format keyword does not apply to non-primitive types. However, In the JSON schema specification section 7, it is stated the format keyword applies to all model instance types:

All format attributes defined in this section apply to strings, but a format attribute can be specified to apply to any instance types defined in the data model defined in the core JSON Schema.

Based on the above the format keyword can apply to null, boolean, object, array, number and string.

One of the goal of OAS 3.1 is to remove some of the constraints that existed in 3.0.3 and support full JSON schema specification. Therefore, shouldn't https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#data-types be rephrased to to avoid conveying the format keyword applies to primitive types? Even if in practice most people use the format keyword for primitive types, the spec doesn't have such restriction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions