-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Open
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
The given schema component with a special character in a property name.
(Example: "Group" schema from SCIM)
Using the kotlin server generator with jackson serializer generates invalid code
data class BaseGroupMembersInner (
/* The `id` of the member. Each value MUST be the `id` of the corresponding `User` resource, which is unique across the service provider's entire set of resources. */
@JsonProperty("value")
val `value`: java.util.UUID,
/* The URI of the corresponding `User` resource. Nullable for requests but required for responses. */
@JsonProperty("$ref")
val dollarRef: kotlin.String? = null
)It should escape the special character ($)
@JsonProperty("\$ref")
openapi-generator version
7.11.0
OpenAPI declaration file content or url
openapi: 3.1.0
info:
version: 5.0.5
title: Internal Users SCIM
description: ...
tags:
- name: Groups
description: ...
paths:
/v3/internal/scim/Groups/{id}:
get:
summary: 'Get group by id'
description: ...
externalDocs:
url: 'https://datatracker.ietf.org/doc/html/rfc7644#section-3.2'
description: 'RFC 7644, Section 3.2'
operationId: getGroup
tags:
- Groups
parameters:
- $ref: '#/components/parameters/GroupIdInPath'
responses:
'200':
description: Successful response
content:
application/scim+json:
schema:
$ref: '#/components/schemas/Group'
application/json:
schema:
$ref: '#/components/schemas/Group'
components:
parameters:
GroupIdInPath:
name: id
in: path
description: |
The unique identifier of a group
required: true
schema:
type: string
format: uuid
schemas:
Meta:
type: object
description: ...
externalDocs:
url: 'https://datatracker.ietf.org/doc/html/rfc7643#section-3.1'
description: 'RFC 7643, Section 3.1'
properties:
resourceType:
type: string
description: ...
examples:
- 'ResourceType'
created:
type: string
format: date-time
description: ...
examples:
- '2024-07-21T17:32:28Z'
lastModified:
type: string
format: date-time
description: ...
location:
type: string
description: ...
version:
type: string
description: ...
BaseGroup:
type: object
description: ...
externalDocs:
url: 'https://datatracker.ietf.org/doc/html/rfc7643#section-4'
description: 'RFC 7643, Section 4'
required:
- members
properties:
members:
type: array
description: ...
items:
type: object
required:
- value
properties:
value:
type: string
format: uuid
description: ...
$ref:
type:
- "string"
- "null"
description: ...
default: [ ] # default is for `PUT` request
Group:
type: object
description: ...
externalDocs:
url: 'https://datatracker.ietf.org/doc/html/rfc7643#section-4'
description: 'RFC 7643, Section 4'
required:
- schemas
- id
- displayName
- members
allOf:
- type: object
properties:
schemas:
type: array
description: ...
items:
type: string
id:
type: string
format: uuid
readOnly: true
description: ...
displayName:
type: string
readOnly: true
description: ...
- $ref: '#/components/schemas/BaseGroup'Generation Details
Gradle configuration
openApiGenerate {
generatorName = "kotlin-server"
inputSpec = "${rootProject.projectDir}/rest-application/src/main/resources/test-petstore-api.yml"
library.convention("jaxrs-spec")
outputDir.convention("${project.layout.buildDirectory.get()}/generated-rest/server/scim")
apiPackage.convention("com.toasttab.service.scim.api")
modelPackage.convention("com.toasttab.service.scim.models")
packageName.convention("com.toasttab.service.scim")
additionalProperties.convention(
mapOf(
"collectionType" to "list",
"enumPropertyNaming" to "UPPERCASE",
"dateLibrary" to "java8",
"interfaceOnly" to "true",
"returnResponse" to "true"
)
)
}Steps to reproduce
- Define a schema wit a property name of
$ref - Configure opernapi generator with
generatorName = "kotlin-server"ANDlibrary.convention("jaxrs-spec") - Attempt to generate server side code