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
The OCDS for EU profile maps maximumLotsBidPerSupplier to 1e9999 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, whereas 1e9999 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:
importjsonfromjsonschema.validatorsimportDraft4ValidatorDraft4Validator({"type":"number"}).validate(json.loads('1e9999'))
# []Draft4Validator({"type":"integer"}).validate(json.loads('1e9999'))
# ValidationError: '1e9999' is not of type 'integer'
Weaken the 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).
Use a more complex 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.
Patch the jsonschema library (in the Data Review Tool and elsewhere) to treat infinity as a valid value for an integer field.
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:
"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 also tried using anyOf instead of oneOf, which resulted in the same error message, as expected. The enum could be replaced with maximum and minimum, but that won't make any difference either.
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: