Skip to content
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

ocrd-tool.json validator: too strict #848

Closed
bertsky opened this issue May 5, 2022 · 3 comments
Closed

ocrd-tool.json validator: too strict #848

bertsky opened this issue May 5, 2022 · 3 comments
Assignees

Comments

@bertsky
Copy link
Collaborator

bertsky commented May 5, 2022

In our ocrd-tool schema, for the parameters we only have

properties:
type:
type: string
description: Data type of this parameter
enum:
- string
- number
- boolean
- object
- array
format:
description: Subtype, such as `float` for type `number` or `uri` for type `string`.
description:
description: Concise description of syntax and semantics of this parameter
required:
type: boolean
description: Whether this parameter is required
default:
description: Default value when not provided by the user
enum:
type: array
description: List the allowed values if a fixed list.
content-type:
type: string
description: "If parameter is reference to file: Media type of the file"
cacheable:
type: boolean
description: "If parameter is reference to file: Whether the file should be cached, e.g. because it is large and won't change."
default: false

This excludes perfectly sound data JSON qualifiers like

  • items (for restrictions on the list items if type==array)
  • minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf (for numerical restrictions if type==number)
  • fileGrp names not conforming to ^OCR-D-[A-Z0-9-]+$ (which should be allowed by spec now)

The first two yield an error saying Additional properties are not allowed, the latter directly mocks the regex.

@bertsky
Copy link
Collaborator Author

bertsky commented May 5, 2022

Perhaps also:

  • properties and additionalProperties (for key-val restrictions on the entries if type==object)

@kba
Copy link
Member

kba commented Jul 19, 2022

Newest release allows all these additional JSON-Schema constructs.

@kba kba closed this as completed Jul 19, 2022
@bertsky
Copy link
Collaborator Author

bertsky commented May 25, 2023

Perhaps also:

  • properties and additionalProperties (for key-val restrictions on the entries if type==object)

Newest release allows all these additional JSON-Schema constructs.

Not all, it seems:

<report valid="false">
  <error>[tools.ocrd-kraken-segment.parameters.blla_classes] Additional properties are not allowed ('minProperties' was unexpected)</error>
  <error>[tools.ocrd-kraken-segment.parameters.blla_classes.additionalProperties] {'type': 'string', 'enum': ['TextRegion', 'ImageRegion', 'LineDrawingRegion', 'GraphicRegion', 'TableRegion', 'ChartRegion', 'MapRegion', 'SeparatorRegion', 'MathsRegion', 'ChemRegion', 'MusicRegion', 'AdvertRegion', 'NoiseRegion', 'UnknownRegion', 'CustomRegion']} is not of type 'boolean'</error>
</report>

Can we get this to work, or should I create another issue, @kba?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants