Generator scripts for converting OpenAPI specs to models #157
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.
As I have denoted before in some issues/PRs, is that API is updated from time-to-time, and it's a bit of a hassle to manually check the reference documentation and figure it out if an endpoint was updated.
I've asked Bunny.net support and they denoted they had OpenAPI specs available (all this time I didn't know it was publicly available). In order to keep track of any changes made to the specifications, I've also created an additional repository ToshY/bunnynet-openapi-specification. This will check daily on any changes in the specs, create a new release when needed, and deploys the (beautified) OpenAPI specs to GitHub Pages, which can be found through the manifest file: https://toshy.github.io/bunnynet-openapi-specification/manifest.json.
With the above ready, I've started with creating the generator in order to try and automatically update/add models based on the OpenAPI specs. So I've several AI tools to "try" and make my life easier, and by doing this I realised that generated code becomes very hard to follow/understand when the requirements became more complex. In an attempt to refactor a majority of the (generated) code, I've kept the
ModelBodyMethodGenerator
mostly intact (as generated AI code) with some very minor tweeks, because in it's current state it works like intended: it generates the models body methods that are with the same structure as existing models (which is desired).TLDR