Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple API specs make swagger2markup crash #17

Open
gganssauge opened this issue Jul 28, 2017 · 4 comments
Open

Simple API specs make swagger2markup crash #17

gganssauge opened this issue Jul 28, 2017 · 4 comments

Comments

@gganssauge
Copy link

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

@ericyanush
Copy link

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)

@RobWin
Copy link
Member

RobWin commented Nov 30, 2017

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

@ctytgat
Copy link

ctytgat commented Dec 1, 2017

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

@RobWin
Copy link
Member

RobWin commented Dec 1, 2017

Thx. I have a look at it in Monday.

ctytgat pushed a commit to ctytgat/swagger2markup that referenced this issue Dec 1, 2017
RobWin pushed a commit to Swagger2Markup/swagger2markup that referenced this issue Dec 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants