jason-fox / fox.jason.passthrough.swagger

Generate DITA-based REST API documentation from a Swagger file added directly to a ditamap
https://jason-fox.github.io/dita-ot-plugins/swagger
Apache License 2.0
6 stars 4 forks source link

Swagger2MarkupConverter breaks on hideous JSON #6

Closed thendarion closed 3 years ago

thendarion commented 3 years ago

I have this ugly JSON file coming from some random pipe

{
    "swagger": "2.0",
    "info": {
        "version": "1.0.0",
        "title": "something"
    },
    "host": "",
    "basePath": "/something/api/v2",
    "schemes": [
        "http"
    ],
    "paths": {
        "/": {
            "get": {
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "parameters": [
                    {
                        "type": "string",
                        "name": "query",
                        "in": "query",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "headers": {
                        },
                        "schema": {
                            "type": "array",
                            "items": {
                            }
                        }
                    },
                    "204": {
                        "description": "No Content",
                        "headers": {
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "EntityValue": {
            "properties": {
            }
        }
    }
}

which produces the following output:

  [dita-ot] [topic-reader] swagger.process:
  [dita-ot] [topic-reader] 
  [dita-ot] Error: java.lang.RuntimeException: plugin error:
  [dita-ot] [topic-reader] [swagger-gen] Java Result: 1
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen] Exception in thread "main" java.lang.NullPointerException
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.type.ArrayType.displaySchema(ArrayType.java:43)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.component.ResponseComponent.lambda$apply$1(ResponseComponent.java:104)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at java.base/java.util.TreeMap.forEach(TreeMap.java:1002)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.component.ResponseComponent.apply(ResponseComponent.java:88)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.component.PathOperationComponent.buildResponsesSection(PathOperationComponent.java:233)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.component.PathOperationComponent.apply(PathOperationComponent.java:112)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.document.PathsDocument.applyPathOperationComponent(PathsDocument.java:236)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.document.PathsDocument.buildOperation(PathsDocument.java:220)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.document.PathsDocument.lambda$buildsPathsSection$0(PathsDocument.java:120)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.document.PathsDocument.buildsPathsSection(PathsDocument.java:120)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.internal.document.PathsDocument.apply(PathsDocument.java:104)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.Swagger2MarkupConverter.applyPathsDocument(Swagger2MarkupConverter.java:201)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.Swagger2MarkupConverter.toFile(Swagger2MarkupConverter.java:244)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.cli.Application.run(Application.java:84)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] [swagger-gen]    at io.github.swagger2markup.cli.Application.main(Application.java:61)
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] 
  [dita-ot] [topic-reader] BUILD FAILED
  [dita-ot] [topic-reader] C:\git\dt-pipeline\dita-test\target\dita\plugins\fox.jason.passthrough.swagger\process_swagger.xml:20: The following error occurred while executing this line:
  [dita-ot] [topic-reader] C:\git\dt-pipeline\dita-test\target\dita\plugins\fox.jason.passthrough.swagger\resource\antlib.xml:65: SwaggerGen failed to generate documentation:

is this a Pandoc issue too?

thendarion commented 3 years ago

affected version: 2021-02-02

I'll download a newer one and test that too

thendarion commented 3 years ago

or should I experiment with different https://github.com/Swagger2Markup/swagger2markup versions instead?

thendarion commented 3 years ago

yes, we should continue this elsewhere :)