This repository has been archived by the owner on Aug 4, 2023. It is now read-only.
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.
Body parameters (
in
is"body"
) are always grouped in a single object, and as such there is no way to set defaults for some of the parameters nested inside that body[1].This change looks deeper into the object for
default
values of the parameters rather than just the overall body. This is to support more flexible configuration of expected parameters inbody
, and brings the body support closer to ae.g.path
which already supports multiple parameters.This change will look for
default
parameter values for allobject
type parameters. This is also recursive, so if anobject
has a parameter that is anobject
then this code will look for defaults in that nested object.Note [1]: with the current code, it's not even possible to set a default for the whole body's schema. Defaults are only looked for in
parameter.default
, but body defaults would be inparameter.schema.default
(seehelpers.js:getParameterValue()
) . This has not been changed in the this pull request.Note [2]: this has only been implemented for Swagger 2.0 as I am not familiar with Swagger 1.2, so felt it best to leave 1.2 as-is.