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

enum values in schema.json vs schema.ui.json #4041

Open
stefan-korn opened this issue Oct 23, 2023 · 1 comment · May be fixed by #4042
Open

enum values in schema.json vs schema.ui.json #4041

stefan-korn opened this issue Oct 23, 2023 · 1 comment · May be fixed by #4042
Assignees

Comments

@stefan-korn
Copy link
Contributor

User Story

You can have enum values for a schema property in {schema}.json as well as in {schema}.ui.json.

If you use enum values in {schema}.json with property type "string" a select field containing the enum values will be generated.

If you use enum values in {schema}.ui.json (within ui:options -> source) these options will be used for generating a select field if you choose the widget to be "list" in {schema}.ui.json as well.

This is a bit confusing imho and you might need to move the enum values from {schema}.json to {schema}.ui.json or vice versa if you choose another handling for the given property.

For example you configured a string property with enum values in the {schema}.json to generate a select list. Then you decide to rather have a "select or other" select list. You would then need to move (or duplicate) the enum values from {schema}.json to {schema}.ui.json which feels complicated and error prone.

My proposal would be to use the enum values from {schema}.json if there are no enum values defined in {schema}.ui.json. This would allow to have all the enum values in {schema}.json, but still be able to use the enum configuration via {schema}.ui.json if someone prefers/needs this (and be compatible with current default {schema}.ui.json definitions).

Btw: I am not exactly sure why the enum configuration via {schema}.ui.json was chosen in the first place. Maybe this isn't even necessary if the enum values from {schema}.json will be used.

Acceptance Criteria

stefan-korn added a commit to stefan-korn/dkan that referenced this issue Oct 23, 2023
@stefan-korn stefan-korn linked a pull request Oct 23, 2023 that will close this issue
3 tasks
stefan-korn added a commit to stefan-korn/dkan that referenced this issue Dec 11, 2023
@dafeder dafeder self-assigned this Apr 5, 2024
@dafeder
Copy link
Member

dafeder commented Jul 25, 2024

See #4042 (comment)

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

Successfully merging a pull request may close this issue.

2 participants