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

link.py to_dict is not properly serializing RelType enum values #652

Closed
paulfouquet opened this issue Nov 7, 2021 · 0 comments · Fixed by #654
Closed

link.py to_dict is not properly serializing RelType enum values #652

paulfouquet opened this issue Nov 7, 2021 · 0 comments · Fixed by #654

Comments

@paulfouquet
Copy link

paulfouquet commented Nov 7, 2021

The to_dict function in link.py is not serializing rel properly in case of using a RelType enum.
(rel is an Union[str, RelType])

d: Dict[str, Any] = {"rel": self.rel, "href": self.get_href()}

In my example, by default the rel is pystac.RelType.ROOT and when I call the to_dict function on a Collection object, the link included in the dictionary returned is the following:
'links': [{'rel': <RelType.ROOT: 'root'>, 'href': '/home/paul/code/linz/topo-processor/collection.json', 'type': <MediaType.JSON: 'application/json'>}]
I would expect that to_dict return the str enum value "root" in my case.

Note that causes an Unsupported type: 'RelType' error when calling a jsonschema-rs validator with this dict.

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 a pull request may close this issue.

1 participant