Mercurial > hg > orthanc
comparison OrthancFramework/Sources/RestApi/RestApiCallDocumentation.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 | b50410d0e98c |
children | 83371ccdfe80 |
comparison
equal
deleted
inserted
replaced
4416:0b27841950d5 | 4417:a4518adede59 |
---|---|
305 } | 305 } |
306 } | 306 } |
307 | 307 |
308 | 308 |
309 bool RestApiCallDocumentation::FormatOpenApi(Json::Value& target, | 309 bool RestApiCallDocumentation::FormatOpenApi(Json::Value& target, |
310 const std::set<std::string>& expectedUriArguments) const | 310 const std::set<std::string>& expectedUriArguments, |
311 const std::string& uri) const | |
311 { | 312 { |
312 if (summary_.empty() && | 313 if (summary_.empty() && |
313 description_.empty()) | 314 description_.empty()) |
314 { | 315 { |
315 return false; | 316 return false; |
360 Json::Value p = Json::objectValue; | 361 Json::Value p = Json::objectValue; |
361 TypeToSchema(p, field->second.GetType()); | 362 TypeToSchema(p, field->second.GetType()); |
362 p["description"] = field->second.GetDescription(); | 363 p["description"] = field->second.GetDescription(); |
363 schema["properties"][field->first] = p; | 364 schema["properties"][field->first] = p; |
364 } | 365 } |
366 | |
367 if (!it->second.empty() && | |
368 answerFields_.size() > 0) | |
369 { | |
370 LOG(WARNING) << "The JSON description will not be visible if the fields of the JSON request are detailed: " | |
371 << EnumerationToString(method_) << " " << uri; | |
372 } | |
365 } | 373 } |
366 } | 374 } |
367 } | 375 } |
368 | 376 |
369 target["responses"]["200"]["description"] = (answerDescription_.empty() ? "" : answerDescription_); | 377 target["responses"]["200"]["description"] = (answerDescription_.empty() ? "" : answerDescription_); |
381 { | 389 { |
382 Json::Value p = Json::objectValue; | 390 Json::Value p = Json::objectValue; |
383 TypeToSchema(p, field->second.GetType()); | 391 TypeToSchema(p, field->second.GetType()); |
384 p["description"] = field->second.GetDescription(); | 392 p["description"] = field->second.GetDescription(); |
385 schema["properties"][field->first] = p; | 393 schema["properties"][field->first] = p; |
386 } | 394 } |
395 | |
396 if (!it->second.empty() && | |
397 answerFields_.size() > 0) | |
398 { | |
399 LOG(WARNING) << "The JSON description will not be visible if the fields of the JSON answer are detailed: " | |
400 << EnumerationToString(method_) << " " << uri; | |
401 } | |
387 } | 402 } |
388 } | 403 } |
389 | 404 |
390 for (AllowedTypes::const_iterator it = answerTypes_.begin(); | 405 for (AllowedTypes::const_iterator it = answerTypes_.begin(); |
391 it != answerTypes_.end(); ++it) | 406 it != answerTypes_.end(); ++it) |