Forum Discussion
Epiphastro
5 years agoNew Member
The same problem occurs, if you specify multiple content types to a path. Separate service methods will be generated but all of them will have all content types in their Consumes annotations instead of just the matching ones. This gets even worse, if you try to use content type versioning.
For example you want to allow for two content type versions like:
content:
application/json;version=1.0.0:
schema:
$ref: '#/components/schemas/MyDataV1'
application/json;version=2.0.0:
schema:
$ref: '#/components/schemas/MyDataV2'
You will end up with two methods generated (one for each content type) but both will have same consumes annotation like:
@Consumes({ "application/json;version=1.0.0", "application/json;version=2.0.0" })
...
public void myOperation(MyDataV1 body);
@Consumes({ "application/json;version=1.0.0", "application/json;version=2.0.0" })
...
public void myOperation(MyDataV2 body);
While I would actually expect:
@Consumes({ "application/json;version=1.0.0" })
...
public void myOperation(MyDataV1 body);
@Consumes({ "application/json;version=2.0.0" })
...
public void myOperation(MyDataV2 body);
PeterP Did you manage to solve this?
My last resort would be mangling with the code generation templates. But to be honest I would like to avoid that.
Related Content
Recent Discussions
- 2 days ago
- 2 days ago
- 19 days ago