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
Option to resolve $ref style references #217
Comments
Hi @jakobkmar, given this isn't a standard YAML feature, I'm not keen to add it to kaml. kaml does already support YAML's anchors and aliases feature, which you could use to achieve the same result. If you can't change the format of the file, I'd suggest either resolving the references in your application, or look at using a lower-level library like SnakeYAML. |
thank you for the quick reply
do you have a suggestion how this can be done? the problem in my case is that this |
You could deserialise into a polymorphic type that represents either a concrete value or a reference, then go through and resolve the references to the concrete values |
I will have a look into that, thank you! |
If the content (in my example) can be either this: parameters:
- in: query
name: index
schema:
type: string
enum:
- relevance
- downloads
- follows
- newest
- updated
default: relevance
example: downloads or this (with parameters:
- $ref: "#/components/parameters/ProjectIdentifier" then how could this be represented using polymorphism? |
Oh just read about content based polymorphic deserialization, thats what I need. From my side, this issue is resolved now! (However I have to convert to JSON, because this is a json only feature) |
Describe the problem you'd like to solve
I want to resolve references like this one.
The reference points to another node in the same file.
I don't know how I would do this with the normal kotlinx.serialization api, but for the yaml parser itself this should be possible.
Describe the solution you'd like
Could there be an option to enable that these references get resolved automatically?
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: