-
Notifications
You must be signed in to change notification settings - Fork 35
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
convertSwagger2markup fails with NPE with swagger files with schema json objects #31
Comments
Maybe a duplicate of Swagger2Markup/swagger2markup#213 |
Hi, could you please provide a minimal Swagger Spec to reproduce this issue? |
Hi, here you go. Thanx. {
"swagger" : "2.0",
"info" : {
"description" : "description",
"version" : "v1",
"title" : "title",
"contact" : {
"name" : "contact",
"url" : "foo.tld",
"email" : "[email protected]"
}
},
"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
The text was updated successfully, but these errors were encountered: