1957: Support for extensions within swagger:route #2751
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.
Summary
Adding basic functionality to support the definition of vendor extensions on a per-path basis as requested in issue #1957. This would be defined by a developer within a
swagger:route
block of their codebase, and the corresponding swagger definition would be created when runningswagger generate spec
. These changes currently only support go1.11+.These changes are making the following assumptions:
x-
, e.g.x-some-extension
The new extension parser reads through the
Extension
annotation block within aswagger:route
annotation, checking for what kind of data each line may be and builds out as manymap[string]interface{}
s as necessary until reaching the end of the block.map[string]string
map[string]*[]string
map[string]interface{}
that can contain any of the above types, including more objectsExample
Input:
Output:
Fixes #1957