Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP status code MUST be enclosed in quotation marks #50

Open
kianmeng opened this issue Apr 30, 2024 · 0 comments
Open

HTTP status code MUST be enclosed in quotation marks #50

kianmeng opened this issue Apr 30, 2024 · 0 comments

Comments

@kianmeng
Copy link

Description

The response HTTP status code, as shown below in line 62, in the openapi.yml file should be quoted:

    61       responses:
    62         200:
    63           description: List of all collections
    64           content: 
    65             application/json:
    66               schema:
    67                 type: array
    68                 x-go-type: "[]*CollectionResponse"
    69                 items:
    70                   $ref: "#/components/schemas/CollectionResponse"

In some OpenAPI generators, some generators treat numbers in keys as integers instead of strings by default, which led to error.

As per OpenAPI spec (emphasis added), https://spec.openapis.org/oas/v3.0.3#patterned-fields-0:

Any HTTP status code can be used as the property name, but only one property per code, to describe the expected response for that HTTP status code. A Reference Object can link to a response that is defined in the OpenAPI Object’s components/responses section. This field MUST be enclosed in quotation marks (for example, “200”) for compatibility between JSON and YAML. To define a range of response codes, this field MAY contain the uppercase wildcard character X. For example, 2XX represents all response codes between [200-299]. Only the following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX. If a response is defined using an explicit code, the explicit code definition takes precedence over the range definition for that code.

Steps to reproduce

Expected Behavior

    61       responses:
+   62         '200':

Actual Behavior

Metadata

Typesense Version:

OS:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant