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

describing ocrd-tool.json parameter object properties, rev'std #229

Open
bertsky opened this issue Oct 13, 2022 · 0 comments
Open

describing ocrd-tool.json parameter object properties, rev'std #229

bertsky opened this issue Oct 13, 2022 · 0 comments

Comments

@bertsky
Copy link
Collaborator

bertsky commented Oct 13, 2022

Since #206 we can moderately restrict an ocrd-tool parameter of type object's properties and even set additionalProperties:

spec/ocrd_tool.schema.yml

Lines 95 to 100 in 506b339

properties:
type: object
description: Describe the properties of an object value
additionalProperties:
type: boolean
description: Whether an object value may contain properties not explicitly defined

However, according to the JSON data schema, additionalProperties is either false or an object (i.e. dict) itself.

For example, in ocrd-kraken-recognize I'd like to have:

        "blla_classes": {
          "description": "Class mapping for the region types trained into blla_model.",
          "type": "object",
          "minProperties": 2,
          "additionalProperties": { "type": "string",
                                    "enum": ["TextRegion", "ImageRegion", "LineDrawingRegion",
                                             "GraphicRegion", "TableRegion", "ChartRegion",
                                             "MapRegion", "SeparatorRegion", "MathsRegion",
                                             "ChemRegion", "MusicRegion", "AdvertRegion",
                                             "NoiseRegion", "UnknownRegion", "CustomRegion"] },
          "default": {"text": "TextRegion", "image": "ImageRegion", "line drawing": "LineDrawingRegion",
                      "graphic": "GraphicRegion", "table": "TableRegion", "chart": "ChartRegion",
                      "map": "MapRegion", "separator": "SeparatorRegion", "maths": "MathsRegion",
                      "chem": "ChemRegion", "music": "MusicRegion", "advert": "AdvertRegion",
                      "noise": "NoiseRegion", "unknown": "UnknownRegion", "custom": "CustomRegion"}

That is: allow only certain types of properties (namely all PAGE-XML region type names).

This is currently not possible to express.

Also, minProperties and maxProperties is missing entirely.

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

No branches or pull requests

1 participant