A Swagger to AsciiDoc or Markdown converter to simplify the generation of an up-to-date RESTful API documentation by combining documentation that’s been hand-written with auto-generated API documentation.
Apache License 2.0
2.5k
stars
382
forks
source link
NullPointerException if YAML contains external ref #379
I have the following YAML which has a path referencing an external (working) YAML and the corresponding object is specified with YAML anchors. When I verify the swagger document in the UI, I do see the api definition (retrieved from the external server) but when I run the following command to generate the adoc, I get NullPointerException
info:
title: abc REST API specification
description: >-
test
version: 4.0
schemes:
- http
paths:
/catalog/v1/config:
$ref: "http://abc:31820/static/abc-rest-api.yaml#/paths/~1config"
Output:
karthiks-mbp:mdc karthikjayaraman$ java -jar swagger2markup-cli-1.3.3.jar convert --config=./swagger2markup.config -i ~/Desktop/test-min.yaml -f test
12:11:41.796 [main] INFO io.swagger.parser.Swagger20Parser - reading from /Users/karthikjayaraman/Desktop/test-min.yaml
12:11:42.155 [main] DEBUG i.g.s.i.document.PathsDocument - Generate examples is disabled.
12:11:42.155 [main] DEBUG i.g.s.i.document.PathsDocument - Create separated operation files is disabled.
12:11:42.156 [main] DEBUG i.g.s.i.document.DefinitionsDocument - Create separated definition files is disabled.
12:11:42.322 [main] INFO i.g.s.m.b.i.asciidoc.AsciiDocBuilder - Markup document written to: /Users/karthikjayaraman/mdc/test.adoc
Exception in thread "main" java.lang.NullPointerException
at io.github.swagger2markup.internal.component.ResponseComponent.lambda$apply$1(ResponseComponent.java:123)
at java.util.TreeMap.forEach(TreeMap.java:1005)
at io.github.swagger2markup.internal.component.ResponseComponent.apply(ResponseComponent.java:87)
at io.github.swagger2markup.internal.component.PathOperationComponent.buildResponsesSection(PathOperationComponent.java:227)
at io.github.swagger2markup.internal.component.PathOperationComponent.apply(PathOperationComponent.java:106)
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(ArrayList.java:1255)
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.toFile(Swagger2MarkupConverter.java:240)
at io.github.swagger2markup.cli.Application.run(Application.java:84)
at io.github.swagger2markup.cli.Application.main(Application.java:61)
I tried adding the swagger2markup.interDocumentCrossReferencesEnabled=true property to the config file and still ended up with NPE. Any help appreciated !
Swagger2Markup version: swagger2markup-cli-1.3.3.jar
Problem description:
I have the following YAML which has a path referencing an external (working) YAML and the corresponding object is specified with YAML anchors. When I verify the swagger document in the UI, I do see the api definition (retrieved from the external server) but when I run the following command to generate the adoc, I get NullPointerException
Output:
I tried adding the swagger2markup.interDocumentCrossReferencesEnabled=true property to the config file and still ended up with NPE. Any help appreciated !