-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
If you have a path with a dollar sign when using the kotlin-spring generator it does not get escaped correctly and thinks it is a Kotlin string template causing compile failures. I must use a dollar sign as it is something I am being told to use and do not have an option to change it.
openapi-generator version
6.6.0
OpenAPI declaration file content or url
openapi: 3.0.2
info:
title: Customer API
version: 1.0.0
paths:
/customer/$search:
post:
summary: Search for a customer
requestBody:
description: Find a customer
content:
application/json:
schema:
$ref: '#/components/schemas/Customer'
required: true
responses:
'200':
description: Successful operation
components:
schemas:
Customer:
type: object
properties:
id:
type: integer
format: int64
example: 100000
ssn:
type : string
maxLength : 11
pattern : '^\d{3}-\d{2}-\d{4}$'
description : SSN of the customer
example : 999-99-9999Generation Details
@RequestMapping("\${api.base-path:}")
interface CustomerApi {
@Operation(
summary = "Search for a customer",
operationId = "customerSearchPost",
description = """""",
responses = [
ApiResponse(responseCode = "200", description = "Successful operation")
]
)
@RequestMapping(
method = [RequestMethod.POST],
value = ["/customer/$search"],
consumes = ["application/json"]
)
fun customerSearchPost(@Parameter(description = "Find a customer", required = true) @Valid @RequestBody customer: Customer): ResponseEntity<Unit>Steps to reproduce
- Run
mvn clean compile - The code cannot compile and an error is thrown stating
Only 'const val' can be used in constant expressions- This is because of line
value = ["/customer/$search"],inside of the @RequestMapping the$searchis not escaped and$holds a special meaning in Kotlin
- This is because of line
Related issues/PRs
Not exactly the same but similar
Suggest a fix
Unsure where this is is happening to provide a suggestion to fix.
Reactions are currently unavailable