# HG changeset patch # User Sebastien Jodogne # Date 1608891812 -3600 # Node ID a6abe5f512db05a8cb40a8eee2f8771b4909565f # Parent 5784a9eaf5021a3e8c597c5da3f3f6a387423b60 cont openapi diff -r 5784a9eaf502 -r a6abe5f512db OrthancFramework/Sources/RestApi/RestApi.cpp --- a/OrthancFramework/Sources/RestApi/RestApi.cpp Fri Dec 25 11:12:14 2020 +0100 +++ b/OrthancFramework/Sources/RestApi/RestApi.cpp Fri Dec 25 11:23:32 2020 +0100 @@ -545,6 +545,6 @@ LOG(WARNING) << "The documentation of the REST API contains " << visitor.GetSuccessPathsCount() << " paths over a total of " << visitor.GetTotalPathsCount() << " paths " - << "(" << static_cast(boost::math::iround(coverage)) << "%)"; + << "(coverage: " << static_cast(boost::math::iround(coverage)) << "%)"; } } diff -r 5784a9eaf502 -r a6abe5f512db OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp --- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Fri Dec 25 11:12:14 2020 +0100 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Fri Dec 25 11:23:32 2020 +0100 @@ -1593,12 +1593,12 @@ std::string r = GetResourceTypeText(t, false /* plural */, false /* upper case */); call.GetDocumentation() .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) - .SetSummary("Get size of attachment on the disk") + .SetSummary("Get size of attachment on disk") .SetDescription("Get the size of one attachment associated with the given " + r + ", as stored on the disk. " "This is different from `.../size` if `EnableStorage` is `true`.") .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") .SetUriArgument("name", "The name of the attachment") - .AddAnswerType(MimeType_PlainText, "The size of the attachment on the disk"); + .AddAnswerType(MimeType_PlainText, "The size of the attachment, as stored on the disk"); return; } @@ -1612,6 +1612,20 @@ static void GetAttachmentMD5(RestApiGetCall& call) { + if (call.IsDocumentation()) + { + ResourceType t = StringToResourceType(call.GetFullUri()[0].c_str()); + std::string r = GetResourceTypeText(t, false /* plural */, false /* upper case */); + call.GetDocumentation() + .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) + .SetSummary("Get MD5 of attachment") + .SetDescription("Get the MD5 hash of one attachment associated with the given " + r) + .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") + .SetUriArgument("name", "The name of the attachment") + .AddAnswerType(MimeType_PlainText, "The MD5 of the attachment"); + return; + } + FileInfo info; if (GetAttachmentInfo(info, call) && info.GetUncompressedMD5() != "") @@ -1623,6 +1637,21 @@ static void GetAttachmentCompressedMD5(RestApiGetCall& call) { + if (call.IsDocumentation()) + { + ResourceType t = StringToResourceType(call.GetFullUri()[0].c_str()); + std::string r = GetResourceTypeText(t, false /* plural */, false /* upper case */); + call.GetDocumentation() + .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) + .SetSummary("Get MD5 of attachment on disk") + .SetDescription("Get the MD5 hash of one attachment associated with the given " + r + ", as stored on the disk. " + "This is different from `.../md5` if `EnableStorage` is `true`.") + .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") + .SetUriArgument("name", "The name of the attachment") + .AddAnswerType(MimeType_PlainText, "The MD5 of the attachment, as stored on the disk"); + return; + } + FileInfo info; if (GetAttachmentInfo(info, call) && info.GetCompressedMD5() != "") @@ -1634,6 +1663,20 @@ static void VerifyAttachment(RestApiPostCall& call) { + if (call.IsDocumentation()) + { + ResourceType t = StringToResourceType(call.GetFullUri()[0].c_str()); + std::string r = GetResourceTypeText(t, false /* plural */, false /* upper case */); + call.GetDocumentation() + .SetTag(GetResourceTypeText(t, true /* plural */, true /* upper case */)) + .SetSummary("Verify attachment") + .SetDescription("Verify that the attachment is not corrupted, by validating its MD5 hash") + .SetUriArgument("id", "Orthanc identifier of the " + r + " of interest") + .SetUriArgument("name", "The name of the attachment") + .AddAnswerType(MimeType_Json, "On success, a valid JSON object is returned"); + return; + } + ServerContext& context = OrthancRestApi::GetContext(call); CheckValidResourceType(call);