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

UnknownSchema objects should allow dictionary-like access to data fields #1234

Open
reinecke opened this issue Mar 8, 2022 · 2 comments · May be fixed by #1799
Open

UnknownSchema objects should allow dictionary-like access to data fields #1234

reinecke opened this issue Mar 8, 2022 · 2 comments · May be fixed by #1799
Labels
enhancement A request for something new. good first issue If you're looking for a way to contribute, but not sure where to start. This is a good first issue.

Comments

@reinecke
Copy link
Collaborator

reinecke commented Mar 8, 2022

Feature Request

To allow developers to access data on objects of UnknownSchema, a dictionary-type interface should be exposed for the data fields.

Context

When the deserializer doesn't recognize the schema of an object, it deserializes to an instance of UnknownSchema. Unfortunately, the UnknownSchema object only exposes original_schema_name and original_schema_version - this means the majority data in the object is opaque and inaccessible.

See #1230 for more discussion on this.

@reinecke reinecke added the enhancement A request for something new. label Mar 8, 2022
@reinecke reinecke changed the title UnknownSchema objects should allow access to data fields as a dictionary UnknownSchema objects should allow dictionary-like access to data fields Mar 8, 2022
@jminor
Copy link
Collaborator

jminor commented Oct 29, 2023

I hit this again today, where I'm working with OTIO metadata which contains custom schema objects, but my code is running in a context where the proper schema plugin is not available.

I've found this kind of gross workaround for now:

if isinstance(my_metadata, otio._otio.UnknownSchema):
    my_metadata = json.loads(my_metadata.to_json_string())

It would be really nice if UnknownSchema had a .to_dict() method and/or allowed dictionary-like access via .get(key) etc.

@reinecke reinecke added the good first issue If you're looking for a way to contribute, but not sure where to start. This is a good first issue. label Sep 20, 2024
@natchar
Copy link

natchar commented Sep 25, 2024

I can take a look into this for Dev Days.
Cheers!

@natchar natchar linked a pull request Sep 27, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A request for something new. good first issue If you're looking for a way to contribute, but not sure where to start. This is a good first issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants