Skip to content

Add support for JSONSchema constants #1254

@johnmorrell

Description

@johnmorrell

Is your feature request related to a problem? Please describe.
Where a JSONSchema contains a constant value this does not get reflected in the output model. If this was a required property the output JSON would never validate against the Schema.

Describe the solution you'd like
Using JSONSchema constant:

{
   "type":"object",
   "properties":{
      "version":{
         "const":"1.0"
      }
   },
   "required":[
      "version"
   ]
}

Constants to be added to the model, via either a hidden or readonly form element.

Describe alternatives you've considered
Currently forcing constants by using an required Enum with a single and default value:

{
   "type":"object",
   "properties":{
      "version":{
         "type":"string",
         "enum":[
            "1.0"
         ],
         "default":"1.0"
      }
   },
   "required":[
      "version"
   ]
}

Describe for which setup you like to have the improvement
Framework: React
RendererSet: Material

Additional context
JSONForms: v2.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions