prism
prism copied to clipboard
Prism shaves off decimals for double
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
- send a double through Prism using Get endpoint expecting double to show e.g 1,0
- Response however shows only e.g 1, makes a double look like an Integer
- See screenshots
Environment
All environments
- Version used: Postman v9.31.0 - Postman App Windows 10
Bug when running Prism URL:
Correct behaviour Prism Turned Off
do you have an open api spec that you used?
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 ?
Hey team! Please add your planning poker estimate with Zenhub @brendarearden @daniel-white @EdVinyard @fcasad
Hey team! Please add your planning poker estimate with Zenhub @brendarearden @daniel-white @EdVinyard @fcasad
9000