oatpp / oatpp-swagger

OpenApi 3.0.0 docs + Swagger UI for oatpp services
https://oatpp.io/
Apache License 2.0
95 stars 54 forks source link

[Swagger - UI] ENDPOINT_INFO description is added to both endpoint and request Body #35

Closed oben01 closed 3 years ago

oben01 commented 3 years ago

Hello ,

I declared my endpoint as :

 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->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");
   }

I can see the info description in both endpoint and request body : descri

oben01 commented 3 years ago

Just to complete,

If I declared my endpoint as :


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->body.example = oatpp::Vector<oatpp::String>({ "a", "b", "c" });
      //info->addResponse<Object<KeywordsLastDataResponse>>(
      //   Status::CODE_200,
      //   "application/json"
      //);
      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");
   }

Request body description disappear.

lganzzzo commented 3 years ago

@oben01 Fixed. Please get the latest oatpp-swagger master.

oben01 commented 3 years ago

@lganzzzo thank you ! you rock !