Skip to content

Commit a409036

Browse files
committed
add inline items
1 parent 4edd640 commit a409036

File tree

5 files changed

+135
-87
lines changed

5 files changed

+135
-87
lines changed

core-tests/e2e-tests/spring-rest-openapi-v3/src/main/kotlin/com/foo/rest/examples/spring/openapi/v3/dtoreflectiveassert/DtoReflectiveAssertRest.kt

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import org.springframework.web.bind.annotation.RestController
99
@RestController
1010
class DtoReflectiveAssertRest {
1111

12-
@PostMapping(path = ["/allof"], consumes = [MediaType.APPLICATION_JSON_VALUE])
13-
open fun allof(@RequestBody body: AllOfDto) : ResponseEntity<String>{
14-
return ResponseEntity.ok("OK")
15-
}
12+
// @PostMapping(path = ["/allof"], consumes = [MediaType.APPLICATION_JSON_VALUE])
13+
// open fun allof(@RequestBody body: AllOfDto) : ResponseEntity<String>{
14+
// return ResponseEntity.ok("OK")
15+
// }
1616

1717
// TODO: Restore when support for ChoiceGene has been added
1818
// @PostMapping(path = ["/anyof"], consumes = [MediaType.APPLICATION_JSON_VALUE])
@@ -26,13 +26,18 @@ class DtoReflectiveAssertRest {
2626
// return ResponseEntity.ok("OK")
2727
// }
2828

29-
@PostMapping(path = ["/primitiveTypes"], consumes = [MediaType.APPLICATION_JSON_VALUE])
30-
open fun primitiveTypes(@RequestBody body: PrimitiveTypesDto) : ResponseEntity<String>{
31-
return ResponseEntity.ok("OK")
32-
}
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+
// }
3338

34-
@PostMapping(path = ["/parent"], consumes = [MediaType.APPLICATION_JSON_VALUE])
35-
open fun parent(@RequestBody body: ParentSchemaDto) : ResponseEntity<String>{
39+
@PostMapping(path = ["/items-inline"], consumes = [MediaType.APPLICATION_JSON_VALUE])
40+
open fun itemsInline(@RequestBody body: ItemsInlineDto) : ResponseEntity<String>{
3641
return ResponseEntity.ok("OK")
3742
}
3843

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 ItemsInlineDto {
4+
5+
var numbers: List<Integer> = emptyList()
6+
var labels: List<LabelsDto> = emptyList()
7+
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package com.foo.rest.examples.spring.openapi.v3.dtoreflectiveassert
2+
3+
class LabelsDto {
4+
5+
var value: String = ""
6+
7+
}

core-tests/e2e-tests/spring-rest-openapi-v3/src/main/resources/static/openapi-dto-reflective-assert.yaml

Lines changed: 99 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,86 +4,114 @@ info:
44
version: 1.0.0
55

66
paths:
7-
/primitiveTypes:
7+
/items-inline:
88
post:
9-
summary: Example with all primitive and format types (no array/object)
9+
summary: Accepts an array of objects, each with numbers and labels
1010
requestBody:
1111
required: true
1212
content:
1313
application/json:
1414
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'
15+
type: array
16+
items:
17+
type: object
18+
required: [numbers, labels]
19+
properties:
20+
numbers:
21+
type: array
22+
items:
23+
type: integer
24+
labels:
25+
type: array
26+
items:
27+
type: object
28+
required: [value]
29+
properties:
30+
value:
31+
type: string
8432
responses:
8533
'200':
8634
description: OK
35+
# /primitiveTypes:
36+
# post:
37+
# summary: Example with all primitive and format types (no array/object)
38+
# requestBody:
39+
# required: true
40+
# content:
41+
# application/json:
42+
# schema:
43+
# type: object
44+
# properties:
45+
# aString:
46+
# type: string
47+
# aRegex:
48+
# type: string
49+
# pattern: "^[a-zA-Z0-9]+$"
50+
# aDate:
51+
# type: string
52+
# format: date
53+
# aTime:
54+
# type: string
55+
# format: time
56+
# aDateTime:
57+
# type: string
58+
# format: date-time
59+
# anInteger:
60+
# type: integer
61+
# aLong:
62+
# type: integer
63+
# format: int64
64+
# aDouble:
65+
# type: number
66+
# aFloat:
67+
# type: number
68+
# format: float
69+
# aBoolean:
70+
# type: boolean
71+
# aNullableString:
72+
# type: string
73+
# nullable: true
74+
# required:
75+
# - aString
76+
# - aRegex
77+
# - aBase64String
78+
# - aDate
79+
# - aTime
80+
# - aDateTime
81+
# - anInteger
82+
# - aLong
83+
# - aDouble
84+
# - aFloat
85+
# - aBoolean
86+
# responses:
87+
# '200':
88+
# description: OK
89+
# /parent:
90+
# post:
91+
# summary: Uses ParentSchema, which references ChildSchema
92+
# requestBody:
93+
# required: true
94+
# content:
95+
# application/json:
96+
# schema:
97+
# $ref: '#/components/schemas/ParentSchema'
98+
# responses:
99+
# '200':
100+
# description: OK
101+
# /allof:
102+
# post:
103+
# summary: Combines two components NamePart and AgePart
104+
# requestBody:
105+
# required: true
106+
# content:
107+
# application/json:
108+
# schema:
109+
# allOf:
110+
# - $ref: '#/components/schemas/NamePart'
111+
# - $ref: '#/components/schemas/AgePart'
112+
# responses:
113+
# '200':
114+
# description: OK
87115
# TODO: Restore when support for ChoiceGene has been added
88116
# /anyof:
89117
# post:

core-tests/e2e-tests/spring-rest-openapi-v3/src/test/kotlin/org/evomaster/e2etests/spring/openapi/v3/dtoreflectiveassert/DtoReflectiveAssertEMTest.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ class DtoReflectiveAssertEMTest: SpringTestBase() {
3636
val solution = initAndRun(args)
3737

3838
Assertions.assertTrue(solution.individuals.size >= 1)
39-
assertHasAtLeastOne(solution, HttpVerb.POST, 200, "/allof", "OK")
40-
assertHasAtLeastOne(solution, HttpVerb.POST, 200, "/primitiveTypes", "OK")
41-
assertHasAtLeastOne(solution, HttpVerb.POST, 200, "/parent", "OK")
39+
// assertHasAtLeastOne(solution, HttpVerb.POST, 200, "/allof", "OK")
40+
// assertHasAtLeastOne(solution, HttpVerb.POST, 200, "/primitiveTypes", "OK")
41+
// assertHasAtLeastOne(solution, HttpVerb.POST, 200, "/parent", "OK")
4242
}
4343

44-
assertPrimitiveTypeDtoCreated()
45-
assertParentAndChildDtosCreated()
46-
assertAllOfDtoCreated()
44+
// assertPrimitiveTypeDtoCreated()
45+
// assertParentAndChildDtosCreated()
46+
// assertAllOfDtoCreated()
4747
// TODO: Restore when support for ChoiceGene has been added
4848
// assertAnyOfDtoCreated()
4949
// assertOneOfDtoCreated()

0 commit comments

Comments
 (0)