koumoul-dev / vuetify-jsonschema-form

Create beautiful and low-effort forms that output valid data. Published on npm as @koumoul/vjsf.
https://koumoul-dev.github.io/vuetify-jsonschema-form/latest/
MIT License
548 stars 155 forks source link

impact of schema change from const to enum #212

Closed satra closed 3 years ago

satra commented 3 years ago

in pydantic a library we are using to generate the json schema, the representation of a const changed to its more general form enum. this seems to have broken our use of this component.

here is an example of the change: https://github.com/dandi/schema/commit/7d24722deabe76c4686f8d6a751ceb2097aac13e#diff-2b869e87eb0354c3014f22d290a55905349288b3b0c5500c783e93c39dd87f7fL421

and here is the json schema reference for this:

https://json-schema.org/understanding-json-schema/reference/generic.html#constant-values

any thoughts on whether this is an easy fix, or cannot be supported would be much appreciated.

albanm commented 3 years ago

I think this could be supported. Probably by transforming the single item enum into a const expression in the schema pre-processing done here.