swagger2markup
swagger2markup copied to clipboard
Error with CLI when generating documentation
Swagger2Markup version: 1.3.3
Problem description: I tried to generate an ASCIIDOC with a JSON file made with Swashbuckle for AspNetCore. Swashbuckle provide an API to generate Swagger's json from the code documentation.
The CLI fail with this error
java -jar swagger2markup-cli-1.3.3.jar convert -i swagger_json/api.json -d out
17:15:58.824 [main] INFO io.swagger.parser.Swagger20Parser - reading from C:/.../swagger_json/emailing-api.json
17:15:58.978 [main] DEBUG i.g.s.i.document.PathsDocument - Generate examples is enabled.
17:15:58.978 [main] DEBUG i.g.s.i.document.PathsDocument - Create separated operation files is disabled.
17:15:58.979 [main] DEBUG i.g.s.i.document.DefinitionsDocument - Create separated definition files is disabled.
17:15:59.130 [main] INFO i.g.s.m.b.i.asciidoc.AsciiDocBuilder - Markup document written to: C:\...\out\overview.adoc
Exception in thread "main" java.lang.NullPointerException
at io.github.swagger2markup.internal.type.ArrayType.displaySchema(ArrayType.java:43)
at io.github.swagger2markup.internal.adapter.ParameterAdapter.displaySchema(ParameterAdapter.java:105)
at io.github.swagger2markup.internal.component.ParameterTableComponent.apply(ParameterTableComponent.java:99)
at io.github.swagger2markup.internal.component.PathOperationComponent.buildParametersSection(PathOperationComponent.java:198)
at io.github.swagger2markup.internal.component.PathOperationComponent.apply(PathOperationComponent.java:100)
at io.github.swagger2markup.internal.document.PathsDocument.applyPathOperationComponent(PathsDocument.java:223)
at io.github.swagger2markup.internal.document.PathsDocument.buildOperation(PathsDocument.java:207)
at io.github.swagger2markup.internal.document.PathsDocument.lambda$buildsPathsSection$0(PathsDocument.java:119)
at java.util.ArrayList.forEach(Unknown Source)
at io.github.swagger2markup.internal.document.PathsDocument.buildsPathsSection(PathsDocument.java:119)
at io.github.swagger2markup.internal.document.PathsDocument.apply(PathsDocument.java:103)
at io.github.swagger2markup.Swagger2MarkupConverter.applyPathsDocument(Swagger2MarkupConverter.java:197)
at io.github.swagger2markup.Swagger2MarkupConverter.toFolder(Swagger2MarkupConverter.java:182)
at io.github.swagger2markup.cli.Application.run(Application.java:86)
at io.github.swagger2markup.cli.Application.main(Application.java:61)
with this content :
{"swagger":"2.0","info":{"version":"v1","title":"My API","description":"My API for yhings","contact":{"name":"plop","email":"[email protected]"}},"paths":{"/email/attachment":{"post":{"tags":["Email"],"summary":"bla","operationId":"EmailAttachmentPost","consumes":[],"produces":[],"parameters":[{"name":"uploads","in":"query","description":"","required":false,"type":"array","items":{},"collectionFormat":"multi"},{"name":"email","in":"query","description":"","required":false,"type":"string"}],"responses":{"200":{"description":"Success"}}}}},"definitions":{"Microsoft.AspNetCore.Http.IFormFile":{"type":"object","properties":{"contentType":{"type":"string","readOnly":true},"contentDisposition":{"type":"string","readOnly":true},"headers":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"readOnly":true},"length":{"format":"int64","type":"integer","readOnly":true},"name":{"type":"string","readOnly":true},"fileName":{"type":"string","readOnly":true}}}},"securityDefinitions":{"http":{"name":"Authorization","in":"header","type":"apiKey","description":"...."}}}
and this command :
java -jar swagger2markup-cli-1.3.3.jar convert -i swagger_json/emailing-api.json -d out
I have tried with other json made by Swashbuckle and it's work really nice.
I think the problem come from the fact that Microsoft.AspNetCore.Http.IFormFile is an array.
I can confirm this same issue when endpoints take IFormFile Lists/Arrays as parameters.