Closed oben01 closed 3 years ago
Fixed in #34
You mixed up response and consumes. You want to receive the DTO, and not respond with it:
ENDPOINT_INFO(getKeywordListInfo)
{
info->addTag("Keyword List info");
info->description = "Get the last acquisition info for a list of keywords and list of info passed as a body. If the List of info is empty, the response will be the the list of keywords with empty values ";
info->addConsumes<Object<KeywordsListInfoResponse>>(
"application/json",
"Your description"
);
}
ENDPOINT("PUT", "/acquisition/keyword/info", getKeywordListInfo,
BODY_DTO(Object<KeywordsListInfoBody>, keywords))
{
return createResponse(Status::CODE_200, "OK");
}
Note info->addConsumes
instead of info->addResponse
hello @lganzzzo @bamkrs I confirm that the body is defined as required. @bamkrs do you mean something like that ?
ENDPOINT_INFO(getKeywordListLastData)
{
info->addTag("Keyword List Last data");
info->description = "Get the last acquisition for a list of keywords passed as a body";
info->addConsumes<Object<KeywordsLastDataBody>>(
"application/json",
"Your description"
);
info->addResponse<Object<KeywordsLastDataResponse>>(
Status::CODE_200,
"application/json"
);
}
ENDPOINT("PUT", "/acquisition/keyword/lastdata", getKeywordListLastData)//,
//BODY_DTO(Object<KeywordsLastDataBody>, keywords))
{
return createResponse(Status::CODE_200, "OK");
}
No need to declare BODY_DTO in my ENDPOINT ? (Am using Oatp++ only to generate swagger contract, no need to catch those values)
@oben01 ,
Your original example looks correct. I think @bamkrs , confused the naming KeywordsListInfoResponse
and KeywordsListInfoBody
which look pretty similar.
I'm closing this issue
Hello,
I declared a body as :
The swagger UI does not display my keywords body as required. Am I doing something wrong ? This issue may be related to https://github.com/oatpp/oatpp/issues/235#issue-613100782 Thank you.