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

Number-Strings are displayed as number not as strings #2380

Closed
marcuszierke opened this issue Jan 19, 2021 · 4 comments
Closed

Number-Strings are displayed as number not as strings #2380

marcuszierke opened this issue Jan 19, 2021 · 4 comments

Comments

@marcuszierke
Copy link

I noticed today that numbers, that I want to have returned as strings, are not been displayed correctly colorwise in the editor. If I define the values via enums it works fine but as soon as I specify an example on my own it is displayed in the editor as a number value (I guess that's what the red color stands for).

I attached some screenshots to illustrate the problem (for compliance reasons I couldn't extend the viewport of the screenshot, sorry for that).

Screenshot 2021-01-19 at 14 05 06
Screenshot 2021-01-19 at 14 05 16
Screenshot 2021-01-19 at 14 05 22
Screenshot 2021-01-19 at 14 05 31

Q&A (please complete the following information)

  • OS: MacOS Catalina
  • Browser: chrome, firefox, safari
  • Version: latest for all
  • Method of installation: webbrowser
  • Swagger/OpenAPI version: Swagger 2.0
@hkosova
Copy link
Contributor

hkosova commented Jan 25, 2021

Numeric strings must be quoted in order to be treated as strings. E.g.

score:
  type: string
  example: "8.84"   # <-----

or

type: object
example: {
  "value": "Austria",
  "score": "8.84"   # <-----
}

@byrdman
Copy link

byrdman commented Jan 27, 2021

I've noticed the same thing. If you start your "number" with a 0 (or any other non-numeric value) it will render correctly as a string.

example: "001"

correctly renders as
image

But:
example: "101"

renders as:
image

If I change my markup to:
example: "\"101\""

it renders properly as:
image

@hkosova
Copy link
Contributor

hkosova commented Feb 8, 2021

@marcuszierke @byrdman can you please check if the issue is still happening? A similar issue was fixed in a recent release of Swagger Editor/UI.

@byrdman
Copy link

byrdman commented Feb 8, 2021

@marcuszierke @byrdman can you please check if the issue is still happening? A similar issue was fixed in a recent release of Swagger Editor/UI.

It appears to be fixed! Thanks.

@hkosova hkosova closed this as completed Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants