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

Remove Any range in maximum_number_dimensions #186

Conversation

sneakers-the-rat
Copy link
Contributor

Noticed that ArrayExpression.maximum_number_dimensions had the wrong type: https://github.com/linkml/linkml-runtime/blob/c6943e41b67c9eb24f056c6ebaea2c78a0bdf4af/linkml_runtime/linkml_model/meta.py#L2730

maximum_number_dimensions: Optional[Union[dict, Anything]] = None

should be

maximum_number_dimensions: Optional[Union[int, bool]] = None

looks like a range: Anything was left in, I'm not sure if that resolves the range generation, but it also seems like something that should be validated in the metamodel schema: range shouldn't be specified by itself and in an any_of expression

@cmungall
Copy link
Member

I think this needs to be left in for safety just now, to avoid non-monotonicity. The best fix here is in gen-python which isn't yet on a par with gen-pydantic for generating unions

@sneakers-the-rat
Copy link
Contributor Author

Not sure what you mean here, is it valid syntax to have

range: integer
any_of: 
  - range: Anything

I would have figured that the syntax would be

any_of:
  - range: integer
  - range: Anything

in any case i'm not sure why dict is showing up there. I could take a look the dataclass generator, so if that's the correct syntax, then i could rename this issue to something like "dataclass generator incorrectly handling range and any_of: range"

@cmungall
Copy link
Member

Should be fixed in pythongen: linkml/linkml#1813

@rly
Copy link
Contributor

rly commented Mar 15, 2024

Resolved in @linkml/ndarray-wg discussion:
range: Anything is overly general on purpose but the any_of ranges will restrict the range of maximum_number_dimensions. range: Anything is useful for monotonicity.

The python dataclass generator should be fixed.

@rly rly closed this Mar 15, 2024
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 this pull request may close these issues.

3 participants