-
Notifications
You must be signed in to change notification settings - Fork 45
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
Omero metadata optional #297
base: main
Are you sure you want to change the base?
Conversation
Automated Review URLs |
-1 on optional fields in metadata, this is a headache for validation. can't we use a fixed set of fields, and allow the optional ones to take the value |
Elsewhere we have optional fields, such as So is this already making validation hard? Looking at
Would this be different (simpler) if the spec said "Multiscale MUST be set but can be null"? |
Yes, those are exactly the fields that caused headaches on the validation side. Python objects like to have a static set of properties, so to model metadata with dynamic properties with a python object means you have to "fill in" the missing fields with |
Yes, and IMO the simplest thing would be to use a table like this for every single field in the spec. It would remove a lot of ambiguity.
|
Is it important to distinguish between setting a value to None and not setting it? The spec doesn't distinguish between these anywhere for optional properties (unless I've missed some)? For the As discussed elsewhere, if Making |
From a python POV, a class where an attribute can be class Foo:
required_field: int
name: str | None but directly modelling a class where an attribute might not exist is harder: you need two classes: class Foo:
required_field: int
...
class FooWithName(Foo):
name: str This latter thing is cumbersome. So at least in python, it's easier to represent an optional value as I'm a little confused by the discussion about the |
This is what default values in a class / function definition are for. @dataclass
class Foo:
required_field: int
name: str | None = None
Foo(required_field=2)
Foo.name == None
# True |
NB: This shouldn't be merged into 0.5, and should wait until #276 is resolved.
Fixes #192.
The
omero
metadata is useful for storing channels names (labels), colors and rendering settings, but currently ALL fields are required which means it is hard to use if any of these values are unknown.This PR proposes that all the omero.channels values are optional.
It also adds more details for "label", "active" and "inverted" as well as notes on the "window" values.
cc @giovp @dstansby