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 parsing #20

Closed
pocman opened this issue Jul 25, 2016 · 4 comments
Closed

Number parsing #20

pocman opened this issue Jul 25, 2016 · 4 comments
Assignees
Labels

Comments

@pocman
Copy link
Contributor

pocman commented Jul 25, 2016

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

@slavaschmidt
Copy link
Collaborator

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

@slavaschmidt slavaschmidt self-assigned this Jul 26, 2016
@pocman
Copy link
Contributor Author

pocman commented Jul 26, 2016

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

@slavaschmidt
Copy link
Collaborator

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.

@slavaschmidt
Copy link
Collaborator

@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

slavaschmidt added a commit that referenced this issue Nov 6, 2016
* Revert "Revert "#27, fix: WIP""

This reverts commit d8ca947.

* 19, refactor: Native json parsers, WIP

* #19, refactor: Working readables generator

* #19, refactor: Working readables in action

* #19, refactor: Working content negotiation

* #19, fix: Wrong structure in the case of absent validation

* WIP: Generated Readables and Writables

* WIP: missing anyval reads

* WIP: Feature-complete JSON reads/writes

* WIP: Tests for JSON

* Working scriped tests

* Working scriped tests

* Refactored DI in the controller

* #19, Test: Added unit test for failing parsing format

* Fixed broken date-time parser for headers and path

* #20, Test: Added test to check parsing of arrays of doulbe

* #29, Test: relaxed generated test in ragard to expected empty responses

* Test: Fixed broken test expectations

* Test: fix for travis script

* #23, fix: Missed imports in allOf

* FIX: allOf validations

* FIX: allOf validations

* FIX: Bug in type flattener leading to the situation where some essential classes got lost

* FIX: Error in enum parameter binding

* FIX: missing imports in test data generator

* FIX: missing imports in test data generator

* "#19_Parser_refactoring, FIX:"

" - #38: Wrong names of Enum members"
" - #38: Wrong type of Enum based results"

* Bumping version to 2.0 because introduced changes can potentially break existig clients

* #39, Bug: Disabling failing test until the next version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants