Skip to content

[BUG] swagger parser failed to resolve complex external references #6019

@yilinjuang

Description

@yilinjuang

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
openapi-generator version

4.3.1 from latest master

OpenAPI declaration file content or url

test.yaml

openapi: 3.0.2
info:
  title: Test
  version: 0.1.0
servers:
  - url: http://localhost
paths:
  /tags:
    $ref: "paths/tag.yaml#/~1tags"

paths/tag.yaml

/tags:
  get:
    summary: get tags
    operationId: GetTags
    parameters:
      - name: type
        in: query
        description: type of tag
        schema:
          $ref: "../components/misc.yaml#/TagType"
        required: true
    responses:
      200:
        description: successful operation
        content:
          application/json:
            schema:
              $ref: "../components/misc.yaml#/Tag"

components/misc.yaml

Tag:
  type: object
  properties:
    test:
      $ref: "#/TagType"
TagType:
  type: string
  enum:
    - school
Command line used for generation

default option. any language. An example is

openapi-generator generate -g aspnetcore -i ./test.yaml
Steps to reproduce

generate throws warning

[main] WARN  i.s.v.p.p.ExternalRefProcessor - A model for class StringSchema {
    class Schema {
        type: string
        format: null
        $ref: null
        description: null
        title: null
        multipleOf: null
        maximum: null
        exclusiveMaximum: null
        minimum: null
        exclusiveMinimum: null
        maxLength: null
        minLength: null
        pattern: null
        maxItems: null
        minItems: null
        uniqueItems: null
        maxProperties: null
        minProperties: null
        required: null
        not: null
        properties: null
        additionalProperties: null
        nullable: null
        readOnly: null
        writeOnly: null
        example: null
        externalDocs: null
        deprecated: null
        discriminator: null
        xml: null
    }
} already exists
Related issues/PRs

Might be related to #5413

Suggest a fix

Want to first make sure it's not other bugs causing this. Then I'll file an issue to swagger parser. In the meantime, maybe we want to downgrade parser to 2.0.17?

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