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

Decorate using custom parser #610

Open
ErikEngerd opened this issue Jan 4, 2025 · 0 comments
Open

Decorate using custom parser #610

ErikEngerd opened this issue Jan 4, 2025 · 0 comments

Comments

@ErikEngerd
Copy link

ErikEngerd commented Jan 4, 2025

Is your feature request related to a problem? Please describe.

In my application I am parsing a yaml file and after it has been succesfully parsed, I am doing additional validation checks. For these checks I would like source line to be available so I can give error messages referring to the original source line.

Describe the solution you'd like

I was hoping to be able to use a custom unmarshaller in combination with a wrapper of a Reader that keeps track of source line and position. That way I can add this info to the objects that are parsed from yaml.

In order to be able to do this. I want to decorate the original unmarshaller, but I have no clue on how to invoke the original marshaller from my custom marshaller.

I can imagine that doing this in a naive way would cause recursion: marshaller invokes custom marshaller which invokes marshaller .... However, I think support for decorators as part of the API would be really beneficial.

If it is already possible using the current API then that would also be fine.

Describe alternatives you've considered

Additional context

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

No branches or pull requests

1 participant