Make params required even if all params are optional #1022
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.
In 5.x, an optional query parameter's type could be referenced with an
expression such as
In 6.0, that only works if there is at least one mandatory query
parameter in addition to the optional one. This makes query parameter
types much more awkward to reference in application code if all the
parameters are optional.
Revert to the 5.x behavior: if there are any parameters, optional or
not, the
parameters
object is always present. If there are any queryparameters, the
query
object is always present, same withpath
andthe other parameter types.
Changes
Fixes #995
How to Review
The actual code change here is trivial (the vast majority of changed lines
are changes to the test cases). But per the discussion on #995, it's not
entirely clear why this behavior changed between 5.x and 6.0. Reverting to
the 5.x behavior will restore compatibility with existing application code,
but it may break code that relied on the 6.0 behavior depending on how that
code was constructing its type references.
Checklist
examples/
directory updated (if applicable)