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

Escaped double-quote \" is not shown as escaped in example #822

Closed
exoego opened this issue Feb 26, 2019 · 3 comments
Closed

Escaped double-quote \" is not shown as escaped in example #822

exoego opened this issue Feb 26, 2019 · 3 comments

Comments

@exoego
Copy link
Contributor

exoego commented Feb 26, 2019

My schema has a string field which stores JSON template like

body:
    type: string
    example: "{\"message\": \"test\"}"

or

body:
    type: string
    example: '{"message": "test"}'

But both of them are shown like

image

where double-quote " is shown directly, therefore the response exmple looks like broken.

I think doubel-quote are escaped and shown like \".

@exoego
Copy link
Contributor Author

exoego commented Feb 26, 2019

Closing as self-resolved.

We should write example with escaping like this.

example: '{\\"message\\": \\"test\\"}'

image

@exoego exoego closed this as completed Feb 26, 2019
@exoego exoego reopened this Feb 26, 2019
@exoego
Copy link
Contributor Author

exoego commented Feb 26, 2019

I think this is issue. Escape should be with single \, not \\

    example: "{\"message\": \"test\"}"

@exoego exoego changed the title Double-quote is not escaped in example Escaped double-quote \" is not shown as escaped in example Feb 26, 2019
@exoego
Copy link
Contributor Author

exoego commented Feb 26, 2019

Sorry many times.

` example: "{\"message\": \"test\"}"`

ReDoc can handle the above.

image

@exoego exoego closed this as completed Feb 26, 2019
unarist added a commit to unarist/ReDoc that referenced this issue Feb 26, 2019
Follow up for Redocly#822 and 0473165 (only escape quotes).
RomanHotsiy pushed a commit that referenced this issue Feb 26, 2019
Follow up for #822 and 0473165 (only escape quotes).
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