Open DanielJoyce opened 2 years ago
I understand rust is strict, and so this could be ambiguous:
"code": { "description": "The HTTP error code.", "type": "integer", "format": "uint16", "maximum": 599.0, "minimum": 400.0 },
Type is integer, but maximum and minimum are parsed as floats
Progenitor then fails with this message:
thread 'main' panicked at 'not clear what we could usefully do here Schema { schema_data: SchemaData { nullable: false, read_only: false, write_only: false, deprecated: false, external_docs: None, example: None, title: None, description: Some( "The HTTP error code.", ), discriminator: None, default: None, extensions: {}, }, schema_kind: Any( AnySchema { typ: Some( "integer", ), pattern: None, multiple_of: None, exclusive_minimum: None, exclusive_maximum: None, minimum: Some( 400.0, ), maximum: Some( 599.0, ), properties: {}, required: [], additional_properties: None, min_properties: None, max_properties: None, items: None, min_items: None, max_items: None, unique_items: None, enumeration: [], format: Some( "uint16", ), min_length: None, max_length: None, one_of: [], all_of: [], any_of: [], not: None, }, ), }',
Removing the trailing .0 fixes the problem.
The above schema was generated by the rocket-okapi crate
Perhaps instead in the case where the value is exactly representable as a int type, it is accepted, or we print a warning?
It doesn't look like progenitor enforces any bounds checking in the generated client
I understand rust is strict, and so this could be ambiguous:
Type is integer, but maximum and minimum are parsed as floats
Progenitor then fails with this message:
Removing the trailing .0 fixes the problem.
The above schema was generated by the rocket-okapi crate
Perhaps instead in the case where the value is exactly representable as a int type, it is accepted, or we print a warning?