apideck-libraries / better-ajv-errors

Human-friendly JSON Schema validation for APIs 👮‍♀️
MIT License
41 stars 6 forks source link

Support 'const' keyword #7

Closed thw0rted closed 2 years ago

thw0rted commented 2 years ago

I noticed that the const keyword passes through the allowedValue in error.params but that structure isn't included in the return value for the fall-through case with unsupported keywords. It might be nice to always include the raw params record, or at least include it in the fall-through case, but this is a pretty big change that would break all your existing tests. In the interim, I put together this quick PR to support const explicitly. build and test run correctly. I couldn't get lint working on my machine (version resolution conflicts for prettier, I think?) but I would expect the added code to lint correctly based on the rest of the codebase.

thw0rted commented 2 years ago

It seems to me that tsdx should include eslint-plugin-prettier as a direct dep, or at least a peerdep. I don't use tsdx, so if one of the maintainers here, who is more familiar with that project, decides I'm right about that, you could file an issue with them to fix their package metadata.

I assume this worked for everybody else because they had global installs of the relevant plugin, or because they were using yarn instead of vanilla npm.

elsmr commented 2 years ago

Released in v0.3.0 :tada: thanks again for your contribution!