title: Why does openapi-generator use imports that do not exist
body: <p>I am using <code>openapi-codegen version 4.2.2</code> and <code>openapi specification 3.0.0</code> to generate a java server API from a yaml file like this:</p>
  
  <p><code>openapi-generator generate -i test.yaml -g spring -o /tmp/springTest</code></p>
  
  <p>The problem I encounter is, that the generated code tries to import a class that does not exist. The API should accept an object of type pet and return the same pet. A Pet should be a Cat, Dog, or Lizard. I used the inheritence example from the openapi specification and build the following yaml file from it:</p>
  
  <pre><code>openapi: 3.0.0
  info:
    version: 1.0.0
    title: Three Pets
    termsOfService: http://swagger.io/terms
  tags:
    - name: test
  paths:
    /echoPet:
      post:
        tags:
          - test
        summary: Return input
        description: Send pet get pet
        operationId: echoPet
        parameters:
          - name: pet
            in: query
            schema:
              oneOf:
                - $ref: '#/components/schemas/Cat'
                - $ref: '#/components/schemas/Dog'
                - $ref: '#/components/schemas/Lizard'
        responses:
          "200":
            description: Pet sucesfully returned
            content:
              application/json:
                  schema:
                    oneOf:
                      - $ref: '#/components/schemas/Pet'
  servers:
    - url: https://localhost:8080/v2
    - url: http://localhost:8080/v2
  components:
    schemas:
      Pet:
        type: object
        required:
        - pet_type
        properties:
          pet_type:
            type: string
        discriminator:
          propertyName: pet_type
          mapping:
            cachorro: Dog
      Cat:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Cat`
          properties:
            name:
              type: string
            huntingSkill:
              type: string
              description: The measured skill for hunting
              enum:
              - clueless
              - lazy
              - adventurous
              - aggressive
      Dog:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Dog`
          properties:
            bark:
              type: string
            packSize:
              type: integer
              format: int32
              description: the size of the pack the dog is from
              default: 0
              minimum: 0
      Lizard:
        allOf:
        - $ref: '#/components/schemas/Pet'
        - type: object
          # all other properties specific to a `Lizard`
          properties:
            lovesRocks:
              type: boolean
  </code></pre>
  
  <p><a href="https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#discriminator-object" rel="noreferrer">https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#discriminator-object</a></p>
  
  <p>As far as I understand it, it should generate an API that acceps oneOf the following types Cat,Dog,Lizard. (If I use Pet here, the validation says, Pet is not of type object)
  The generated EchoPetApi.java uses imports for:</p>
  
  <pre><code>import org.openapitools.model.OneOfCatDogLizard;
  import org.openapitools.model.OneOfPet;
  </code></pre>
  
  <p>But these classes do not exist, which will make the code not compilable. All I have in the org.openapitools.model package is:</p>
  
  <pre><code>Cat.java
  CatAllOf.java
  Dog.java
  DogAllOf.java
  Lizard.java
  LizardAllOf.java
  Pet.java
  </code></pre>
  
  <p>Here the Cat, Dog and Lizard.java look as expected and all extend Pet.java, but CatAllOf, DogAllOf and LizardAllOf do not extend anything but only have properties from the respective class and a slightly different hashCode() method.</p>
  
  <p>Here is the EchoPetApi.java with the not existing imports(first two, after the package):</p>
  
  <pre><code>/**
   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (4.2.2).
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  package org.openapitools.api;
  
  import org.openapitools.model.OneOfCatDogLizard;
  import org.openapitools.model.OneOfPet;
  import io.swagger.annotations.*;
  import org.springframework.http.HttpStatus;
  import org.springframework.http.MediaType;
  import org.springframework.http.ResponseEntity;
  import org.springframework.validation.annotation.Validated;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.RequestHeader;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RequestParam;
  import org.springframework.web.bind.annotation.RequestPart;
  import org.springframework.web.context.request.NativeWebRequest;
  import org.springframework.web.multipart.MultipartFile;
  
  import javax.validation.Valid;
  import javax.validation.constraints.*;
  import java.util.List;
  import java.util.Map;
  import java.util.Optional;
  @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-12-18T11:27:04.474+01:00[Europe/Berlin]")
  
  @Validated
  @Api(value = "echoPet", description = "the echoPet API")
  public interface EchoPetApi {
  
      default Optional&lt;NativeWebRequest&gt; getRequest() {
          return Optional.empty();
      }
  
      @ApiOperation(value = "Return input", nickname = "echoPet", notes = "Send pet get pet", response = OneOfPet.class, tags={ "test", })
      @ApiResponses(value = { 
          @ApiResponse(code = 200, message = "Pet sucesfully returned", response = OneOfPet.class) })
      @RequestMapping(value = "/echoPet",
          produces = { "application/json" }, 
          method = RequestMethod.POST)
      default ResponseEntity&lt;OneOfPet&gt; echoPet(@ApiParam(value = "", defaultValue = "null") @Valid OneOfCatDogLizard pet) {
          return new ResponseEntity&lt;&gt;(HttpStatus.NOT_IMPLEMENTED);
  
      }
  
  }
  </code></pre>
  
  <p>If I use the validate function from openapi-codegen it does not return any errors:</p>
  
  <pre><code>$ openapi-generator validate -i test.yaml
  Validating spec (test.yaml)
  No validation issues detected.
  </code></pre>