You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Numbers converted into scientific notation are not considered valid numbers #308
The property pvalue_threshold in https://nodenormalization-sri.renci.org/openapi.json fails validation because the default value (0.000001) is converted into scientific notation in Python (1e-06), which is judged to not be a valid number (Could not validate OpenAPI at https://nodenormalization-sri.renci.org/openapi.json: '1e-06' is not of type 'number'). Is there any way to work around this?
The core issue is a 6-year-old bug in PyYAML, and the fact that openapi-spec-validator is deferring its I/O to jsonschema-path, which relies on PyYAML.
The error reported above is this (from the CLI):
$ openapi-spec-validator example.json
example.json: Validation Error: '1e-06' is not of type 'number'
Failed validating 'type' in schema:
{'type': 'number',
'maximum': 1.0,
'minimum': 0.0,
'title': 'Pvalue Threshold',
'default': '1e-06'}
On instance:
'1e-06'
There are several possible ways that this could be addressed in the tool chain:
The bug gets fixed and released in PyYAML
jsonschema-path switches to another YAML parsing library, like ruamel.yaml
jsonschema-path speculatively tries parsing using a JSON library first, then falls back to YAML
openapi-spec-validator stops relying on jsonschema-path and instead loads files using JSON, then YAML if needed
To work around this without a change in the tool chain, users can load the schemas using requests:
Activity
choward18 commentedon Nov 27, 2023
I am seeing the same exact issue, it works with 1.0e+23 but not 1e+23 using version 0.2.9
kurtmckee commentedon Jun 26, 2025
The core issue is a 6-year-old bug in PyYAML, and the fact that openapi-spec-validator is deferring its I/O to jsonschema-path, which relies on PyYAML.
The error reported above is this (from the CLI):
There are several possible ways that this could be addressed in the tool chain:
To work around this without a change in the tool chain, users can load the schemas using requests:
(which reveals that the schema is invalid, actually, so fixing that file could also include adding decimal points to numbers in scientific notation).