Thanks to visit codestin.com
Credit goes to github.com

Skip to content

support custom models #147

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

Merged
merged 63 commits into from
Jul 24, 2021
Merged

support custom models #147

merged 63 commits into from
Jul 24, 2021

Conversation

geospatial-jeff
Copy link
Collaborator

@geospatial-jeff geospatial-jeff commented Jun 13, 2021

closes #58

See #147 (comment) for more info.

lossyrob added 23 commits July 23, 2021 19:51
As a novice attrs user I was confused about the factory= parameter,
which is just syntatic sugar for a default with an attr.Factory. The
default=attr.Factory is used in other similar scenarios, and this
aligns with the other examples for readability
Include eo etension in collection as the summary entries reference it
Otherwise this throws a JSON serialization error
This is done by the tile extension to perform a redirect
This logic was previosly just in the transaction extension, but is
required across all deserializations
TypedDicts require that either all attributes are considered required,
or None. Because STAC has optional attributes that we don't want users
to put "None" into (and therefore make the serialized responses have
"null" values in fields, which produces invalid STAC), it's better to
allow all fields to be optional. This allows users to utilize the type
information in the TypedDict when constructing STAC objects, but
not be told by type hinting to supply optional fields they don't
have. This produces some type errors around direct dict access to
fields of the potential for the dict key to not be present.
This commit adds pystac as a development dependency, and adds tests
around collection and item fetching to validate the output of the API routes
Required changing the Item to make it valid for EO, which included
removing existing invalid bands objects from properties and setting on
the assets. Did this via grabbing example JSON from a Planetary Computer
landsat-8-c2-l2 Item
@lossyrob
Copy link
Member

Ended up keeping TypedDict, but using total=False; this makes all of the attributes optional, which gives the benefit of a simple way to check what STAC properties are expected, but without enforcing any potentially incorrect requirements.

@geospatial-jeff
Copy link
Collaborator Author

@lossyrob your commits look great! I can't approve the PR since I opened it but this is ready to merge. Once it's merged I'm going to do a follow up PR to add documentation for some of the new features we've introduced.

@lossyrob lossyrob merged commit 5060501 into master Jul 24, 2021
@geospatial-jeff geospatial-jeff mentioned this pull request Aug 16, 2021
4 tasks
@moradology moradology deleted the custom-models branch September 23, 2021 17:44
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.

support custom data models
5 participants