Skip to content

Commit e6acbef

Browse files
committed
Merge branch 'master' into feature/mu-plus-lambda
2 parents f913b1d + 9a5eb82 commit e6acbef

File tree

34 files changed

+1619
-170
lines changed

34 files changed

+1619
-170
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,9 @@ Migrations/
154154
/core-tests/e2e-tests/spring-rest-h2-v1/em.yaml
155155
/core-tests/integration-tests/core-it/target/
156156
/core-tests/integration-tests/core-it/em.yaml
157+
158+
client-java/sql/target
159+
client-java/sql-dto/target
160+
client-java/distance-heuristics/target
161+
client-java/test-old-libraries/target
162+
core-tests/e2e-tests/spring-rest-mysql/target
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
class AllOfDto {
4+
5+
var name: String = ""
6+
var age: Int = -1
7+
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
class AnyOfDto {
4+
5+
var email: String = ""
6+
var phone: String = ""
7+
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
class ChildSchemaDto {
4+
5+
var name: String = ""
6+
var age: Int = -1
7+
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
import org.springframework.boot.SpringApplication
4+
import org.springframework.boot.autoconfigure.SpringBootApplication
5+
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration
6+
7+
@SpringBootApplication(exclude = [SecurityAutoConfiguration::class])
8+
open class DtoReflectiveAssertApplication {
9+
10+
companion object {
11+
@JvmStatic
12+
fun main(args: Array<String>) {
13+
SpringApplication.run(DtoReflectiveAssertApplication::class.java, *args)
14+
}
15+
}
16+
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
import org.springframework.http.MediaType
4+
import org.springframework.http.ResponseEntity
5+
import org.springframework.web.bind.annotation.PostMapping
6+
import org.springframework.web.bind.annotation.RequestBody
7+
import org.springframework.web.bind.annotation.RestController
8+
9+
@RestController
10+
class DtoReflectiveAssertRest {
11+
12+
@PostMapping(path = ["/allof"], consumes = [MediaType.APPLICATION_JSON_VALUE])
13+
open fun allof(@RequestBody body: AllOfDto) : ResponseEntity<String>{
14+
return ResponseEntity.ok("OK")
15+
}
16+
17+
// TODO: Restore when support for ChoiceGene has been added
18+
// @PostMapping(path = ["/anyof"], consumes = [MediaType.APPLICATION_JSON_VALUE])
19+
// open fun anyof(@RequestBody body: AnyOfDto) : ResponseEntity<String>{
20+
// return ResponseEntity.ok("OK")
21+
// }
22+
23+
// TODO: Restore when support for ChoiceGene has been added
24+
// @PostMapping(path = ["/oneof"], consumes = [MediaType.APPLICATION_JSON_VALUE])
25+
// open fun oneof(@RequestBody body: OneOfDto) : ResponseEntity<String>{
26+
// return ResponseEntity.ok("OK")
27+
// }
28+
29+
@PostMapping(path = ["/primitiveTypes"], consumes = [MediaType.APPLICATION_JSON_VALUE])
30+
open fun primitiveTypes(@RequestBody body: PrimitiveTypesDto) : ResponseEntity<String>{
31+
return ResponseEntity.ok("OK")
32+
}
33+
34+
@PostMapping(path = ["/parent"], consumes = [MediaType.APPLICATION_JSON_VALUE])
35+
open fun parent(@RequestBody body: ParentSchemaDto) : ResponseEntity<String>{
36+
return ResponseEntity.ok("OK")
37+
}
38+
39+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
class OneOfDto {
4+
5+
var cat: String = ""
6+
var mouse: String = ""
7+
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
class ParentSchemaDto {
4+
5+
var label: String = ""
6+
var child: ChildSchemaDto = ChildSchemaDto()
7+
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
class PrimitiveTypesDto {
4+
5+
var aString: String = ""
6+
var aRegex: String = ""
7+
var aDate: String = ""
8+
var aTime: String = ""
9+
var aDateTime: String = ""
10+
var anInteger: Int = -1
11+
var aLong: Long = -1L
12+
var aDouble: Double = -1.0
13+
var aFloat: Float = -1.0f
14+
var aBoolean: Boolean = false
15+
var aNullableString: String? = null
16+
17+
}
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
openapi: 3.0.3
2+
info:
3+
title: allOf with Component Schemas
4+
version: 1.0.0
5+
6+
paths:
7+
/primitiveTypes:
8+
post:
9+
summary: Example with all primitive and format types (no array/object)
10+
requestBody:
11+
required: true
12+
content:
13+
application/json:
14+
schema:
15+
type: object
16+
properties:
17+
aString:
18+
type: string
19+
aRegex:
20+
type: string
21+
pattern: "^[a-zA-Z0-9]+$"
22+
aDate:
23+
type: string
24+
format: date
25+
aTime:
26+
type: string
27+
format: time
28+
aDateTime:
29+
type: string
30+
format: date-time
31+
anInteger:
32+
type: integer
33+
aLong:
34+
type: integer
35+
format: int64
36+
aDouble:
37+
type: number
38+
aFloat:
39+
type: number
40+
format: float
41+
aBoolean:
42+
type: boolean
43+
aNullableString:
44+
type: string
45+
nullable: true
46+
required:
47+
- aString
48+
- aRegex
49+
- aBase64String
50+
- aDate
51+
- aTime
52+
- aDateTime
53+
- anInteger
54+
- aLong
55+
- aDouble
56+
- aFloat
57+
- aBoolean
58+
responses:
59+
'200':
60+
description: OK
61+
/parent:
62+
post:
63+
summary: Uses ParentSchema, which references ChildSchema
64+
requestBody:
65+
required: true
66+
content:
67+
application/json:
68+
schema:
69+
$ref: '#/components/schemas/ParentSchema'
70+
responses:
71+
'200':
72+
description: OK
73+
/allof:
74+
post:
75+
summary: Combines two components NamePart and AgePart
76+
requestBody:
77+
required: true
78+
content:
79+
application/json:
80+
schema:
81+
allOf:
82+
- $ref: '#/components/schemas/NamePart'
83+
- $ref: '#/components/schemas/AgePart'
84+
responses:
85+
'200':
86+
description: OK
87+
# TODO: Restore when support for ChoiceGene has been added
88+
# /anyof:
89+
# post:
90+
# summary: Accepts either an email (component) or phone (inline)
91+
# requestBody:
92+
# required: true
93+
# content:
94+
# application/json:
95+
# schema:
96+
# anyOf:
97+
# - $ref: '#/components/schemas/EmailPayload'
98+
# - type: object
99+
# required: [phone]
100+
# properties:
101+
# phone:
102+
# type: string
103+
# responses:
104+
# '200':
105+
# description: OK
106+
# /oneof:
107+
# post:
108+
# summary: Accepts either cat or dog object (but not both)
109+
# requestBody:
110+
# required: true
111+
# content:
112+
# application/json:
113+
# schema:
114+
# oneOf:
115+
# - type: object
116+
# required: [cat]
117+
# properties:
118+
# cat:
119+
# type: string
120+
# - type: object
121+
# required: [mouse]
122+
# properties:
123+
# mouse:
124+
# type: string
125+
# responses:
126+
# '200':
127+
# description: OK
128+
129+
components:
130+
schemas:
131+
NamePart:
132+
type: object
133+
required: [name]
134+
properties:
135+
name:
136+
type: string
137+
138+
AgePart:
139+
type: object
140+
required: [age]
141+
properties:
142+
age:
143+
type: integer
144+
145+
EmailPayload:
146+
type: object
147+
required: [email]
148+
properties:
149+
email:
150+
type: string
151+
152+
ParentSchema:
153+
type: object
154+
properties:
155+
label:
156+
type: string
157+
child:
158+
$ref: '#/components/schemas/ChildSchema'
159+
required:
160+
- label
161+
- child
162+
163+
ChildSchema:
164+
type: object
165+
properties:
166+
name:
167+
type: string
168+
age:
169+
type: integer
170+
required:
171+
- name
172+
- age

0 commit comments

Comments
 (0)