RFC: extend allow_nan parameter to all number fields
See original GitHub issueDecimal
field has an allow_nan
parameter (False
by default):
If
True
,NaN
,Infinity
and-Infinity
are allowed, even though they are illegal according to the JSON specification.
Any objection to extend it to all numbers?
Currently, Int
will reject those as they are not integers, but they pass Float
which just pawned me.
Should we add the same validation in Float
? Move it up to Number
?
Even if it is useless for Int
, I’d be tempted to extend it to Number
.
- Those are special values with a special meaning so a different error message makes sense.
- Any
Number
subclass would inherit it -> less duplication.
This is a breaking change as the default would be False
so Float
would need to be explicitly passed allow_none=True
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
RFC parameter field values are not reflecting in the ...
Hi, I have added three new fields in the existing table parameters of the RFC by extending the structure.The values are showing up...
Read more >RFC 7044 - An Extension to the Session Initiation Protocol ...
SIP header field parameters are defined for the History-Info and Contact header ... As per [RFC3261], any implementation not understanding an extension MUST ......
Read more >RFC 8941: Structured Field Values for HTTP
An extension to a Structured Field can then require that an entire field value be ignored by a recipient that understands the extension...
Read more >Session Initiation Protocol (SIP) Parameters
Some headers have single-letter compact forms (Section 7.3 of RFC ... field value in a Supported header field in all requests generated by ......
Read more >2528-type-changing-struct-update-syntax - The Rust RFC Book
Extend struct update syntax (a.k.a. functional record update (FRU)) to support instances ... All fields are visible at the location of the update...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And an
Int
withallow_nan=True
wouldn’t make sense.Definitely better to do that on a per-field basis.
Shall I shoot a PR for
Float
?Implementation proposed in #945.
Breaking because default is
False
and because the signature of the field’s__init__
changes.