Closed MattIPv4 closed 1 year ago
This is something I've been working into version 2 and I can look into what it would take to add it to the current version.
I think the best way to do this for a specific instance would be to include an extension property that defines the error to skip. So if you added a property like x-enforcer-skip-codes: EDEV001
to the OpenAPI document itself next to where the error occurs. What do you think, does it make sense to do it that way or do you maybe have another idea of how it could work?
Yah, adding a custom property at the right point makes sense to me (similar to linting disable comments for a lot of other linters).
The only other alternative I had thought about was providing a string path to the property in the config (similar to how the error gets output), but that seems fragile for you to process.
I've added this functionality to version 1.22.0
and I've published it to npm.
To use it, find the component that the error is part of (in your case the path item object) and add the extension x-enforcer-exception-skip-codes: EDEV001
. You can specify multiple codes by separating them with a space.
Enjoy!
Thank you very much, working perfectly 💙
👋 I'm wondering if it'd be possible to specify an exception code to be skipped in one specific instance?
For my specific case, I'm defining
requestBody
on aDELETE
endpoint (which the HTTP spec does permit, but OAS does not), and as such, I'd like to skipEDEV001
for this one specific instance but I don't want to ignore all invalid properties throughout the entire spec.