Found part of my answer.
//syntax check the specification
//SwaggerDeserializationResult res = new
SwaggerParser().readWithInfo(out.toString()); // supports swagger 2
SwaggerParseResult res = new OpenAPIV3Parser().readContents(out.toString(),
null, null); //supports openapi3 and requires swagger-parser 2.0
//System.out.println(res.getMessages().toString());
System.out.println(res.getMessages().size() + " Errors");
for (String msg : res.getMessages()) {
System.out.println(msg);
}
On Friday, March 2, 2018 at 10:40:24 AM UTC-6, Heather Gulledge wrote:
>
> I'm looking for a way to validate that a swagger/openapi3 interface
> specification is syntactically correct. What I am wanting to do is have a
> pre-commit git hook script that ensures any interface checked into our
> repository is clean. Java or python would be preferable. I know I can do
> this interactively with swagger ui, but I'm looking for a way to do it as a
> background process. If it fails I would like to be able to capture the
> errors to kick back to the submitter. If it passes I would ideally like to
> generate the html documentation similar to what swagger ui creates so that
> can be put in the repository and pushed out to where it is hosted.
>
> I see lots of efforts to validate incoming json payloads against a swagger
> specification, but that is not what I'm looking for here.
>
> Any suggestions would be appreciated.
>
> Heather
>
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.