File tree Expand file tree Collapse file tree 4 files changed +95
-0
lines changed
springdoc-openapi-common/src/main/java/org/springdoc/core
springdoc-openapi-webmvc-core/src/test
java/test/org/springdoc/api/app109 Expand file tree Collapse file tree 4 files changed +95
-0
lines changed Original file line number Diff line number Diff line change 47
47
import org .springframework .core .MethodParameter ;
48
48
import org .springframework .core .ResolvableType ;
49
49
import org .springframework .core .annotation .AnnotationUtils ;
50
+ import org .springframework .core .io .Resource ;
50
51
import org .springframework .web .multipart .MultipartFile ;
51
52
52
53
@ SuppressWarnings ("rawtypes" )
@@ -58,6 +59,7 @@ public class GenericParameterBuilder {
58
59
59
60
static {
60
61
FILE_TYPES .add (MultipartFile .class );
62
+ FILE_TYPES .add (Resource .class );
61
63
ANNOTATIOSN_TO_IGNORE .add (Hidden .class );
62
64
}
63
65
Original file line number Diff line number Diff line change
1
+ package test .org .springdoc .api .app109 ;
2
+
3
+ import io .swagger .v3 .oas .annotations .media .Content ;
4
+ import io .swagger .v3 .oas .annotations .media .Schema ;
5
+ import io .swagger .v3 .oas .annotations .responses .ApiResponse ;
6
+
7
+ import org .springframework .core .io .ByteArrayResource ;
8
+ import org .springframework .core .io .Resource ;
9
+ import org .springframework .web .bind .annotation .GetMapping ;
10
+ import org .springframework .web .bind .annotation .RestController ;
11
+
12
+ @ RestController
13
+ public class HelloController {
14
+
15
+ @ GetMapping ("/api/v1/resource" )
16
+ public Resource getResource () {
17
+ return new ByteArrayResource (new byte []{});
18
+ }
19
+
20
+ @ GetMapping ("/api/v1/bytearray" )
21
+ @ ApiResponse (content = @ Content (schema = @ Schema (type = "string" , format = "binary" )))
22
+ public byte [] getByteArray () {
23
+ return new byte []{};
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ package test .org .springdoc .api .app109 ;
2
+
3
+ import test .org .springdoc .api .AbstractSpringDocTest ;
4
+
5
+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
6
+
7
+ public class SpringDocApp109Test extends AbstractSpringDocTest {
8
+ @ SpringBootApplication
9
+ static class SpringDocTestApp {}
10
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "openapi" : " 3.0.1" ,
3
+ "info" : {
4
+ "title" : " OpenAPI definition" ,
5
+ "version" : " v0"
6
+ },
7
+ "servers" : [
8
+ {
9
+ "url" : " http://localhost" ,
10
+ "description" : " Generated server url"
11
+ }
12
+ ],
13
+ "paths" : {
14
+ "/api/v1/resource" : {
15
+ "get" : {
16
+ "tags" : [
17
+ " hello-controller"
18
+ ],
19
+ "operationId" : " getResource" ,
20
+ "responses" : {
21
+ "200" : {
22
+ "description" : " default response" ,
23
+ "content" : {
24
+ "*/*" : {
25
+ "schema" : {
26
+ "type" : " string" ,
27
+ "format" : " binary"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ }
34
+ },
35
+ "/api/v1/bytearray" : {
36
+ "get" : {
37
+ "tags" : [
38
+ " hello-controller"
39
+ ],
40
+ "operationId" : " getByteArray" ,
41
+ "responses" : {
42
+ "default" : {
43
+ "description" : " default response" ,
44
+ "content" : {
45
+ "*/*" : {
46
+ "schema" : {
47
+ "type" : " string" ,
48
+ "format" : " binary"
49
+ }
50
+ }
51
+ }
52
+ }
53
+ }
54
+ }
55
+ }
56
+ },
57
+ "components" : {}
58
+ }
You can’t perform that action at this time.
0 commit comments