swagger2markup-cli icon indicating copy to clipboard operation
swagger2markup-cli copied to clipboard

Simple API specs make swagger2markup crash

Open gganssauge opened this issue 8 years ago • 4 comments

I'm starting with a very simple API to build up my microservice toolchain.

One step of that toolchain is generation of markdown from the swagger spec for my API.

Swagger2Markup seems to be the best option to realize such a step.

Unfortunately Swagger2Markup crashes on my API:

(gotti@plattfisch 644) java -jar swagger2markup-cli-1.3.1.jar convert -i api.yaml -f fred.md
16:56:01.057 [main] INFO  io.swagger.parser.Swagger20Parser - reading from /home/gotti/source/aurora/git/microservices/server/aurora.microservice.usersettings/api/api.yaml
16:56:01.410 [main] DEBUG i.g.s.i.document.PathsDocument - Generate examples is disabled.
16:56:01.410 [main] DEBUG i.g.s.i.document.PathsDocument - Create separated operation files is disabled.
16:56:01.411 [main] DEBUG i.g.s.i.document.DefinitionsDocument - Create separated definition files is disabled.
16:56:01.594 [main] INFO  i.g.s.m.b.i.asciidoc.AsciiDocBuilder - Markup document written to: /home/gotti/source/aurora/git/microservices/server/aurora.microservice.usersettings/api/fred.md.adoc
16:56:01.684 [main] DEBUG i.g.s.i.document.PathsDocument - Operation processed : 'getUserConfig' (normalized id = 'getUserConfig')
16:56:01.714 [main] DEBUG i.g.s.i.document.PathsDocument - Operation processed : 'saveUserConfig' (normalized id = 'saveUserConfig')
16:56:01.732 [main] DEBUG i.g.s.i.document.PathsDocument - Operation processed : 'deleteUserConfig' (normalized id = 'deleteUserConfig')
16:56:01.733 [main] INFO  i.g.s.m.b.i.asciidoc.AsciiDocBuilder - Markup document written to: /home/gotti/source/aurora/git/microservices/server/aurora.microservice.usersettings/api/fred.md.adoc
16:56:01.733 [main] INFO  i.g.s.m.b.i.asciidoc.AsciiDocBuilder - Markup document written to: /home/gotti/source/aurora/git/microservices/server/aurora.microservice.usersettings/api/fred.md.adoc
Exception in thread "main" java.lang.IllegalArgumentException: cells must not be null
        at org.apache.commons.lang3.Validate.notEmpty(Validate.java:300)
        at io.github.swagger2markup.markup.builder.internal.asciidoc.AsciiDocBuilder.tableWithColumnSpecs(AsciiDocBuilder.java:213)
        at io.github.swagger2markup.internal.component.TableComponent.apply(TableComponent.java:66)
        at io.github.swagger2markup.internal.component.SecuritySchemeDefinitionComponent.buildSecurityScheme(SecuritySchemeDefinitionComponent.java:106)
        at io.github.swagger2markup.internal.component.SecuritySchemeDefinitionComponent.apply(SecuritySchemeDefinitionComponent.java:64)
        at io.github.swagger2markup.internal.document.SecurityDocument.lambda$buildSecuritySchemeDefinitionsSection$0(SecurityDocument.java:75)
        at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
        at io.github.swagger2markup.internal.document.SecurityDocument.buildSecuritySchemeDefinitionsSection(SecurityDocument.java:74)
        at io.github.swagger2markup.internal.document.SecurityDocument.apply(SecurityDocument.java:61)
        at io.github.swagger2markup.Swagger2MarkupConverter.applySecurityDocument(Swagger2MarkupConverter.java:209)
        at io.github.swagger2markup.Swagger2MarkupConverter.toFile(Swagger2MarkupConverter.java:242)
        at io.github.swagger2markup.cli.Application.run(Application.java:84)
        at io.github.swagger2markup.cli.Application.main(Application.java:61)
(gotti@plattfisch 645)

When I omit the SecurityDefinition the generation that crash doesn't happen and an output file is created.

I attached the API spec used to generate the above crash, so it is possible to reproduce the error.

api.zip

gganssauge avatar Jul 28 '17 15:07 gganssauge

I also have this issue!

It seems that swagger2markup doesn't correctly handle the case where the Oauth2 scopes object is empty. (This was also discussed on another swagger project in swagger-api/swagger-ui#2150)

ericyanush avatar Nov 29 '17 16:11 ericyanush

Hi, sry for the late reply. I'm quite busy atm. Would you like to contribute a fix? Shouldn't be very complex.

RobWin avatar Nov 30 '17 08:11 RobWin

Hey I created a pull request for this. Any chance to get a new release including the fix? Thx! https://github.com/Swagger2Markup/swagger2markup/pull/293

ctytgat avatar Dec 01 '17 11:12 ctytgat

Thx. I have a look at it in Monday.

RobWin avatar Dec 01 '17 11:12 RobWin