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

On combining different resolver types #19

Closed
pplu opened this issue May 27, 2019 · 2 comments
Closed

On combining different resolver types #19

pplu opened this issue May 27, 2019 · 2 comments

Comments

@pplu
Copy link
Contributor

pplu commented May 27, 2019

When implementing a "catchall" resolver in https://github.com/pplu/cfn-perl/tree/feature/yaml_support, I found out that combining some resolvers has unexpected behaviour:

$schema->add_sequence_resolver(tag => '!X', ...);
$schema->add_sequence_resolver(tag => qr/^!.*/, ...);

I was expecting the !X to be processed by the first resolver, when in fact, it gets processed always by the last one. I was adding specific resolvers for each tag, and wanted a "catchall" resolver for dying when an unsupported tag was found.

I just wanted you to notice this as feedback, since I think not many people are using these APIs.

I don't need this as a feature, since I've moved the code to only having one resolver for each type (scalar, sequence, mapping), and dispatching depending on the tag detected (https://github.com/pplu/cfn-perl/blob/3aeef4fc0d957e77a5defc7835b784cf2501f3cd/lib/Cfn/YAML/Schema.pm#L51)

@perlpunk
Copy link
Owner

Yes, you're right, the order of the resolvers was wrong.
Fixed in 6e95b6b, thanks!

@perlpunk
Copy link
Owner

perlpunk commented Jul 8, 2019

Fixed in v0.017 :)

@perlpunk perlpunk closed this as completed Jul 8, 2019
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

2 participants