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

Support for $ref part 2 #12

Open
JordiPolo opened this issue May 15, 2017 · 4 comments
Open

Support for $ref part 2 #12

JordiPolo opened this issue May 15, 2017 · 4 comments

Comments

@JordiPolo
Copy link
Contributor

Support for $ref as text was added before. But ideally these $ref are deserialized into pointers to other structs or something like that.
The deserialization should fail if the ref does not point to any known point.
To validate if a ref exist in the doc I'm doing this really really terrible code:
https://github.com/JordiPolo/oatool/blob/master/src/main.rs#L26

If real support is added, then all this code disappears as a non-proper ref would cause deserialization error.

@matusf
Copy link

matusf commented Feb 25, 2021

Hello @softprops, thanks for this crate. I'd like to ask whether there is a plan to support the deserialization of $ref to the corresponding struct (or reference to it) rather than to the struct containing the reference string? I'd would be super useful. Anyway, thanks for great work.

@JordiPolo
Copy link
Contributor Author

@matusf I think I've implemented what you ask for https://github.com/JordiPolo/oas_proxy/blob/master/openapi_utils/src/dereferer.rs#L12-L31
It is published as the openapi_utils crate.
It works well with the openapi files from the company I work for but we use a linter so our files all follow a specific pattern, I will not be surprised if this is not able to work for every file out there.

If @softprops would like this functionality in his library, I'm happy to open a PR with what I have and take it from there

@matusf
Copy link

matusf commented Feb 25, 2021

Thank you so much! It's exactly what I hoped for :)

@softprops
Copy link
Owner

That would be great

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

No branches or pull requests

3 participants