HttpRepl icon indicating copy to clipboard operation
HttpRepl copied to clipboard

Command to Validate OpenAPI Description?

Open tlmii opened this issue 5 years ago • 2 comments

With the work we're doing to move to using OpenApi.NET (#347), one of the benefits we get is the ability to validate the OpenAPI Description document.

I'm wondering if it might be useful to have a command that validates the document and writes out the errors, if any. Something like:

Disconnected> openapi validate https://localhost/api/openapi.json
Validating OpenAPI Description at https://localhost/api/openapi.json
Error: "XYZ is not a valid property of Path"
Error: "The info object is required."

We could also make the validation be a part of connecting, if we enable a more verbose mode for connect.

Most people will be using Swashbuckle or something like that to generate the description, so they should have a valid document. But if they're not, and they're seeing weird results within httprepl, this would be a helpful way to diagnose the problems.

tlmii avatar Aug 05 '20 18:08 tlmii

love this idea. i think it'd be best if it were a separate command that someone could run and as a configurable switch [defaulted to false] that someone could turn on. That way they could pre-validate any calls, or just use it to validate.

bradygaster avatar Oct 22 '20 08:10 bradygaster

We could also make the validation be a part of connecting, if we enable more verbose mode for connect

This part is done, so users have the ability to get validation results. We could still decide to make it a separate command. I could see this being used as part of a testing/validation script - several consecutive openapi validate [url] calls to ensure there are no errors.

tlmii avatar Dec 18 '20 07:12 tlmii