Skip to content

[BUG][Java] Empty looking object is generated for anyOf type #6485

@H21lab

Description

@H21lab

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

While generating the TS29573_N32_Handshake.yaml to create java client, the java class SecurityCapability is generated with no relevant methods and it looks empty (there are no method to be able to passing values inside). However in yaml file the object is defined in the following way:

    SecurityCapability:
      anyOf:
        - type: string
          enum:
            - TLS
            - PRINS
        - type: string
openapi-generator version

5.0.0-SNAPSHOT

OpenAPI declaration file content or url

https://github.com/jdegre/5GC_APIs/blob/master/TS29573_N32_Handshake.yaml

Command line used for generation

Generated by openapi-generator-maven-plugin by using following options:

	<plugins>
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>5.0.0-SNAPSHOT</version>
                
                <configuration>
                    <generatorName>java</generatorName>
                    <output>${project.build.directory}/generated-sources</output>
                    <configOptions>
                    </configOptions>
               </configuration>
               
               <executions>
                   <execution>
                        <id>65</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>                      
                            <inputSpec>${project.basedir}/src/main/resources/TS29573_N32_Handshake.yaml</inputSpec>
                            <modelPackage>com.h21lab.TS29573_N32_Handshake.handler</modelPackage>
                            <apiPackage>com.h21lab.TS29573_N32_Handshake.model</apiPackage>
                            <invokerPackage>com.h21lab.TS29573_N32_Handshake.handler</invokerPackage>
                        </configuration>
                    </execution>
           	</executions>
            </plugin>
    	<plugins>
Steps to reproduce

Generator will produce the following class with no relevant methods or variables:

/*
 * N32 Handshake API
 * N32-c Handshake Service.  © 2020, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).  All rights reserved. 
 *
 * The version of the OpenAPI document: 1.1.0.alpha-3
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


package com.h21lab.TS29573_N32_Handshake.handler;

import java.util.Objects;
import java.util.Arrays;

/**
 * SecurityCapability
 */
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-05-29T11:08:32.406367+02:00[Europe/Vienna]")
public class SecurityCapability {

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    return true;
  }

  @Override
  public int hashCode() {
    return Objects.hash();
  }


  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class SecurityCapability {\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}


Related issues/PRs
Suggest a fix

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