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

JSON Schema enums should have at least 1 item #85

Open
ShahimEssaid opened this issue Aug 23, 2021 · 7 comments
Open

JSON Schema enums should have at least 1 item #85

ShahimEssaid opened this issue Aug 23, 2021 · 7 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ShahimEssaid
Copy link
Member

The stub enums in the schema file need at least one item for the schema to be valid. Maybe some temporary "Null" value?

@ShahimEssaid ShahimEssaid added the bug Something isn't working label Aug 23, 2021
@gaurav gaurav self-assigned this Aug 23, 2021
@gaurav
Copy link
Collaborator

gaurav commented Aug 23, 2021

What if I turn field back into a string value rather than an enumeration if no permitted values are provided? I could also emit a warning so we know to fix this on the Terminology Service (or the Google Sheet model, if that's where the enumeration is defined).

@ShahimEssaid
Copy link
Member Author

ShahimEssaid commented Aug 23, 2021 via email

@ShahimEssaid
Copy link
Member Author

Being able to $ref the enums is more valuable than their content, as long as the enum names are somewhat stable, or can be updated with a regex.

@cmungall
Copy link
Contributor

I am not sure I fully understand the context. Enums should only be used if you have an enumeration. If that enumeration is empty, then it's invalid.

We could potentially have a property on an enum that states whether it is open or closed, but open enums would have the same semantics as string so I am not really seeing the advantage

@cmungall
Copy link
Contributor

Another option would be to declare specific types and map these to strings

@sujaypatil96
Copy link
Contributor

@gaurav @ShahimEssaid: what do you think the right course of implementation would be based on @cmungall's suggestions above?

@gaurav
Copy link
Collaborator

gaurav commented Oct 14, 2021

I am not sure I fully understand the context. Enums should only be used if you have an enumeration. If that enumeration is empty, then it's invalid.

True! It would be convenient if permissible_values required at least one PV, but we can't do that, since you can also set the PVs via the code_set. So I don't think there's a neat solution for this problem at the LinkML level. However, it might be a good idea for LinkML to produce a warning if an enumeration is missing both code_set and permissible_values.

Primarily, though, I think we should fix this at the sheet2linkml level by -- as Shahim suggested -- we turn an enumeration without any permissible values into an enumeration with a single permissible value, "null".

Does everybody think that would be fine for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants