prism icon indicating copy to clipboard operation
prism copied to clipboard

Prism shaves off decimals for double

Open cvik77 opened this issue 2 years ago • 4 comments

Prism shaves off decimals for double, this makes the response look like an Integer instead of a double 1,0 int the database becomes 1 through prism. Expect the body to be immutable, however this does not seem to be the case.

Possible Workaround/Solution

Turn off Prism. Run endpoints not using prism url.

Steps to Reproduce

  1. send a double through Prism using Get endpoint expecting double to show e.g 1,0
  2. Response however shows only e.g 1, makes a double look like an Integer
  3. See screenshots

Environment

All environments

  • Version used: Postman v9.31.0 - Postman App Windows 10

Bug when running Prism URL: image

Correct behaviour Prism Turned Off image

cvik77 avatar Oct 25 '22 06:10 cvik77

do you have an open api spec that you used?

daniel-white avatar Oct 25 '22 13:10 daniel-white

Hi @daniel-white

The following the schema definition used for this endpoint

    MaterialNeed:
      type: object
      properties:
        materialId:
          type: string
          description: The material number there is a need for
          example: '741466'
        material:
          type: string
        quantity:
          type: number
          format: double
          minimum: 0
          example: 1.00
        quantityUnit:
          type: string
          description: The unit for the quanity such (as `PC` = Pieces and `L`= Liter)
          example: 'PC'
      additionalProperties: false
      required: 
        - materialId
        - material
        - quantity
        - quantityUnit

The format of the number is indeed double in the spec. In practice in the API implementation, the actual number depends on the quantityUnit and may be int or double. See now, that we may have been able to use oneOf: to model this.

From our side, we would expect Prism when used as a validating proxy to treat the response as immutable and not modify it in anyway. Is this a correct assumption to make ?

elsewhat avatar Oct 25 '22 15:10 elsewhat

Hey team! Please add your planning poker estimate with Zenhub @brendarearden @daniel-white @EdVinyard @fcasad

chohmann avatar Oct 28 '22 16:10 chohmann

Hey team! Please add your planning poker estimate with Zenhub @brendarearden @daniel-white @EdVinyard @fcasad

9000

pytlesk4 avatar Oct 28 '22 17:10 pytlesk4