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

Add a better error message for invalid 'resources' #305

Closed
wants to merge 1 commit into from

Conversation

Altai-man
Copy link

When 'resources' field has something other than `Str` to safely match
against, e.g. a Pair, it threw with `Invocant of method 'match' must
be a type object of type 'Any', not an object instance of type
'Pair'.`, which is not helpful.  Here we explicitly check for each
resource item to be a Str and provide an error message that is easier
to understand.
@ugexe
Copy link
Owner

ugexe commented Jun 8, 2019

fwiw I don’t put META6 validation inside of zef. zef is not an authoring tool and thus not intended to catch authoring issues. If I were to handle these issues it would require a full blown META validation module, and at that point might as well supersede both Test::META and Mi6. The only way I’d probably add this type of thing to zef is if Rakudo/CUR end up creating a META6 validator... because remember one can install modules without zef (and will get just as poor error messages).

See: #251 (comment)

@Altai-man
Copy link
Author

I see, the issue is more complex than it seem at first, thanks.

I am withdrawing the PR and will look at validation modules specified. Sorry for the time taken.

@Altai-man Altai-man closed this Jun 8, 2019
@ugexe
Copy link
Owner

ugexe commented Jun 8, 2019

Note that an OpenAPI::Schema could be a good way of an ecosystem publicizing and validating a given META6 format. As a super basic example: https://github.com/ugexe/Perl6-App--Zef--WebAPI/blob/1a2d95ea24c19d293ed29e123b2d73bb2e68b53b/resources/openapi.json#L352-L359

This is nice because it acts as documentation for the format as well as validating it on the ecosystem side.

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

Successfully merging this pull request may close these issues.

None yet

2 participants