Skip to content

[BUG] [Java] Escaped bean property name should be resumed #3191

@yue9944882

Description

@yue9944882
Description

xref: kubernetes-client/java#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.

https://github.com/kubernetes-client/java/blob/dc82549dde1eeea7593203dec788af0fe33685a7/kubernetes/src/main/java/io/kubernetes/client/models/V1beta1JSONSchemaProps.java#L38-L42

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions