Skip to content

Commit ad798de

Browse files
committed
break tests by introducing problematic dollar
1 parent 578bdbe commit ad798de

14 files changed

Lines changed: 547 additions & 1 deletion

File tree

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

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,53 @@ paths:
654654
404:
655655
description: User not found
656656
content: { }
657+
/items/{item$Id}:
658+
get:
659+
summary: "Retrieve item by $Id"
660+
description: "Get an item using the $symbol in parameter and property names."
661+
parameters:
662+
- name: "item$Id"
663+
in: path
664+
required: true
665+
description: "The $prefixed ID of the item."
666+
schema:
667+
type: string
668+
example: "item$123"
669+
- name: "filter$Type"
670+
in: query
671+
required: false
672+
description: "Optional $filter for item type."
673+
schema:
674+
type: string
675+
example: "type$A"
676+
responses:
677+
'200':
678+
description: "Successful $response"
679+
content:
680+
application/json:
681+
schema:
682+
type: object
683+
properties:
684+
item$Id:
685+
type: string
686+
description: "The $ID of the item."
687+
example: "item$123"
688+
name$Value:
689+
type: string
690+
description: "The $name of the item."
691+
example: "Item$Name"
692+
details$Info:
693+
type: object
694+
description: "Nested object with $keys."
695+
properties:
696+
detail$One:
697+
type: string
698+
description: "First $detail"
699+
example: "Detail$1"
700+
detail$Two:
701+
type: integer
702+
description: "Second $detail"
703+
example: 42
657704
components:
658705
schemas:
659706
Order:
@@ -786,6 +833,18 @@ components:
786833
message:
787834
type: string
788835
description: Describes the result of uploading an image resource
836+
ItemWithDollarAttributesAndExamples:
837+
type: object
838+
description: "A schema demonstrating $usage in properties."
839+
properties:
840+
$id:
841+
type: string
842+
description: "$ID property"
843+
example: "$item123"
844+
$name:
845+
type: string
846+
description: "$Name property"
847+
example: "$ItemName"
789848
securitySchemes:
790849
petstore_auth:
791850
type: oauth2

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

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,53 @@ paths:
486486
description: Invalid username supplied
487487
'404':
488488
description: User not found
489-
489+
/items/{item$Id}:
490+
get:
491+
summary: "Retrieve item by $Id"
492+
description: "Get an item using the $symbol in parameter and property names."
493+
parameters:
494+
- name: "item$Id"
495+
in: path
496+
required: true
497+
description: "The $prefixed ID of the item."
498+
schema:
499+
type: string
500+
example: "item$123"
501+
- name: "filter$Type"
502+
in: query
503+
required: false
504+
description: "Optional $filter for item type."
505+
schema:
506+
type: string
507+
example: "type$A"
508+
responses:
509+
'200':
510+
description: "Successful $response"
511+
content:
512+
application/json:
513+
schema:
514+
type: object
515+
properties:
516+
item$Id:
517+
type: string
518+
description: "The $ID of the item."
519+
example: "item$123"
520+
name$Value:
521+
type: string
522+
description: "The $name of the item."
523+
example: "Item$Name"
524+
details$Info:
525+
type: object
526+
description: "Nested object with $keys."
527+
properties:
528+
detail$One:
529+
type: string
530+
description: "First $detail"
531+
example: "Detail$1"
532+
detail$Two:
533+
type: integer
534+
description: "Second $detail"
535+
example: 42
490536
components:
491537
securitySchemes:
492538
petstore_auth:
@@ -644,3 +690,15 @@ components:
644690
type: string
645691
message:
646692
type: string
693+
ItemWithDollarAttributesAndExamples:
694+
type: object
695+
description: "A schema demonstrating $usage in properties."
696+
properties:
697+
$id:
698+
type: string
699+
description: "$ID property"
700+
example: "$item123"
701+
$name:
702+
type: string
703+
description: "$Name property"
704+
example: "$ItemName"

samples/server/petstore/kotlin-springboot-include-http-request-context-delegate/.openapi-generator/FILES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ pom.xml
88
settings.gradle
99
src/main/kotlin/org/openapitools/Application.kt
1010
src/main/kotlin/org/openapitools/api/ApiUtil.kt
11+
src/main/kotlin/org/openapitools/api/ItemsApi.kt
12+
src/main/kotlin/org/openapitools/api/ItemsApiController.kt
13+
src/main/kotlin/org/openapitools/api/ItemsApiDelegate.kt
1114
src/main/kotlin/org/openapitools/api/PetApi.kt
1215
src/main/kotlin/org/openapitools/api/PetApiController.kt
1316
src/main/kotlin/org/openapitools/api/PetApiDelegate.kt
@@ -22,6 +25,9 @@ src/main/kotlin/org/openapitools/model/Cat.kt
2225
src/main/kotlin/org/openapitools/model/Category.kt
2326
src/main/kotlin/org/openapitools/model/Color.kt
2427
src/main/kotlin/org/openapitools/model/Dog.kt
28+
src/main/kotlin/org/openapitools/model/ItemWithDollarAttributesAndExamples.kt
29+
src/main/kotlin/org/openapitools/model/ItemsItemIdGet200Response.kt
30+
src/main/kotlin/org/openapitools/model/ItemsItemIdGet200ResponseDetailsInfo.kt
2531
src/main/kotlin/org/openapitools/model/ModelApiResponse.kt
2632
src/main/kotlin/org/openapitools/model/Order.kt
2733
src/main/kotlin/org/openapitools/model/Pet.kt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/**
2+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (7.18.0-SNAPSHOT).
3+
* https://openapi-generator.tech
4+
* Do not edit the class manually.
5+
*/
6+
package org.openapitools.api
7+
8+
import org.openapitools.model.ItemsItemIdGet200Response
9+
import io.swagger.annotations.Api
10+
import io.swagger.annotations.ApiOperation
11+
import io.swagger.annotations.ApiParam
12+
import io.swagger.annotations.ApiResponse
13+
import io.swagger.annotations.ApiResponses
14+
import io.swagger.annotations.Authorization
15+
import io.swagger.annotations.AuthorizationScope
16+
import org.springframework.http.HttpStatus
17+
import org.springframework.http.MediaType
18+
import org.springframework.http.ResponseEntity
19+
20+
import org.springframework.web.bind.annotation.*
21+
import org.springframework.validation.annotation.Validated
22+
import org.springframework.web.context.request.NativeWebRequest
23+
import org.springframework.beans.factory.annotation.Autowired
24+
25+
import javax.validation.constraints.DecimalMax
26+
import javax.validation.constraints.DecimalMin
27+
import javax.validation.constraints.Email
28+
import javax.validation.constraints.Max
29+
import javax.validation.constraints.Min
30+
import javax.validation.constraints.NotNull
31+
import javax.validation.constraints.Pattern
32+
import javax.validation.constraints.Size
33+
import javax.validation.Valid
34+
35+
import kotlinx.coroutines.flow.Flow
36+
import kotlin.collections.List
37+
import kotlin.collections.Map
38+
39+
@RestController
40+
@Validated
41+
@Api(value = "items", description = "The items API")
42+
interface ItemsApi {
43+
44+
fun getDelegate(): ItemsApiDelegate
45+
46+
47+
@ApiOperation(
48+
value = "Retrieve item by $Id",
49+
nickname = "itemsItemIdGet",
50+
notes = "Get an item using the $symbol in parameter and property names.",
51+
response = ItemsItemIdGet200Response::class
52+
)
53+
@ApiResponses(
54+
value = [ApiResponse(code = 200, message = "Successful $response", response = ItemsItemIdGet200Response::class)]
55+
)
56+
@RequestMapping(
57+
method = [RequestMethod.GET],
58+
value = [PATH_ITEMS_ITEM_ID_GET /* "/items/{item\$Id}" */],
59+
produces = ["application/json"]
60+
)
61+
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?,
64+
@ApiParam(hidden = true) exchange: org.springframework.web.server.ServerWebExchange
65+
): ResponseEntity<ItemsItemIdGet200Response> {
66+
return getDelegate().itemsItemIdGet(itemDollarId, filterDollarType, exchange)
67+
}
68+
69+
companion object {
70+
//for your own safety never directly reuse these path definitions in tests
71+
const val PATH_ITEMS_ITEM_ID_GET: String = "/items/{item$Id}"
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.openapitools.api
2+
3+
import org.springframework.stereotype.Controller
4+
import org.springframework.web.bind.annotation.RequestMapping
5+
import java.util.Optional
6+
import org.openapitools.api.ItemsApiController.Companion.BASE_PATH
7+
8+
@javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"], comments = "Generator version: 7.18.0-SNAPSHOT")
9+
@Controller
10+
@RequestMapping("\${openapi.openAPIPetstore.base-path:\${api.base-path:$BASE_PATH}}")
11+
class ItemsApiController(
12+
private val delegate: ItemsApiDelegate
13+
) : ItemsApi {
14+
15+
override fun getDelegate(): ItemsApiDelegate = delegate
16+
17+
companion object {
18+
//for your own safety never directly reuse these path definitions in tests
19+
const val BASE_PATH: String = "/v2"
20+
}
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package org.openapitools.api
2+
3+
import org.openapitools.model.ItemsItemIdGet200Response
4+
import org.springframework.http.HttpStatus
5+
import org.springframework.http.MediaType
6+
import org.springframework.http.ResponseEntity
7+
import org.springframework.web.context.request.NativeWebRequest
8+
import kotlinx.coroutines.flow.Flow
9+
10+
import java.util.Optional
11+
12+
/**
13+
* A delegate to be called by the {@link ItemsApiController}}.
14+
* Implement this interface with a {@link org.springframework.stereotype.Service} annotated class.
15+
*/
16+
@javax.annotation.Generated(value = ["org.openapitools.codegen.languages.KotlinSpringServerCodegen"], comments = "Generator version: 7.18.0-SNAPSHOT")
17+
interface ItemsApiDelegate {
18+
19+
fun getRequest(): Optional<NativeWebRequest> = Optional.empty()
20+
21+
/**
22+
* @see ItemsApi#itemsItemIdGet
23+
*/
24+
suspend fun itemsItemIdGet(itemDollarId: kotlin.String,
25+
filterDollarType: kotlin.String?,
26+
exchange: org.springframework.web.server.ServerWebExchange): ResponseEntity<ItemsItemIdGet200Response>
27+
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.openapitools.model
2+
3+
import java.util.Locale
4+
import java.util.Objects
5+
import com.fasterxml.jackson.annotation.JsonProperty
6+
import java.io.Serializable
7+
import javax.validation.constraints.DecimalMax
8+
import javax.validation.constraints.DecimalMin
9+
import javax.validation.constraints.Email
10+
import javax.validation.constraints.Max
11+
import javax.validation.constraints.Min
12+
import javax.validation.constraints.NotNull
13+
import javax.validation.constraints.Pattern
14+
import javax.validation.constraints.Size
15+
import javax.validation.Valid
16+
import io.swagger.annotations.ApiModelProperty
17+
18+
/**
19+
* A schema demonstrating $usage in properties.
20+
* @param dollarId $ID property
21+
* @param dollarName $Name property
22+
*/
23+
data class ItemWithDollarAttributesAndExamples(
24+
25+
@ApiModelProperty(example = "\$item123", value = "\$ID property")
26+
@get:JsonProperty("$id") val dollarId: kotlin.String? = null,
27+
28+
@ApiModelProperty(example = "\$ItemName", value = "\$Name property")
29+
@get:JsonProperty("$name") val dollarName: kotlin.String? = null
30+
) : Serializable {
31+
32+
companion object {
33+
private const val serialVersionUID: kotlin.Long = 1
34+
}
35+
}
36+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package org.openapitools.model
2+
3+
import java.util.Locale
4+
import java.util.Objects
5+
import com.fasterxml.jackson.annotation.JsonProperty
6+
import org.openapitools.model.ItemsItemIdGet200ResponseDetailsInfo
7+
import java.io.Serializable
8+
import javax.validation.constraints.DecimalMax
9+
import javax.validation.constraints.DecimalMin
10+
import javax.validation.constraints.Email
11+
import javax.validation.constraints.Max
12+
import javax.validation.constraints.Min
13+
import javax.validation.constraints.NotNull
14+
import javax.validation.constraints.Pattern
15+
import javax.validation.constraints.Size
16+
import javax.validation.Valid
17+
import io.swagger.annotations.ApiModelProperty
18+
19+
/**
20+
*
21+
* @param itemDollarId The $ID of the item.
22+
* @param nameDollarValue The $name of the item.
23+
* @param detailsDollarInfo
24+
*/
25+
data class ItemsItemIdGet200Response(
26+
27+
@ApiModelProperty(example = "item\$123", value = "The \$ID of the item.")
28+
@get:JsonProperty("item$Id") val itemDollarId: kotlin.String? = null,
29+
30+
@ApiModelProperty(example = "Item\$Name", value = "The \$name of the item.")
31+
@get:JsonProperty("name$Value") val nameDollarValue: kotlin.String? = null,
32+
33+
@field:Valid
34+
@ApiModelProperty(example = "null", value = "")
35+
@get:JsonProperty("details$Info") val detailsDollarInfo: ItemsItemIdGet200ResponseDetailsInfo? = null
36+
) : Serializable {
37+
38+
companion object {
39+
private const val serialVersionUID: kotlin.Long = 1
40+
}
41+
}
42+

0 commit comments

Comments
 (0)