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

Update settings manangement, object orient endpoint and function import structure #20

Merged
merged 3 commits into from
Feb 23, 2024

Conversation

SerRichard
Copy link
Member

…int basic test - accept reformatting

should resolve the issues around the conformance endpoint you have noticed

@SerRichard SerRichard changed the title fix error in register conformance endpoint, and add conformance endpo… fixconformance endpoint, and update settings management Feb 21, 2024
@SerRichard
Copy link
Member Author

Also, I have merged the test api files together in this :)

@SerRichard
Copy link
Member Author

So, added an abc called EndpointRegister, the idea here is that each Register class will hold the relevant functions, and the Endpoint models attached, this can later be used to derive the "active" endpoints of the api, without the need for the user to define them when init'ing the OpenEOCore. The idea of the Register is to offer a similar modularization of the FastApi routers, but without having to actually use them in any way.

Additionally, I had to update the settings management because of the reason mentioned in teams, I.E, init'ing them in the module code means those are set when the module is imported, this is okay for an application, but not really for a package.

Also updated unit tests to make sure the endpoints called are actually behind the OPENEO_PREFIX value, as they all should be, besides get capabilities :)

Happy to call and discuss this structure if there are any questions, the only other thing I might add is a RootRegister, for those endpoints that sit on the root path of the api (if you find the Register structure aggreable).

@SerRichard SerRichard changed the title fixconformance endpoint, and update settings management Update settings manangement, object orient endpoint and function import structure Feb 22, 2024
Copy link
Collaborator

@geospatial-roman geospatial-roman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initialising the settings when the Client is initialised makes sense. In general this looks much tidier than before, thanks! Looks good to me

def _initialize_endpoints(self) -> list[Endpoint]:
return [
Endpoint(
path="/collections",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need /{self.client.settings.OPENEO_VERSION}/ in the path here as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good shout, but I don't think here we want to add it. This is just about setting what we advertise in /capabilities, and we don't actually want the version number to be present when displayed as an output there. Additionally, I initially thought the same when doing the openeo-api-python and the openeo-clients couldn't discover the endpoints xD

@SerRichard SerRichard merged commit 8a35e92 into main Feb 23, 2024
3 checks passed
@SerRichard SerRichard deleted the fix-conformance branch February 23, 2024 08:20
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.

2 participants