express-openapi-validator icon indicating copy to clipboard operation
express-openapi-validator copied to clipboard

Unknown format "decimal" is used in schema

Open MostafaAbdlrazek opened this issue 7 years ago • 4 comments

Whenever I try to validate a request against an openapi.yaml file that contains a type: number with format: decimal I receive the following error:

{
    "errors": [
        {
            "message": "unknown format \"decimal\" is used in schema at path \"#/properties/amount\""
        }
    ]
}

MostafaAbdlrazek avatar Sep 25 '19 13:09 MostafaAbdlrazek

This may be related to #48

decimal isn't in the list of formats defined by the OAS so I guess that's why the OpenAPI validator is erroring. (I think this is a legit bug 'cos it shouldn't.)

However, to support documentation needs, the format property is an open string-valued property, and can have any value. Formats such as "email", "uuid", and so on, MAY be used even though undefined by this specification.

richdouglasevans avatar Sep 25 '19 13:09 richdouglasevans

Thanks @richdouglasevans. Will look into providing a sane default. @MostafaAbdlrazek if possible you can work around this by using one of the defined number types / formats

cdimascio avatar Sep 27 '19 02:09 cdimascio

unknown formats are supported in v2.4.0.

cdimascio avatar Oct 08 '19 16:10 cdimascio

I think this issue can be closed.

gonenduk avatar Oct 26 '19 07:10 gonenduk