Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] RELATIVE refs could not be loaded #9991

Open
5 tasks done
SimeonGerginov opened this issue Jul 20, 2021 · 5 comments
Open
5 tasks done

[BUG] RELATIVE refs could not be loaded #9991

SimeonGerginov opened this issue Jul 20, 2021 · 5 comments

Comments

@SimeonGerginov
Copy link
Contributor

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

After the latest version of the OpenAPI Generator was released: 5.2.0, a new bug was introduced regarding relative $refs: during generation the following error occurs:

[main] WARN  io.swagger.v3.parser.OpenAPIV3Parser - Exception while resolving:
java.lang.RuntimeException: Unable to load RELATIVE ref: ./specs/my_spec.yaml path: /specs/spec_path

This behaviour is only seen in the latest released version, previously it was working correctly. I've looked through the CHANGELOG document but couldn't find an entry that could have introduced this problem.

openapi-generator version

5.2.0

OpenAPI declaration file content or url
openapi: 3.0.0
info:
  title: MyExampleSpec
  description: >-
paths: {}
components:
  schemas:
    MyExampleSchema:
      description: >-
      properties:
        id:
          description: The id of MyExampleSchema.
          type: string
        message:
          description: The message of MyExampleSchema.
          $ref: ../specs/MySchemas.yaml#/components/schemas/Message
Generation Details
Steps to reproduce
  1. Build the OpenAPI Generator.
  2. Run one of the generators ( I've tested it with PowerShell and Python) with the provided yaml using the following command:
java openapi-generator-cli-5.2.0.jar generate -g powershell -i "myOpenAPISpec.yaml" --global-property
  1. Observe the errors that occur which should match the mentioned error message above.
Related issues/PRs

none

Suggest a fix

Currently no fix suggestion can be provided. I'll try to find the root cause of the issue and then think about what kind of fix can be added.

@SimeonGerginov
Copy link
Contributor Author

I was able to track this bug to this Pull Request. v2.0.26 of the swagger-parser causes this. I've tried with the previous version v2.0.25 and everything works as expected. So the problem is present in v2.0.26 and above as with the latest released version, this is still not fixed.

@wing328 do you have a process when an issue with a bumped dependency occurs ? Do you revert back to the latest working version or you provide a fix in the dependency package ?

@ydmitry
Copy link

ydmitry commented Aug 29, 2021

Any news on this issue?

@gbaah
Copy link

gbaah commented Sep 13, 2021

I am hitting this issue. Has a fix been provided?

@equalspeterd
Copy link

equalspeterd commented Jul 13, 2022

It appears the underlying framework has addressed this issue: swagger-api/swagger-parser#1557

Has the lib dependency in this project been updated?

@graham2071
Copy link

Correct, checked with openapitools-generator 6.0.0 and it's resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants