You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enums are Key Value paired or Mapped names.
for example in the old implementation of you schema the index of array (Key) is mapper to Enum name (Value). the only problem is that this numerical mapping is sequential (you can not enumerate like 0-> "default" , 5 -> "on", -5 -> "of") and string -> string mapping is impossible!
just change array to object. no extra key is needed also parsing and readability is better!
for example:
{
"enum": {
"Left eye": 1,
"Right eye": 2,
}
}
#57 solution is const!
There is a problem with Const solution. when you use oneOf keyword, it will map to SelectList or Radio button, but what about the time you want to use a checklist?
In recent example, there is 2 other choice: None and Both!
in such simple one, it's not a problem to add these 2 choices to enum but what will happen if we have more options?
multi select is the only executable solution and it is not covered by oneOf
The text was updated successfully, but these errors were encountered:
@Yeganloo since your question is about UI rendering, you should take a look at the UI Schema vocabulary project. The kick-off issue is here, in the repo for new vocabularies: json-schema-org/json-schema-vocabularies#2 and we welcome new issues on specific topics. This repository is just for the basic validation/hypermedia specifications.
Enums are Key Value paired or Mapped names.
for example in the old implementation of you schema the index of array (Key) is mapper to Enum name (Value). the only problem is that this numerical mapping is sequential (you can not enumerate like 0-> "default" , 5 -> "on", -5 -> "of") and string -> string mapping is impossible!
just change array to object. no extra key is needed also parsing and readability is better!
for example:
{
"enum": {
"Left eye": 1,
"Right eye": 2,
}
}
#57 solution is const!
There is a problem with Const solution. when you use oneOf keyword, it will map to SelectList or Radio button, but what about the time you want to use a checklist?
In recent example, there is 2 other choice: None and Both!
in such simple one, it's not a problem to add these 2 choices to enum but what will happen if we have more options?
multi select is the only executable solution and it is not covered by oneOf
The text was updated successfully, but these errors were encountered: