-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Forward compatibility (HATEOAS) - Discover all endpoints dynamically from api
response
#5
Comments
Merged
devraj
added a commit
that referenced
this issue
Nov 24, 2023
gallagher command centre makes available a set of hrefs that should be dynamically references as opposed to statically referencing api endpoints this is the start of the change to do so. as part of this it's recommended to - drop the root api endpoint query to be a privat endpoint - the utils package to be renamed as core - move the discovery contant outside of the APIEndpoint class REFS #5
Further to this, the All features should use this discovery result to configure itself dynamically. |
devraj
added a commit
that referenced
this issue
Nov 25, 2023
devraj
added a commit
that referenced
this issue
Nov 26, 2023
this is my first refactor towards getting dynamic discovery working there are still issues with accessing the singlton to share the discovered version around along side caching the discovery results REFS #5
devraj
changed the title
Discover
Discover all endpoints dynamically from Nov 26, 2023
items
endpoints dynamically from api
responseapi
response
devraj
added a commit
that referenced
this issue
Dec 3, 2023
this a commit in a separate branch for me to experinment implementing dynamic discovery of the api endpoints, at the moment because of import cycles the singleton seems to be overrwritten REFS #5
devraj
added a commit
that referenced
this issue
Dec 3, 2023
we have the discovery object being initialised when the base class initialises and then the discovery fetches the url, note that the href that the discover will return are fully qualified addresses this drops using the api_base prefix post this we need to formalies the configuration and syntax so this scales to all endpoints we are also yet to test for unlicensed features REFS #5
devraj
added a commit
that referenced
this issue
Dec 3, 2023
adds context around the design of the classes and lifecycle for dynamic discovery of api endpoints REFS #5
devraj
changed the title
Discover all endpoints dynamically from
Forward compatibility (HATEOAS) - Discover all endpoints dynamically from Dec 3, 2023
api
responseapi
response
devraj
added a commit
that referenced
this issue
Dec 5, 2023
i wasn't quite happy with the idea that the singleton was part of the base class that all the endpoints inherited from, this is now moved into a class called Capabilties which has a class level variable called CURRENT to represent the current capabilities of the server we are connected to, this reads a lot better than before REFS #5 we should also explore if it's possible to move back to using the __config__ constants being assigned by the endpoint classes as opposed to the method returning the configuration there may be lifecycle issues here
devraj
added a commit
that referenced
this issue
Dec 6, 2023
the discover endpoints drop the .href portion of the configuration this is infered by the common runtime code, making it uncessary for each endpoint to explicitly reference the href propeorty this also leads us to handing #8 properly as the core runtime can check for None type of the href property an OptionalHref type replaces the use of the Mixin for the discover endpoints additionally these are initialised to None and are overridden if the feature is avaialble on the command centre also see commentary in APIEndpoint._discover as to why we are sticking to initialising the configuration as the result of a function not an assignment to a class level variable REFS #5
devraj
added a commit
that referenced
this issue
Dec 27, 2023
the original design intended to cache the Discovery response to conform hateoas #5 overriding the pydantic method model_post_init to set the good_known_since var introduced an error where the test first test would run the subsequent calls would fail https://docs.pydantic.dev/2.0/api/main/\#pydantic.main.BaseModel.model_post_init debugging this i found that the discover was running every time as the good_known_since would never have been set and the cache check would fail. initially thought of this as a bug with how parsing was working but turns out that if the cache was detected then we were returning without initialising the configuration against the discovery response.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
According to the documentation we should not reference
/api/items
and some other endpoints statically, this should instead be discovered from thefeatures.items.items.href
attribute of the/api
response.This ticket is to refactor the current implementation to add discovery.
As the Gallagher documentation states this is for HATEOAS compatibility:
The text was updated successfully, but these errors were encountered: