Builder Pattern For Return Data in V2.py #426
Closed
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.
Hello,
Today my PR consists of my implementation of a Creational Design Pattern known as the "Builder Pattern".
What Are The Changes?
Currently, for the endpoints located in 'v2.py' the way large aggregate json data is returned is as such
This is slightly messy and inconsistent when it comes to adding aggregate data over the long run.
As such, I have decided to make the following changes in lieu of the Builder Pattern.
This allows for a more clean, concise and readable format where any novice developer in this repository can quickly gauge what is going on.
Potential Concerns
Now, one might think there is a limitation because the dictionary is pre-constructed to follow the builder pattern. I have avoided this by allowing a generic method to take in any key and value to be added to the dictionary which also follows the builder pattern.
This method is
As you can see any key and data can be passed and added to the dictionary while also following the builder approach.
This can also be seen concretely in the endpoint "/locations" where a generic 'locations' data is added.
As such I strongly believe accepting this PR would benefit this repo not only today but in the long run.
Regards,
Mike