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

Feature Request: Pass filename to custom type construct callback #676

Open
urdeveloper opened this issue Jun 21, 2022 · 0 comments
Open

Comments

@urdeveloper
Copy link

It would be very useful if construct callback of a custom type also receives filename as third parameter, for example:

const jsSchema = new yaml.Type("!js", {
  resolve: (data) => data != undefined && data!=null,
  construct: (data, tag, filename) => {
    ...
  },
  represent: (content) => content.toString()
});

The following line seems to be the place to make the change (pass state.filename as third argument to type.construct):

state.result = type.construct(state.result, state.tag);

Please let me know If that's an acceptable change request. If so, I'll be more than happy to send a PR.

Cheers!

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

1 participant