Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #6019
Closed
Open
Issue created Apr 22, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG] swagger parser failed to resolve complex external references

Created by: 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 https://github.com/OpenAPITools/openapi-generator/pull/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?

Assignee
Assign to
Time tracking