Skip to content

Commit b25bb65

Browse files
committed
break everything by more defaults and dollars and double quotes
1 parent ad798de commit b25bb65

File tree

21 files changed

+957
-103
lines changed

21 files changed

+957
-103
lines changed

bin/configs/kotlin-spring-boot-x-kotlin-implements.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ additionalProperties:
99
useSwaggerUI: false
1010
serviceImplementation: false
1111
skipDefaultInterface: true
12-
interfaceOnly: true
12+
interfaceOnly: false
1313
serializableModel: true
1414
beanValidations: true
1515
includeHttpRequestContext: true

modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-tags.yaml

Lines changed: 75 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -656,51 +656,104 @@ paths:
656656
content: { }
657657
/items/{item$Id}:
658658
get:
659-
summary: "Retrieve item by $Id"
660-
description: "Get an item using the $symbol in parameter and property names."
659+
summary: "Retrieve item \"by\" $Id"
660+
description: "Get an item using the $symbol in \"parameter\" and property names."
661661
parameters:
662662
- name: "item$Id"
663663
in: path
664664
required: true
665-
description: "The $prefixed ID of the item."
665+
description: "The $prefixed \"ID\" of the item."
666666
schema:
667667
type: string
668-
example: "item$123"
668+
example: "i\"te\"m$123"
669669
- name: "filter$Type"
670670
in: query
671671
required: false
672-
description: "Optional $filter for item type."
672+
description: "Optional $filter \"for\" item type."
673673
schema:
674674
type: string
675-
example: "type$A"
675+
example: "\"type$A\""
676+
"default": "\"type\"$ADefault"
677+
- name: "X-Custom$Header"
678+
in: header
679+
required: false
680+
description: "Header param with $"
681+
schema:
682+
type: string
683+
example: "hdr$val"
684+
- name: "session$Token"
685+
in: cookie
686+
required: false
687+
description: "Cookie param with $dol\"lar\""
688+
schema:
689+
type: string
690+
example: "cookie$a\"bc\""
676691
responses:
677692
'200':
678-
description: "Successful $response"
693+
description: "\"Successful $response\""
679694
content:
680695
application/json:
681696
schema:
682697
type: object
683698
properties:
684699
item$Id:
685700
type: string
686-
description: "The $ID of the item."
687-
example: "item$123"
701+
description: "The $ID of \"the\" item."
702+
example: "\"item$123\""
703+
default: "Item$Id\"Default\""
688704
name$Value:
689705
type: string
690-
description: "The $name of the item."
691-
example: "Item$Name"
706+
description: "The $name \"of the \"item."
707+
example: "\"Item\"$Name"
708+
default: "Item$\"NameDefault\""
692709
details$Info:
693710
type: object
694-
description: "Nested object with $keys."
711+
description: "Nested \"object\" with $keys."
695712
properties:
696713
detail$One:
697714
type: string
698-
description: "First $detail"
699-
example: "Detail$1"
715+
description: "\"First $detail\""
716+
example: "\"Detail$1\""
717+
default: "\"Detail\"$1Default"
700718
detail$Two:
701719
type: integer
702-
description: "Second $detail"
720+
description: "\"Second\" $detail"
703721
example: 42
722+
/items:
723+
post:
724+
summary: "Create $it\"em\""
725+
description: "POST using form params and $every\"where\"."
726+
requestBody:
727+
required: true
728+
content:
729+
application/x-www-form-urlencoded:
730+
schema:
731+
type: object
732+
properties:
733+
form$Name:
734+
type: string
735+
description: "Form field with $issue \"fdsfsd\""
736+
example: "Name$X\"fsdfsd\""
737+
form$Value:
738+
type: string
739+
description: "Another $form \"field\""
740+
example: "Val$Y\"fdfsdf\""
741+
parameters:
742+
- name: "X-Post$Header"
743+
in: header
744+
required: false
745+
description: "Header \"param\" with $"
746+
schema:
747+
type: string
748+
example: "hdr$po\"st\""
749+
750+
responses:
751+
"201":
752+
description: "$test \"created\""
753+
content:
754+
application/json:
755+
schema:
756+
$ref: "#/components/schemas/ItemWithDollarAttributesAndExamples"
704757
components:
705758
schemas:
706759
Order:
@@ -835,16 +888,18 @@ components:
835888
description: Describes the result of uploading an image resource
836889
ItemWithDollarAttributesAndExamples:
837890
type: object
838-
description: "A schema demonstrating $usage in properties."
891+
description: "A schema \"demonstrating\" $usage in properties."
839892
properties:
840893
$id:
841894
type: string
842-
description: "$ID property"
843-
example: "$item123"
895+
description: "\"$ID property\""
896+
example: "$item\"123\""
897+
default: "$item\"123Default\""
844898
$name:
845899
type: string
846-
description: "$Name property"
847-
example: "$ItemName"
900+
description: "$Name\" property\""
901+
example: "$Item\"Name"
902+
default: "$ItemNameDefault\""
848903
securitySchemes:
849904
petstore_auth:
850905
type: oauth2

modules/openapi-generator/src/test/resources/3_0/kotlin/petstore-with-x-kotlin-implements.yaml

Lines changed: 75 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -488,51 +488,104 @@ paths:
488488
description: User not found
489489
/items/{item$Id}:
490490
get:
491-
summary: "Retrieve item by $Id"
492-
description: "Get an item using the $symbol in parameter and property names."
491+
summary: "Retrieve item \"by\" $Id"
492+
description: "Get an item using the $symbol in \"parameter\" and property names."
493493
parameters:
494494
- name: "item$Id"
495495
in: path
496496
required: true
497-
description: "The $prefixed ID of the item."
497+
description: "The $prefixed \"ID\" of the item."
498498
schema:
499499
type: string
500-
example: "item$123"
500+
example: "i\"te\"m$123"
501501
- name: "filter$Type"
502502
in: query
503503
required: false
504-
description: "Optional $filter for item type."
504+
description: "Optional $filter \"for\" item type."
505505
schema:
506506
type: string
507-
example: "type$A"
507+
example: "\"type$A\""
508+
"default": "\"type\"$ADefault"
509+
- name: "X-Custom$Header"
510+
in: header
511+
required: false
512+
description: "Header param with $"
513+
schema:
514+
type: string
515+
example: "hdr$val"
516+
- name: "session$Token"
517+
in: cookie
518+
required: false
519+
description: "Cookie param with $dol\"lar\""
520+
schema:
521+
type: string
522+
example: "cookie$a\"bc\""
508523
responses:
509524
'200':
510-
description: "Successful $response"
525+
description: "\"Successful $response\""
511526
content:
512527
application/json:
513528
schema:
514529
type: object
515530
properties:
516531
item$Id:
517532
type: string
518-
description: "The $ID of the item."
519-
example: "item$123"
533+
description: "The $ID of \"the\" item."
534+
example: "\"item$123\""
535+
default: "Item$Id\"Default\""
520536
name$Value:
521537
type: string
522-
description: "The $name of the item."
523-
example: "Item$Name"
538+
description: "The $name \"of the \"item."
539+
example: "\"Item\"$Name"
540+
default: "Item$\"NameDefault\""
524541
details$Info:
525542
type: object
526-
description: "Nested object with $keys."
543+
description: "Nested \"object\" with $keys."
527544
properties:
528545
detail$One:
529546
type: string
530-
description: "First $detail"
531-
example: "Detail$1"
547+
description: "\"First $detail\""
548+
example: "\"Detail$1\""
549+
default: "\"Detail\"$1Default"
532550
detail$Two:
533551
type: integer
534-
description: "Second $detail"
552+
description: "\"Second\" $detail"
535553
example: 42
554+
/items:
555+
post:
556+
summary: "Create $it\"em\""
557+
description: "POST using form params and $every\"where\"."
558+
requestBody:
559+
required: true
560+
content:
561+
application/x-www-form-urlencoded:
562+
schema:
563+
type: object
564+
properties:
565+
form$Name:
566+
type: string
567+
description: "Form field with $issue \"fdsfsd\""
568+
example: "Name$X\"fsdfsd\""
569+
form$Value:
570+
type: string
571+
description: "Another $form \"field\""
572+
example: "Val$Y\"fdfsdf\""
573+
parameters:
574+
- name: "X-Post$Header"
575+
in: header
576+
required: false
577+
description: "Header \"param\" with $"
578+
schema:
579+
type: string
580+
example: "hdr$po\"st\""
581+
582+
responses:
583+
"201":
584+
description: "$test \"created\""
585+
content:
586+
application/json:
587+
schema:
588+
$ref: "#/components/schemas/ItemWithDollarAttributesAndExamples"
536589
components:
537590
securitySchemes:
538591
petstore_auth:
@@ -692,13 +745,15 @@ components:
692745
type: string
693746
ItemWithDollarAttributesAndExamples:
694747
type: object
695-
description: "A schema demonstrating $usage in properties."
748+
description: "A schema \"demonstrating\" $usage in properties."
696749
properties:
697750
$id:
698751
type: string
699-
description: "$ID property"
700-
example: "$item123"
752+
description: "\"$ID property\""
753+
example: "$item\"123\""
754+
default: "$item\"123Default\""
701755
$name:
702756
type: string
703-
description: "$Name property"
704-
example: "$ItemName"
757+
description: "$Name\" property\""
758+
example: "$Item\"Name"
759+
default: "$ItemNameDefault\""

samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/api/ItemsApi.kt

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
package org.openapitools.api
77

8+
import org.openapitools.model.ItemWithDollarAttributesAndExamples
89
import org.openapitools.model.ItemsItemIdGet200Response
910
import io.swagger.annotations.Api
1011
import io.swagger.annotations.ApiOperation
@@ -45,29 +46,57 @@ interface ItemsApi {
4546

4647

4748
@ApiOperation(
48-
value = "Retrieve item by $Id",
49+
value = "Retrieve item \"by\" $Id",
4950
nickname = "itemsItemIdGet",
50-
notes = "Get an item using the $symbol in parameter and property names.",
51+
notes = "Get an item using the $symbol in \"parameter\" and property names.",
5152
response = ItemsItemIdGet200Response::class
5253
)
5354
@ApiResponses(
54-
value = [ApiResponse(code = 200, message = "Successful $response", response = ItemsItemIdGet200Response::class)]
55+
value = [ApiResponse(code = 200, message = "\"Successful $response\"", response = ItemsItemIdGet200Response::class)]
5556
)
5657
@RequestMapping(
5758
method = [RequestMethod.GET],
5859
value = [PATH_ITEMS_ITEM_ID_GET /* "/items/{item\$Id}" */],
5960
produces = ["application/json"]
6061
)
6162
suspend fun itemsItemIdGet(
62-
@ApiParam(value = "The $prefixed ID of the item.", required = true) @PathVariable("item$Id") itemDollarId: kotlin.String,
63-
@ApiParam(value = "Optional $filter for item type.") @Valid @RequestParam(value = "filter$Type", required = false) filterDollarType: kotlin.String?,
63+
@ApiParam(value = "The $prefixed \"ID\" of the item.", required = true) @PathVariable("item$Id") itemDollarId: kotlin.String,
64+
@ApiParam(value = "Optional $filter \"for\" item type.", defaultValue = "\"type\"$ADefault") @Valid @RequestParam(value = "filter$Type", required = false, defaultValue = "\"type\"$ADefault") filterDollarType: kotlin.String,
65+
@ApiParam(value = "Header param with $") @RequestHeader(value = "X-Custom$Header", required = false) xCustomDollarHeader: kotlin.String?,
66+
@CookieValue(name = "session$Token", required = false) sessionDollarToken: kotlin.String?,
6467
@ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange
6568
): ResponseEntity<ItemsItemIdGet200Response> {
66-
return getDelegate().itemsItemIdGet(itemDollarId, filterDollarType, exchange)
69+
return getDelegate().itemsItemIdGet(itemDollarId, filterDollarType, xCustomDollarHeader, sessionDollarToken, exchange)
70+
}
71+
72+
73+
@ApiOperation(
74+
value = "Create $it\"em\"",
75+
nickname = "itemsPost",
76+
notes = "POST using form params and $every\"where\".",
77+
response = ItemWithDollarAttributesAndExamples::class
78+
)
79+
@ApiResponses(
80+
value = [ApiResponse(code = 201, message = "$test \"created\"", response = ItemWithDollarAttributesAndExamples::class)]
81+
)
82+
@RequestMapping(
83+
method = [RequestMethod.POST],
84+
value = [PATH_ITEMS_POST /* "/items" */],
85+
produces = ["application/json"],
86+
consumes = ["application/x-www-form-urlencoded"]
87+
)
88+
suspend fun itemsPost(
89+
@ApiParam(value = "Header \"param\" with $") @RequestHeader(value = "X-Post$Header", required = false) xPostDollarHeader: kotlin.String?,
90+
@ApiParam(value = "Form field with $issue \\\"fdsfsd\\\"") @Valid @RequestParam(value = "form$Name", required = false) formDollarName: kotlin.String?,
91+
@ApiParam(value = "Another $form \\\"field\\\"") @Valid @RequestParam(value = "form$Value", required = false) formDollarValue: kotlin.String?,
92+
@ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange
93+
): ResponseEntity<ItemWithDollarAttributesAndExamples> {
94+
return getDelegate().itemsPost(xPostDollarHeader, formDollarName, formDollarValue, exchange)
6795
}
6896

6997
companion object {
7098
//for your own safety never directly reuse these path definitions in tests
7199
const val PATH_ITEMS_ITEM_ID_GET: String = "/items/{item$Id}"
100+
const val PATH_ITEMS_POST: String = "/items"
72101
}
73102
}

samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/src/main/kotlin/org/openapitools/api/ItemsApiDelegate.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.openapitools.api
22

3+
import org.openapitools.model.ItemWithDollarAttributesAndExamples
34
import org.openapitools.model.ItemsItemIdGet200Response
45
import org.springframework.http.HttpStatus
56
import org.springframework.http.MediaType
@@ -22,7 +23,18 @@ interface ItemsApiDelegate {
2223
* @see ItemsApi#itemsItemIdGet
2324
*/
2425
suspend fun itemsItemIdGet(itemDollarId: kotlin.String,
25-
filterDollarType: kotlin.String?,
26+
filterDollarType: kotlin.String,
27+
xCustomDollarHeader: kotlin.String?,
28+
sessionDollarToken: kotlin.String?,
2629
exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity<ItemsItemIdGet200Response>
2730

31+
32+
/**
33+
* @see ItemsApi#itemsPost
34+
*/
35+
suspend fun itemsPost(xPostDollarHeader: kotlin.String?,
36+
formDollarName: kotlin.String?,
37+
formDollarValue: kotlin.String?,
38+
exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity<ItemWithDollarAttributesAndExamples>
39+
2840
}

0 commit comments

Comments
 (0)