Does Swagger support BigDecimal

15,080 views
Skip to first unread message

Anuj Kathuria

unread,
May 28, 2015, 12:58:00 PM5/28/15
to swagger-sw...@googlegroups.com
Most of our Java POJOs are BigDecimal, and we are now using YAML to model the same.

However, the spec ( and codegen) does not directly specify BigDecimal


How do we force BigDecimal generation ( Do we need to change the templates or any mapping?)


Ron Ratovsky

unread,
May 28, 2015, 1:02:37 PM5/28/15
to swagger-sw...@googlegroups.com
BigDecimal is a Java thing. In a Swagger specification it would simply translate to type 'number'.

--
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
-----------------------------------------

Anuj Kathuria

unread,
Jun 3, 2015, 1:29:44 AM6/3/15
to swagger-sw...@googlegroups.com
Awesome, this works.

Just by using the swagger type as "number" and not specifying the format, worked and generated a BigDecimal.

Maybe, the codegen documentation can be updated to reflect this.

Thanks


  pet:
    required:
      - id
      - name
    properties:
      id:
        type: number
      name:
        type: string
      tag:
        type: string

On Thursday, May 28, 2015 at 10:02:37 AM UTC-7, Ron wrote:
BigDecimal is a Java thing. In a Swagger specification it would simply translate to type 'number'.
On Thu, May 28, 2015 at 12:58 PM, Anuj Kathuria <reac...@gmail.com> wrote:
Most of our Java POJOs are BigDecimal, and we are now using YAML to model the same.

However, the spec ( and codegen) does not directly specify BigDecimal


How do we force BigDecimal generation ( Do we need to change the templates or any mapping?)


--
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.

Ron Ratovsky

unread,
Jun 3, 2015, 8:37:59 AM6/3/15
to swagger-sw...@googlegroups.com
I'd like to clarify the terminology here - 'number' is not a Swagger type, it's a JSON type which we use as part of the Swagger specification.
Since JSON 'number' means pretty much any number, it ends up being translated to BigDecimal.

I'm not entirely sure where or how you'd expect it to be documented, but if you give more details we can look into it.

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
-----------------------------------------

--
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