Skip to content

Responses Object keys must be strings? #3068

@mabar

Description

@mabar

Responses Object spec says that: This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML (https://github.com/OAI/OpenAPI-Specification/blob/157a4c81ae537ef793b2bee368bc00d88b461de8/versions/3.0.2.md#patterned-fields-1)

Is it really needed?

Json only allows strings as keys and at least in PHP numeric keys are auto-encoded to strings.

Yaml allows both, but in PHP numeric keys are always type-casted to an int, like 200, instead of "200"

Because it is probably not possible to create workaround for this in PHP, we could solve it only by adding a flag to yaml encoder to make integer keys strings (in case array is not auto-indexed from 0)

But the preferred way would be to remove string key requirement from specification.

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