# HG changeset patch # User Alain Mazy # Date 1696326943 -7200 # Node ID 002ba12a8beee1cb87ca136f2dd8f4b728bfadc0 # Parent c5c00bee291aad7dedb67868b9e931d0b3ae84b4 fix openapi & cheatsheet visitors to include trailing 'path' in /instances/{id}/content/{path} url diff -r c5c00bee291a -r 002ba12a8bee OrthancFramework/Sources/RestApi/RestApi.cpp --- a/OrthancFramework/Sources/RestApi/RestApi.cpp Tue Oct 03 11:33:59 2023 +0200 +++ b/OrthancFramework/Sources/RestApi/RestApi.cpp Tue Oct 03 11:55:43 2023 +0200 @@ -138,6 +138,7 @@ protected: virtual bool HandleCall(RestApiCall& call, + const std::string& path, const std::set& uriArgumentsNames) = 0; public: @@ -194,7 +195,7 @@ try { ok = (resource.Handle(call) && - HandleCall(call, uriArgumentsNames)); + HandleCall(call, path, uriArgumentsNames)); } catch (OrthancException& e) { @@ -232,7 +233,7 @@ try { ok = (resource.Handle(call) && - HandleCall(call, uriArgumentsNames)); + HandleCall(call, path, uriArgumentsNames)); } catch (OrthancException& e) { @@ -269,7 +270,7 @@ try { ok = (resource.Handle(call) && - HandleCall(call, uriArgumentsNames)); + HandleCall(call, path, uriArgumentsNames)); } catch (OrthancException& e) { @@ -307,7 +308,7 @@ try { ok = (resource.Handle(call) && - HandleCall(call, uriArgumentsNames)); + HandleCall(call, path, uriArgumentsNames)); } catch (OrthancException& e) { @@ -366,10 +367,9 @@ protected: virtual bool HandleCall(RestApiCall& call, + const std::string& path, const std::set& uriArgumentsNames) ORTHANC_OVERRIDE { - const std::string path = Toolbox::FlattenUri(call.GetFullUri()); - Json::Value v; if (call.GetDocumentation().FormatOpenApi(v, uriArgumentsNames, path)) { @@ -684,9 +684,10 @@ protected: virtual bool HandleCall(RestApiCall& call, + const std::string& _path, const std::set& uriArgumentsNames) ORTHANC_OVERRIDE { - Path& path = paths_[ Toolbox::FlattenUri(call.GetFullUri()) ]; + Path& path = paths_[ _path ]; path.AddMethod(call.GetMethod(), call.GetDocumentation().GetTag(), call.GetDocumentation().IsDeprecated());