Forum Discussion

sharan_cse's avatar
sharan_cse
Frequent Visitor
5 years ago

parameter level extension

 

Hello,

 

I have a API, I want to provide the extensions to the @RequestBody MultipleMdsEntity body.

but here, the body Object has in turn two Object types as mentioned belwo.

 

For each of these two properties in MultipleMdsEntity, I need to have different values say

For User as below

@Extension(properties = {
@ExtensionProperty(name = "x-datasourceType", value = "MDS"),
@ExtensionProperty(name = "x-uniqueIdentifier", value = "users")
})

and For Supplier as below

@Extension(properties = {
@ExtensionProperty(name = "x-datasourceType", value = "MDS"),
@ExtensionProperty(name = "x-uniqueIdentifier", value = "suppliers")
})

 

my question is where / how do I provide these extensions.?

@ApiOperation(value = "input mappings( user & supplier) output mapping ( user & supplier) - single select ",
extensions = {
@Extension(properties = {
@ExtensionProperty(name = "x-datasourceType", value = "MDS"),
@ExtensionProperty(name = "x-uniqueIdentifier", value = "users")
})
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Successfully gets Rating"),
@ApiResponse(code = 401, message = "If user is not authorized"),
@ApiResponse(code = 500, message = "Internal server error, if unable get Rating"),
})
@RequestMapping(method = RequestMethod.POST,
value = "/v1/multiple-entities/operation1",
produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<MultipleMdsEntity> mockOperation(@RequestBody MultipleMdsEntity body) {

return new ResponseEntity<>(body, HttpStatus.OK);
}


class MultipleMdsEntity{

private User user;
private Supplier supplier;

}

class User{

String uniqueName;
String passwordAdapter;
}
class Supplier{

String uniqueName;
}

 

No RepliesBe the first to reply