-
-
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
Major DTO implementation #15
Merged
Merged
Conversation
This file contains 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
modifies the test endpoint so if you pass a file name it just runs that test suite, if you don't then it will run all tests in the tests/ folder
gallagher command centre can have features not available per instance of the command centre, this makes all the features optional hence if one is not licensed then an exception is thrown by the client REFS #8
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
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
the project is now registered on pypi, initially published through my personal development computer, we want to eventually move this to be part of our ci/cd pipeline and publish the package through a github action REFS #16
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
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
adds context around the design of the classes and lifecycle for dynamic discovery of api endpoints REFS #5
the base model has a field called good_known_since, the intention is to set a timestamp once a response has been parsed, so the application can use this to identify if the response is stale and if it requires revalidation pyndatic provides a post_init hook, this introduces use of this hook in the BaseModel https://docs.pydantic.dev/2.0/api/main/\#pydantic.main.BaseModel.model_post_init
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.
by default we raise an exception on the get_config method in the base class this ensures that only classes that implement (i.e real classes) the get_config method execute
test anything protocol is a highly parseable output format https://testanything.org/philosophy.html this adds the plugin to pytest to produce tap output
inline with completing the parsing portion of the library we need to address the pdf data which is dynamically discovered from the command centre, REFS #1 we have started a discussion around this on the pydantic repo pydantic/pydantic#8596 and must implement the most pydantic version of the solution
doing some ground work towards #1 where we need pdf fields to be auto discovered for the dynamically parseable feature to work properly this commit parse the basic list call for PdfDefinitions, detail and other preloading functions to be added post this commit
Turning this PR into "ready for submission", this has been going for a while so I wan to merge these changes into the Some of those will be done on the |
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.
Majority of the DTO have been implemented in this pull request, along side addressing:
api
response #5hisel
) to boost performance #14pyndatic2
#10asyncio
before the library gets too large #18