openapi
openapi copied to clipboard
Support for $ref part 2
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.
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.
@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
Thank you so much! It's exactly what I hoped for :)
That would be great