comparison OrthancFramework/Sources/RestApi/RestApi.cpp @ 4424:83371ccdfe80

openapi documentation is now completed
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 29 Dec 2020 19:28:53 +0100
parents a7d72378e1cb
children d9473bd5ed43
comparison
equal deleted inserted replaced
4423:2a69b58ff3ac 4424:83371ccdfe80
872 872
873 void RestApi::AutoListChildren(RestApiGetCall& call) 873 void RestApi::AutoListChildren(RestApiGetCall& call)
874 { 874 {
875 call.GetDocumentation() 875 call.GetDocumentation()
876 .SetTag("Other") 876 .SetTag("Other")
877 .SetSummary("List of operations") 877 .SetSummary("List operations")
878 .SetDescription("List the available operations under URI: " + call.FlattenUri()) 878 .SetDescription("List the available operations under URI `" + call.FlattenUri() + "`")
879 .AddAnswerType(MimeType_Json, "List of the available operations"); 879 .AddAnswerType(MimeType_Json, "List of the available operations");
880 880
881 RestApi& context = call.GetContext(); 881 RestApi& context = call.GetContext();
882 882
883 Json::Value directory; 883 Json::Value directory;
884 if (context.root_.GetDirectory(directory, call.GetFullUri())) 884 if (context.root_.GetDirectory(directory, call.GetFullUri()))
885 { 885 {
886 if (call.IsDocumentation()) 886 if (call.IsDocumentation())
887 { 887 {
888 call.GetDocumentation().SetSample(directory); 888 call.GetDocumentation().SetSample(directory);
889
890 std::set<std::string> c;
891 call.GetUriComponentsNames(c);
892 for (std::set<std::string>::const_iterator it = c.begin(); it != c.end(); ++it)
893 {
894 call.GetDocumentation().SetUriArgument(*it, RestApiCallDocumentation::Type_String, "");
895 }
889 } 896 }
890 else 897 else
891 { 898 {
892 call.GetOutput().AnswerJson(directory); 899 call.GetOutput().AnswerJson(directory);
893 } 900 }
894 } 901 }
895 } 902 }
896 903
897 904
898 void RestApi::GenerateOpenApiDocumentation(Json::Value& target) 905 void RestApi::GenerateOpenApiDocumentation(Json::Value& target)
899 { 906 {