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

Incorrectly serialized parameter examples when using hyphens #969

Closed
lgellrich opened this issue Jul 9, 2019 · 3 comments
Closed

Incorrectly serialized parameter examples when using hyphens #969

lgellrich opened this issue Jul 9, 2019 · 3 comments

Comments

@lgellrich
Copy link

After upgrading ReDoc from 2.0.0-rc.8 I noticed that examples for parameters in my OpenAPI Specification got rendered incorrectly in case that parameter names contain a hyphen.

ReDoc React
Using ReDoc as React component the example values display as ?parameter-name}

redoc-cli
Serving the same specification via redoc-cli the examples are rendered as if processed by JSON.stringify(). As mentioned in #504

With the current React behavior the examples become useless, while the redoc-cli behavior enables the workaround of specifying the example as a string myself.

Affected ReDoc versions: 2.0.0-rc.9, 2.0.0-rc.10
Tested redoc-cli versions: 0.8.4, 0.8.5

References

Render from redoc-cli 0.8.5
redoc-cli_0 8 5_sample

Render via ReDoc Live Demo:
redoc-live_sample

OpenAPI sample:

---
openapi: 3.0.0
info:
  title: "API"
  version: "1.0.0"
paths:
  /demo/{myId}/{my-id}:
    get:
      summary: Demo ReDoc Example Values
      parameters:
        - name: myId
          in: path
          schema:
            type: number
          example: 1
        - name: my-id
          in: path
          schema:
            type: number
          example: 1
        - name: my-parameter-with-hyphen
          in: query
          schema:
            type: string
          example: sampleValue
        - name: myParameterWithHyphen
          in: query
          schema:
            type: string
          example: sampleValue
        - name: my-array-parameter
          in: query
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
          example:
            - a
            - b
            - c
        - name: myArrayParameter
          in: query
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
          example:
            - a
            - b
            - c
@cyril1929
Copy link

cyril1929 commented Jul 18, 2019

I have the same problem with redoc-cli 0.8.5.
Examples are not correct, when the parameter name contains one '-' character.
This bug is really annoying.
The problem is not present with redoc-cli 0.8.4 and previous.

@RomanHotsiy
Copy link
Member

fixed by f7dd658

@RomanHotsiy
Copy link
Member

will be released in the new version today

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

3 participants