Open fooinha opened 7 years ago
Maybe a duplicate of https://github.com/Swagger2Markup/swagger2markup/issues/213
Hi, could you please provide a minimal Swagger Spec to reproduce this issue? Btw if you use and like Swagger2markup, we would love to get your GitHub Star.
Hi, here you go. Thanx.
{
"swagger" : "2.0",
"info" : {
"description" : "description",
"version" : "v1",
"title" : "title",
"contact" : {
"name" : "contact",
"url" : "foo.tld",
"email" : "noone@foo.tld"
}
},
"host" : "localhost:8000",
"basePath" : "/",
"tags" : [ {
"name" : "stuff",
"description" : "workers Operations"
}, {
"name" : "things",
"description" : "things Operations"
}, {
"name" : "choices",
"description" : "choices Operations"
} ],
"schemes" : [ "http", "https" ],
"paths" : {
"/stuff" : {
"get" : {
"tags" : [ "stuff" ],
"summary" : "Lists a page for Stuff stored in the Database",
"description" : "",
"operationId" : "listBotnets",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"name" : "page",
"in" : "query",
"description" : "page",
"required" : false,
"type" : "integer",
"default" : 1,
"format" : "int32"
} ],
"responses" : {
"200" : {
"description" : "Lists a page for Stuff stored in the Database",
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/definitions/workersData"
}
},
"headers" : {
"Link" : {
"type" : "array",
"description" : "Links for pagination (RFC5899)",
"items" : {
"$ref" : "#/definitions/Link"
}
}
}
}
}
},
"post" : {
"tags" : [ "stuff" ],
"summary" : "Creates a new workers entry and returning it's ID",
"description" : "",
"operationId" : "createworkers",
"consumes" : [ "application/json" ],
"produces" : [ "application/json" ],
"parameters" : [ {
"in" : "body",
"name" : "workers",
"description" : "workers Data for creation",
"required" : true,
"schema" : {
"$ref" : "#/definitions/workersData"
}
} ],
"responses" : {
"303" : {
"description" : "Redirects to created workers URL"
},
"400" : {
"description" : "Invalid data"
},
"500" : {
"description" : "If an internal error happens"
}
}
}
}
},
"definitions" : {
"workersData" : {
"type" : "object",
"properties" : {
"links" : {
"type" : "array",
"xml" : {
"name" : "_links"
},
"items" : {
"$ref" : "#/definitions/Link"
}
},
"id" : {
"type" : "string",
"format" : "uuid"
},
"name" : {
"type" : "string"
},
"variantId" : {
"type" : "string",
"format" : "uuid"
},
"active" : {
"type" : "boolean",
"default" : false
},
"description" : {
"type" : "string"
}
}
},
"UriBuilder" : {
"type" : "object"
},
"Link" : {
"type" : "object",
"properties" : {
"params" : {
"type" : "object",
"additionalProperties" : {
"type" : "string"
}
},
"title" : {
"type" : "string"
},
"uriBuilder" : {
"$ref" : "#/definitions/UriBuilder"
},
"uri" : {
"type" : "string",
"format" : "uri"
},
"rel" : {
"type" : "string"
},
"rels" : {
"type" : "array",
"items" : {
"type" : "string"
}
},
"type" : {
"type" : "string"
}
}
}
}
}
The definitions section is missing. Is this by mistake?
Yes. sorry. I made that mistake by creating the minimal version. I'll try to do it again. Thanx.
You can edit the existing comment.
Debugging it further, i see that this happens while processing response headers
-->
definitionDocumentResolver == null ?
It works if we remove the $ from ref
"$ref" : "#/definitions/Link"
Thanx
convertSwagger2markup fails with NPE.
This happens because if input swagger file has json objects schema like this one
When removing all schema json nodes from input swagger file, the generation finishes without error.
pom.xml
Stacktrace