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

Remote references for schema not working #1613

Closed
ricker-flow opened this issue Jul 2, 2024 · 5 comments · Fixed by #1738
Closed

Remote references for schema not working #1613

ricker-flow opened this issue Jul 2, 2024 · 5 comments · Fixed by #1738

Comments

@ricker-flow
Copy link

ricker-flow commented Jul 2, 2024

Expected Behavior

OpenAPI supports remote references for schema. Instead of reference components inside the document $ref: '#/components/schema/Foo' it can refer to a external files such as $ref: '../folder/foo.json'. See https://swagger.io/docs/specification/using-ref/

Actual Behaviour

Using a remote reference returns an error Failed to get the schema name:

Steps To Reproduce

  1. Create a OpenAPI yaml file with a remote reference for a schema
  2. Run the Micronaut OpenApi Gradle plugin

Environment Information

  • Mac
  • Kotlin
  • Micronaut OpenAPI 4.4.0

Example Application

https://github.com/ricker-flow/openapi-demo

Version

4.4.0

@altro3
Copy link
Collaborator

altro3 commented Jul 3, 2024

Yes, it's true. Currently we support only one file specifications.

Please add an example of using this feature, then I can solve this problem faster.

Did I understand correctly that you have a specification in several files and are trying to use openapi generator?

@ricker-flow
Copy link
Author

I have the schema of the object separate from the API YAML. I created an example https://github.com/ricker-flow/openapi-demo

@altro3
Copy link
Collaborator

altro3 commented Jul 4, 2024

So, the problem is that openapi-generator itself does not support such schema descriptions. So if you want this feature to be added, then create a ticket here: https://github.com/OpenAPITools/openapi-generator

@ricker-flow
Copy link
Author

Seems it has been an open issue for 6 years OpenAPITools/openapi-generator#1123

@altro3 altro3 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 4, 2024
@altro3 altro3 reopened this Aug 28, 2024
@altro3
Copy link
Collaborator

altro3 commented Aug 28, 2024

@ricker-flow Sorry, that was my mistake. openapi-generator supported multiple files specifications. Problem fixed here: #1738

I tested this fix also with your sample - all works fine, but in your sample was mistke in bookinfo.json file - wrong place for required block.

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

Successfully merging a pull request may close this issue.

2 participants