OpenAPITools / OpenAPITools/openapi-generator
[BUG] [Java] Escaped bean property name should be resumed
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
xref: https://github.com/kubernetes-client/java/pull/595
in the kubernetes openapi spec, there's some escaped property name in the schema:
"io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1beta1.JSONSchemaProps": {
"description": "JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/).",
"properties": {
"$ref": {
"type": "string"
},
"$schema": {
"type": "string"
}
....
the generator doesn't seem to properly handle the name and my java output is failing the compiliation:
@ApiModel(description = "JSONSchemaProps is a JSON-Schema following Specification Draft 4 (http://json-schema.org/).")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2019-06-20T12:55:05.588Z[Etc/UTC]")
public class V1beta1JSONSchemaProps {
public static final String SERIALIZED_NAME_$_REF = "$ref";
@SerializedName(SERIALIZED_NAME_$_REF)
private String $ref;
public static final String SERIALIZED_NAME_$_SCHEMA = "$schema";
@SerializedName(SERIALIZED_NAME_$_SCHEMA)
private String $schema;
openapi-generator version
v4.0.0
OpenAPI declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix
it seems that in the swagger-codegen we won't have the issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Java generation from the Kubernetes OpenAPI schema containing the $ref and $schema properties, then compare the generated V1beta1JSONSchemaProps.java output with the linked swagger-codegen version. Done means the generated Java compiles and the escaped property names remain mapped to their schema names.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100