File tree Expand file tree Collapse file tree 3 files changed +116
-0
lines changed
springdoc-openapi-webmvc-core/src/test
java/test/org/springdoc/api/app107 Expand file tree Collapse file tree 3 files changed +116
-0
lines changed Original file line number Diff line number Diff line change 1+ package test .org .springdoc .api .app107 ;
2+
3+ import com .fasterxml .jackson .annotation .JsonProperty ;
4+ import io .swagger .v3 .oas .annotations .media .Schema ;
5+
6+ import org .springframework .web .bind .annotation .GetMapping ;
7+ import org .springframework .web .bind .annotation .RestController ;
8+
9+ @ RestController
10+ public class HelloController {
11+
12+ @ GetMapping (path = "/entity-b" , produces = { "application/json" , "application/xml" })
13+ public EntityB getEntityB (){
14+ return new EntityB ();
15+ }
16+
17+ public class EntityB {
18+
19+ @ Schema (required = true )
20+ @ JsonProperty ("fieldB" )
21+ private String fieldB ;
22+
23+ @ Schema (required = true )
24+ @ JsonProperty ("entityA" )
25+ private EntityA entityA ;
26+ //Getters and setters...
27+ }
28+
29+ public class EntityA {
30+ @ Schema (required = true )
31+ @ JsonProperty ("fieldA" )
32+ private String fieldA ;
33+ //Getters and setters...
34+ }
35+ }
36+
Original file line number Diff line number Diff line change 1+ package test .org .springdoc .api .app107 ;
2+
3+ import test .org .springdoc .api .AbstractSpringDocTest ;
4+
5+ import org .springframework .boot .autoconfigure .SpringBootApplication ;
6+
7+ public class SpringDocApp107Test 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+ "/entity-b" : {
15+ "get" : {
16+ "tags" : [
17+ " hello-controller"
18+ ],
19+ "operationId" : " getEntityB" ,
20+ "responses" : {
21+ "200" : {
22+ "description" : " default response" ,
23+ "content" : {
24+ "application/json" : {
25+ "schema" : {
26+ "$ref" : " #/components/schemas/EntityB"
27+ }
28+ },
29+ "application/xml" : {
30+ "schema" : {
31+ "$ref" : " #/components/schemas/EntityB"
32+ }
33+ }
34+ }
35+ }
36+ }
37+ }
38+ }
39+ },
40+ "components" : {
41+ "schemas" : {
42+ "EntityA" : {
43+ "required" : [
44+ " fieldA"
45+ ],
46+ "type" : " object" ,
47+ "properties" : {
48+ "fieldA" : {
49+ "type" : " string"
50+ }
51+ }
52+ },
53+ "EntityB" : {
54+ "required" : [
55+ " entityA" ,
56+ " fieldB"
57+ ],
58+ "type" : " object" ,
59+ "properties" : {
60+ "fieldB" : {
61+ "type" : " string"
62+ },
63+ "entityA" : {
64+ "$ref" : " #/components/schemas/EntityA"
65+ }
66+ }
67+ }
68+ }
69+ }
70+ }
You can’t perform that action at this time.
0 commit comments