Adding documentation override system #551
Merged
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.
This PR adds a documentation override system that allows us to modify the generated service docs for API clients by version.
Each client has a static
applyDocFilters
method which accepts an array of service and docs data and returns an array of service and doc data. This function can then change the data it is passed to add in parameters or modify documentation.In order to easily achieve this, I've refactored the Service class to accept the data as an argument instead of having to invoke the provided api provider to get the service data. This not only simplified the code and mocking service's, it made filtering docs in this way possible.
In order to generate docs, I needed a way to map the endpointPrefix to the service namespace. I did this by calculating the namespace when generating the api manifest. I moved the list of versions into a "versions" key and added a top level "namespace" key. This allows us to get the namespace of a client and call the corresponding
applyDocFilters
method. Because it's no longer just a version manifest, I renamed the file to "manifest.json".