swagger-ui does not show number data type

823 views
Skip to first unread message

Stefan Schröder

unread,
Mar 31, 2015, 6:05:24 AM3/31/15
to swagger-sw...@googlegroups.com
I specify my api with the swagger-editor, download it as json and put it as static content on my webserver. Everything works well. However, when I want to display the generated api.json with swagger-ui (the latest from the master branch), it happens that it cannot render data of type "number" and format "double" in the model schema. It just omit these data types. Every other types are rendered correctly. Once I change the type to "integer" it works perfectly.

Has anybody of you an explanation for this or even a solution? Thanks a lot.


Ron Ratovsky

unread,
Mar 31, 2015, 6:08:04 AM3/31/15
to swagger-sw...@googlegroups.com
Hi Stefan,

Can you share your Swagger definition or (full) sample that reproduces it?

On Tue, Mar 31, 2015 at 1:05 PM, Stefan Schröder <jsprit.vehi...@gmail.com> wrote:
I specify my api with the swagger-editor, download it as json and put it as static content on my webserver. Everything works well. However, when I want to display the generated api.json with swagger-ui (the latest from the master branch), it happens that it cannot render data of type "number" and format "double" in the model schema. It just omit these data types. Every other types are rendered correctly. Once I change the type to "integer" it works perfectly.

Has anybody of you an explanation for this or even a solution? Thanks a lot.


--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

Stefan Schröder

unread,
Mar 31, 2015, 8:47:08 AM3/31/15
to swagger-sw...@googlegroups.com
Hi Ron, thanks a lot for your fast response.

Here is the schema in json/yml as well as two screenshot of how swagger-ui rendered the model. In the model schema lon and lat properties are omitted. However, when looking at the model they are displayed correctly.
swagger.yaml
swagger.json
ui-model.png
ui-modelschema.png

Ron Ratovsky

unread,
Mar 31, 2015, 10:10:16 AM3/31/15
to swagger-sw...@googlegroups.com
Well, that's definitely interesting. Just tested it and can easily reproduce it. Can you please open an issue on swagger-js (note, swagger-js and not swagger-ui) with the details as you provided here? The Swagger definitions certainly help.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ebru Kaya

unread,
Apr 3, 2015, 11:43:22 AM4/3/15
to swagger-sw...@googlegroups.com
Hi Ron ,
I had the same issue and after a day of debugging, found a solution by adding the following statements to schemaToJSON method in swagger-ui.js

else if (type === 'number') {
      output = 0.0;
    }

31 Mart 2015 Salı 17:10:16 UTC+3 tarihinde Ron yazdı:
Well, that's definitely interesting. Just tested it and can easily reproduce it. Can you please open an issue on swagger-js (note, swagger-js and not swagger-ui) with the details as you provided here? The Swagger definitions certainly help.
On Tue, Mar 31, 2015 at 3:47 PM, Stefan Schröder <jsprit.vehi...@gmail.com> wrote:
Hi Ron, thanks a lot for your fast response.

Here is the schema in json/yml as well as two screenshot of how swagger-ui rendered the model. In the model schema lon and lat properties are omitted. However, when looking at the model they are displayed correctly.



On Tuesday, March 31, 2015 at 12:05:24 PM UTC+2, Stefan Schröder wrote:
I specify my api with the swagger-editor, download it as json and put it as static content on my webserver. Everything works well. However, when I want to display the generated api.json with swagger-ui (the latest from the master branch), it happens that it cannot render data of type "number" and format "double" in the model schema. It just omit these data types. Every other types are rendered correctly. Once I change the type to "integer" it works perfectly.

Has anybody of you an explanation for this or even a solution? Thanks a lot.


--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Pedro Rodriguez

unread,
Apr 7, 2015, 9:44:31 PM4/7/15
to swagger-sw...@googlegroups.com
Hi All,

I just ran into this bug as well. has this been turned into an issue/on its way to getting fixed? I will give a try to Ebru's fix, but it would be nice to know there is something official coming.

Pedro Rodriguez

Ron Ratovsky

unread,
Apr 8, 2015, 12:22:32 AM4/8/15
to swagger-sw...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages