Skip to content

Commit

Permalink
Merge pull request #4612 from swagger-api/SWG-9981-Fix-explode-bug
Browse files Browse the repository at this point in the history
Fix isExplode method and explode tests
  • Loading branch information
micryc authored Feb 5, 2024
2 parents 78a11e9 + 914564f commit 2344ce4
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ public static void setHeaderExplode (Header header, io.swagger.v3.oas.annotation
}

private static boolean isHeaderExplodable(io.swagger.v3.oas.annotations.headers.Header h, Header header) {
io.swagger.v3.oas.annotations.media.Schema schema = h.schema();
io.swagger.v3.oas.annotations.media.Schema schema = hasArrayAnnotation(h.array()) ? h.array().schema() : h.schema();
boolean explode = true;
if (schema != null) {
Class implementation = schema.implementation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public static void setParameterExplode(Parameter parameter, io.swagger.v3.oas.an
}

private static boolean isExplodable(io.swagger.v3.oas.annotations.Parameter p, Parameter parameter) {
io.swagger.v3.oas.annotations.media.Schema schema = p.schema();
io.swagger.v3.oas.annotations.media.Schema schema = AnnotationsUtils.hasArrayAnnotation(p.array()) ? p.array().schema() : p.schema();
boolean explode = true;
if ("form".equals(parameter.getIn())){
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ public void testOperationWithResponseMultipleHeadersImplementationSchema() {
" Rate-Limit-Limit:\n" +
" description: The number of allowed requests in the current period\n" +
" style: simple\n" +
" explode: true\n" +
" schema:\n" +
" maxItems: 10\n" +
" minItems: 1\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public void testParameters() {
" - name: arrayParameter\n" +
" in: query\n" +
" required: true\n" +
" explode: true\n" +
" content:\n" +
" application/json:\n" +
" schema:\n" +
Expand All @@ -102,6 +103,7 @@ public void testParameters() {
" - name: arrayParameterImplementation\n" +
" in: query\n" +
" required: true\n" +
" explode: true\n" +
" schema:\n" +
" maxItems: 10\n" +
" minItems: 1\n" +
Expand Down Expand Up @@ -148,6 +150,7 @@ public void testArraySchemaParameters() {
" - name: arrayParameter\n" +
" in: query\n" +
" required: true\n" +
" explode: true\n" +
" schema:\n" +
" maxItems: 10\n" +
" minItems: 1\n" +
Expand Down Expand Up @@ -220,6 +223,7 @@ public void testRepeatableParameters() {
" - name: arrayParameter\n" +
" in: query\n" +
" required: true\n" +
" explode: true\n" +
" content:\n" +
" application/json:\n" +
" schema:\n" +
Expand All @@ -234,6 +238,7 @@ public void testRepeatableParameters() {
" - name: arrayParameterImplementation\n" +
" in: query\n" +
" required: true\n" +
" explode: true\n" +
" schema:\n" +
" maxItems: 10\n" +
" minItems: 1\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ paths:
- name: arrayParameter
in: query
required: true
explode: true
schema:
maxItems: 10
minItems: 1
Expand Down Expand Up @@ -787,6 +788,7 @@ paths:
- name: arrayParameter
in: query
required: true
explode: true
content:
application/json:
schema:
Expand All @@ -801,6 +803,7 @@ paths:
- name: arrayParameterImplementation
in: query
required: true
explode: true
schema:
maxItems: 10
minItems: 1
Expand Down Expand Up @@ -868,6 +871,7 @@ paths:
- name: arrayParameter
in: query
required: true
explode: true
content:
application/json:
schema:
Expand All @@ -882,6 +886,7 @@ paths:
- name: arrayParameterImplementation
in: query
required: true
explode: true
schema:
maxItems: 10
minItems: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ paths:
- name: arrayParameter
in: query
required: true
explode: true
schema:
maxItems: 10
minItems: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ paths:
- name: arrayParameter
in: query
required: true
explode: true
content:
application/json:
schema:
Expand All @@ -58,6 +59,7 @@ paths:
- name: arrayParameterImplementation
in: query
required: true
explode: true
schema:
type: array
contains: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ paths:
- name: arrayParameter
in: query
required: true
explode: true
content:
application/json:
schema:
Expand All @@ -56,6 +57,7 @@ paths:
- name: arrayParameterImplementation
in: query
required: true
explode: true
schema:
maxItems: 10
minItems: 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ paths:
- name: arrayParameter
in: query
required: true
explode: true
content:
application/json:
schema:
Expand All @@ -56,6 +57,7 @@ paths:
- name: arrayParameterImplementation
in: query
required: true
explode: true
schema:
maxItems: 10
minItems: 1
Expand Down

0 comments on commit 2344ce4

Please sign in to comment.