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

External references don't work #1205

Open
ruckc opened this issue Mar 26, 2024 · 2 comments
Open

External references don't work #1205

ruckc opened this issue Mar 26, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ruckc
Copy link

ruckc commented Mar 26, 2024

What version of ogen are you using?

1.0.0

Can this issue be reproduced with the latest version?

Yes

What did you do?

I have an openapi.yaml with a reference to another file.

What did you expect to see?

I expected the $ref to resolve the reference to the external file.

What did you see instead?

  - openapi.yaml:104:13 -> $ref: resolve "./type.json": get "file:///home/user/project/type.json": external references are disabled

What I did after getting the error...

I grepped the ogen source, found the error being raised in openapi/parser/settings.go from the NoExternal ExternalResolver implementation.

I can not figure out how to pass that in to ogen. I tried a config.yaml that looked like the below, based on the example configs and the exampes showing infer_types and depth_limit.

It would be nice if it was documented how to set the external resoler.

parser:
  external: true
@ruckc ruckc added the bug Something isn't working label Mar 26, 2024
@shadowspore
Copy link
Member

Here's full config example.
allow_remote is what you need.

# sets parser options.
parser:
# enables type inference for schemas. Schema parser will try to detect schema type by its properties.
infer_types: true
# enables remote references resolving. See https://github.com/ogen-go/ogen/issues/385.
allow_remote: true
# is maximum depth of schema generation. Default is 1000.
depth_limit: 1000

@ruckc
Copy link
Author

ruckc commented Mar 27, 2024

ok... that would be a naming inconsistency... I saw allow_remote, but it didn't align to anything in settings.go... and the description (enables remote references) doesn't describe the error (external references are disabled)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants