comparison OrthancFramework/Sources/RestApi/RestApi.cpp @ 4417:a4518adede59

openapi for plugins and jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 28 Dec 2020 17:40:35 +0100
parents d928dfcacb4b
children a7d72378e1cb
comparison
equal deleted inserted replaced
4416:0b27841950d5 4417:a4518adede59
357 357
358 protected: 358 protected:
359 virtual bool HandleCall(RestApiCall& call, 359 virtual bool HandleCall(RestApiCall& call,
360 const std::set<std::string> uriArgumentsNames) ORTHANC_OVERRIDE 360 const std::set<std::string> uriArgumentsNames) ORTHANC_OVERRIDE
361 { 361 {
362 const std::string path = Toolbox::FlattenUri(call.GetFullUri());
363
362 Json::Value v; 364 Json::Value v;
363 if (call.GetDocumentation().FormatOpenApi(v, uriArgumentsNames)) 365 if (call.GetDocumentation().FormatOpenApi(v, uriArgumentsNames, path))
364 { 366 {
365 std::string method; 367 std::string method;
366 368
367 switch (call.GetMethod()) 369 switch (call.GetMethod())
368 { 370 {
384 386
385 default: 387 default:
386 throw OrthancException(ErrorCode_ParameterOutOfRange); 388 throw OrthancException(ErrorCode_ParameterOutOfRange);
387 } 389 }
388 390
389 const std::string path = Toolbox::FlattenUri(call.GetFullUri());
390
391 if ((paths_.isMember(path) && 391 if ((paths_.isMember(path) &&
392 paths_[path].type() != Json::objectValue) || 392 paths_[path].type() != Json::objectValue) ||
393 paths_[path].isMember(method)) 393 paths_[path].isMember(method))
394 { 394 {
395 throw OrthancException(ErrorCode_InternalError); 395 throw OrthancException(ErrorCode_InternalError);