kongchen/swagger-maven-plugin

Returning an EntityResponse<MyObject[]> results in a syntactically invalid $ref link

ninjacoda opened this issue · 0 comments

When a controller endpoint returns an EntityResponse of an array of objects, the model name for that object is appended by square brackets: []

For example, for an endpoint returning EntityResponse<MyObject[]>, the swagger 2.0 model is called EntityResponseMyObject[].

This means that the schema $ref link will point to #/definitions/EntityResponseMyObject[]

According to Swagger Editor, that's syntactically invalid:

Semantic error at paths./myEndpoint.get.responses.200.schema.$ref
$ref values must be RFC3986-compliant percent-encoded URIs

Maybe the actual word Array could be used instead of the braces [] when creating the model names?
(Not sure this is the plugin's doing, or if the report needs to go into another project, though?)