swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

Support programmatic use cases

Open jimshowalter opened this issue 4 years ago • 1 comments

We run Swagger codegen in our builds, programmatically, from a custom Gradle plugin that calls SwaggerCodegen.main, passing String[] args as if we're sitting there in front of a command line typing.

This doesn't seem to be an expected use case, because messages are accumulated by the parser, and reported by the parser, but it doesn't throw an exception at the end.

We tried replacing the logger with one that would capture, but some kind of conflict between Gradle and logback prevented that (unable to cast listener).

We would very much like to be able to pass a flag into the parser that would cause it to throw if there are messages. It could wait until the end, in order to collect as many errors as possible before failing.

Related: https://github.com/swagger-api/swagger-parser/issues/1396 Related: https://github.com/swagger-api/swagger-ui/issues/2418

jimshowalter avatar Jan 14 '21 00:01 jimshowalter

Any thoughts on this?

jimshowalter avatar Feb 14 '21 19:02 jimshowalter