Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix EDR
instancesdefaults returning rather than raising NotImplementedError (#2435)Overview
BaseEDRProvider.instances()andinstance()returnedNotImplementedError()instead of raising it. For any provider that doesn't implement instances (includingxarray-edr, and every other core EDR provider):GET /collections/{id}/instancesiterated an exception object → 500GET /collections/{id}/instances/{anything}accepted any idGET /collections/{id}/instances/{anything}/position?...served data, ignoring the instance (200 on master)And for a provider that does implement
instance(), returningFalsehit anUnboundLocalErroringet_collection_edr_instances.Changes:
'instances' in p.get_query_types()before calling either method: 404 on the instances routes, 400 (existingInvalid instance identifier) on an instance queryinstance()returningFalseis treated as not found, per its documentedboolcontract;ProviderItemNotFoundErroris still handledraise NotImplementedError()Related Issue / discussion
Part of #2435 (step 0 of the proposed sequence). This stands on its own and can be reviewed independently of the wider proposal.
Additional information
This differs from the approach sketched in #2435 (raising
ProviderItemNotFoundErrorfrom the base class): honouring the documented return type is the smaller change, and the API never reaches the base defaults once it checks registration.Tests: two added to
tests/api/test_environmental_data_retrieval.py, both failing on master (ed4da5a) and passing here:test_get_collection_edr_instances_unsupported— againsticoads-sst(xarray-edr, no instances support): 404 on both instances routes, 400 on an instance querytest_get_collection_edr_instances_contract— against a stub provider implementing the documented contract: listing, a valid id, and an invalid id returningFalse→ 404The remaining EDR, API and coverages tests pass unchanged.
tests/provider/test_sensorthings_edr_provider.pyneeds a live SensorThings server and fails identically with and without this change.Dependency policy (RFC2)
No new dependencies.
Updates to public demo
No configuration changes needed. The demo's only EDR collection is
icoads-sst(xarray-edr, which implements neitherinstancesnorinstance); no provider in core implements either method. Its behaviour changes from 500 / any-id-accepted / 200-ignoring-the-instance to 404 / 404 / 400 — exactly whattest_get_collection_edr_instances_unsupportedasserts against the same collection.Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)