Skip to content

Commit 12a047f

Browse files
committed
Wrong schema generation on endpoint consuming multipart form data combined with JsonView. fixes #1829
1 parent bc185f4 commit 12a047f

File tree

8 files changed

+70
-31
lines changed

8 files changed

+70
-31
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocConfigProperties.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ public class SpringDocConfigProperties {
184184
/**
185185
* convert query param to form data when consumes is multipart/form-data
186186
*/
187-
private boolean defaultSupportFormData=true;
187+
private boolean defaultSupportFormData;
188188

189189
/**
190190
* The model Converters

springdoc-openapi-javadoc/src/test/resources/results/app105-3.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,15 @@
473473
"type": "integer",
474474
"format": "int64"
475475
}
476+
},
477+
{
478+
"name": "additionalMetadata",
479+
"in": "query",
480+
"description": "Additional data to pass to server",
481+
"required": false,
482+
"schema": {
483+
"type": "string"
484+
}
476485
}
477486
],
478487
"requestBody": {
@@ -485,9 +494,6 @@
485494
],
486495
"type": "object",
487496
"properties": {
488-
"additionalMetadata": {
489-
"description": "Additional data to pass to server"
490-
},
491497
"file": {
492498
"type": "string",
493499
"description": "file detail",

springdoc-openapi-javadoc/src/test/resources/results/app2.json

+17-11
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,8 @@
495495
}
496496
}
497497
},
498-
"404": {
499-
"description": "Pet not found",
498+
"200": {
499+
"description": "successful operation",
500500
"content": {
501501
"application/xml": {
502502
"schema": {
@@ -510,8 +510,8 @@
510510
}
511511
}
512512
},
513-
"200": {
514-
"description": "successful operation",
513+
"404": {
514+
"description": "Pet not found",
515515
"content": {
516516
"application/xml": {
517517
"schema": {
@@ -670,6 +670,15 @@
670670
"type": "integer",
671671
"format": "int64"
672672
}
673+
},
674+
{
675+
"name": "additionalMetadata",
676+
"in": "query",
677+
"description": "Additional data to pass to server",
678+
"required": false,
679+
"schema": {
680+
"type": "string"
681+
}
673682
}
674683
],
675684
"requestBody": {
@@ -686,9 +695,6 @@
686695
"type": "string",
687696
"description": "file detail",
688697
"format": "binary"
689-
},
690-
"additionalMetadata": {
691-
"description": "Additional data to pass to server"
692698
}
693699
}
694700
}
@@ -854,8 +860,8 @@
854860
}
855861
}
856862
},
857-
"404": {
858-
"description": "Order not found",
863+
"200": {
864+
"description": "successful operation",
859865
"content": {
860866
"application/xml": {
861867
"schema": {
@@ -869,8 +875,8 @@
869875
}
870876
}
871877
},
872-
"200": {
873-
"description": "successful operation",
878+
"404": {
879+
"description": "Order not found",
874880
"content": {
875881
"application/xml": {
876882
"schema": {

springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/v30/app189/SpringDocApp189Test.java

+3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@
2525
import test.org.springdoc.api.v30.AbstractSpringDocV30Test;
2626

2727
import org.springframework.boot.autoconfigure.SpringBootApplication;
28+
import org.springframework.test.context.TestPropertySource;
2829

30+
31+
@TestPropertySource(properties = "springdoc.default-support-form-data=true")
2932
public class SpringDocApp189Test extends AbstractSpringDocV30Test {
3033

3134
@SpringBootApplication

springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app105-3.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@
331331
"type": "integer",
332332
"format": "int64"
333333
}
334+
},
335+
{
336+
"name": "additionalMetadata",
337+
"in": "query",
338+
"description": "Additional data to pass to server",
339+
"required": false,
340+
"schema": {
341+
"type": "string"
342+
}
334343
}
335344
],
336345
"requestBody": {
@@ -346,9 +355,6 @@
346355
"type": "string",
347356
"description": "file detail",
348357
"format": "binary"
349-
},
350-
"additionalMetadata": {
351-
"description": "Additional data to pass to server"
352358
}
353359
}
354360
}

springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app2.json

+13-7
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,15 @@
655655
"type": "integer",
656656
"format": "int64"
657657
}
658+
},
659+
{
660+
"name": "additionalMetadata",
661+
"in": "query",
662+
"description": "Additional data to pass to server",
663+
"required": false,
664+
"schema": {
665+
"type": "string"
666+
}
658667
}
659668
],
660669
"requestBody": {
@@ -670,9 +679,6 @@
670679
"type": "string",
671680
"description": "file detail",
672681
"format": "binary"
673-
},
674-
"additionalMetadata": {
675-
"description": "Additional data to pass to server"
676682
}
677683
}
678684
}
@@ -835,8 +841,8 @@
835841
}
836842
}
837843
},
838-
"200": {
839-
"description": "successful operation",
844+
"404": {
845+
"description": "Order not found",
840846
"content": {
841847
"application/xml": {
842848
"schema": {
@@ -850,8 +856,8 @@
850856
}
851857
}
852858
},
853-
"404": {
854-
"description": "Order not found",
859+
"200": {
860+
"description": "successful operation",
855861
"content": {
856862
"application/xml": {
857863
"schema": {

springdoc-openapi-webmvc-core/src/test/resources/results/3.0.1/app68-3.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,15 @@
331331
"type": "integer",
332332
"format": "int64"
333333
}
334+
},
335+
{
336+
"name": "additionalMetadata",
337+
"in": "query",
338+
"description": "Additional data to pass to server",
339+
"required": false,
340+
"schema": {
341+
"type": "string"
342+
}
334343
}
335344
],
336345
"requestBody": {
@@ -346,9 +355,6 @@
346355
"type": "string",
347356
"description": "file detail",
348357
"format": "binary"
349-
},
350-
"additionalMetadata": {
351-
"description": "Additional data to pass to server"
352358
}
353359
}
354360
}

springdoc-openapi-webmvc-core/src/test/resources/results/3.1.0/app2.json

+9-3
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,15 @@
631631
"type": "integer",
632632
"format": "int64"
633633
}
634+
},
635+
{
636+
"name": "additionalMetadata",
637+
"in": "query",
638+
"description": "Additional data to pass to server",
639+
"required": false,
640+
"schema": {
641+
"type": "string"
642+
}
634643
}
635644
],
636645
"requestBody": {
@@ -643,9 +652,6 @@
643652
"type": "string",
644653
"format": "binary",
645654
"description": "file detail"
646-
},
647-
"additionalMetadata": {
648-
"description": "Additional data to pass to server"
649655
}
650656
},
651657
"required": [

0 commit comments

Comments
 (0)