Redoc: How can I define how many digitis is allowed behind the comma?

Created on 8 Oct 2019  路  7Comments  路  Source: Redocly/redoc

How can I specify how many digitis is allowed for decimal part by using OAS 3.0/Redoc?

decimal(10,2) or NUMBER(10,2) means total length is 10 digits but out of 10 digits 2 digits are for decimal part. So the final allowed number will be 8 digits for integral part and 2 digits for fractional part.

Most helpful comment

I don't have a good idea of how to display this.

The current working idea is as below:

  • show decimals <= x digits for multipleOf with 0.1, 0.01, 0.001 etc..
  • show multiple of x for other cases

What do you think?

All 7 comments

type: number
multipleOf: 0.01

If I use mutipleOf it is not visible in the Redoc Document.

required:
    - name
properties:
    name:
        type: string
    tag:
        multipleOf: 0.01
        minimum: 0
        type: number

image

Well, this is already a ReDoc "issue".

EDIT
It's pretty easy to add to ReDoc, somewhere in this function.

The question is what should it display ( '* 0.01' for example ? ).

That is a good question. Something like decimals<= 2 digits.
or * 0.01

well, decimal 2 digits won't work, as you could also give multipleOf: 0.02 for example or even multipleOf: 2. Ie. this has other use cases also.

  • 0.01 or even multipleOf 0.01 could be an option.

@RomanHotsiy what is your opinion on this, i can implement it ?

I don't have a good idea of how to display this.

The current working idea is as below:

  • show decimals <= x digits for multipleOf with 0.1, 0.01, 0.001 etc..
  • show multiple of x for other cases

What do you think?

This is not a bad solution, splitting the cases.

I鈥檒l implement something this weekend and we can take it from there.

Was this page helpful?
0 / 5 - 0 ratings