-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lots: Error when maximumLotsBidPerSupplier is set to infinity (1e9999) #128
Comments
Update: Same issue in plain Ruby at least: require 'bigdecimal'
Integer === Float::INFINITY
# false
Float === Float::INFINITY
# true
Integer === BigDecimal('Infinity')
# false
Float === BigDecimal('Infinity')
# false
BigDecimal === BigDecimal('Infinity')
# true |
I'll look into option 2. |
Sounds good |
I added a "maximumLotsBidPerSupplier": {
"title": "Maximum lots per supplier",
"description": "The maximum number of lots that one supplier can bid on as part of this contracting process.",
"oneOf": [
{
"type": [
"integer",
"null"
]
},
{
"type": [
"number"
],
"enum": [
1e9999
]
}
]
}, Invalid data results in an error message that isn't particularly helpful. Users would need to look at the schema to understand how to resolve the error: I think we'll need to update the custom oneOf validator in lib-cove-ocds to handle this specific case or to report the underlying errors for any use of oneOf. Alternatively, in the CoVE instance for the Risk Data Library, we implemented a field-specific custom error message for that schema's use of Data Review Tool results for different values: I also tried using |
@jpmckinney is this worth doing or do you want to incorporate it into open-contracting/cove-ocds#223? |
We can incorporate it into that work. |
The OCDS for EU profile maps
maximumLotsBidPerSupplier
to1e9999
if there is no limit to the number of lots for which a bid can be submitted.This mapping was preferred to a new boolean field, because it reused an existing field, while preserving the logical behavior of the field (e.g. comparing this value to the number of lots to which a given bid relates). It was also preferred to setting the field to a large 32-bit integer; while, in reality, no request for tender would have that many lots, and no bid would be related to that many lots,
2,147,483,647
looks like an error, whereas1e9999
looks deliberate (it's also a common and consistent way to overflow floating-point parsing into infinity).However, the jsonschema library will error. It considers infinity to be a number, but not an integer:
The same is true in Python:
We can:
type
of the field to allow numbers, though numbers only make sense for infinity (e.g. you can't bid on 0.3 of a lot).oneOf
rule, in which one branch is specific for infinity. In that case, we'll need to check that the Data Review Tool (and possibly others) can handle it.I prefer the third option, if this problem is specific to Python. If Java, etc. validators have the same issue, then we should opt for another option.
The text was updated successfully, but these errors were encountered: