ebowman/api-first-hand

Number parsing

pocman opened this issue · 4 comments

I have this issue :
parsing default 0 value into a type: number, format: double.
<p id="detail" class="pre">[ClassCastException: java.lang.Integer cannot be cast to java.lang.Double]</p>

parsing default 3.3 value into a type: number, format: float.
<p id="detail" class="pre">[ClassCastException: java.lang.Double cannot be cast to java.lang.Float]</p>

With

  geometry:
      type: object
      properties:
        coordinates:
          type: array
          items:
            type: number
            format: double
            example: [4.49965, 52.06891]

parsing in a post body :

      "coordinates": [
        [
          4.49965,
          52.06891
        ]
      ]

Returns
play.api.http.HttpErrorHandlerExceptions$$anon$1: Execution exception[[ClassCastException: scala.collection.immutable.$colon$colon cannot be cast to java.lang.Double]]

capture d ecran 2016-07-25 a 15 51 29

@pocman Thank you very much for the issue! This is a problem with jackson which we use as a parsing backend and we want to redesign this part for a long part already. This is quite involving change so please give us some time for that.

The two first parsing issues are not blocking.
I don't think that the last one is directly related to jackson.

Unfortunately it is, here the issue is that jackson creates lists and maps instead of correct object structures. I can't even reproduce the last problem, it fails earlier on my machine with similar (but different) error message.

@pocman Seems like the issue is that the array should not be nested or should be defined in the specification as nested, like it is done the nested_arrays.yaml