mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
Web API: /sdrangel/preset (DELETE) implementation
This commit is contained in:
parent
4a3901d688
commit
9fab034f14
@ -5527,20 +5527,90 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 400 - Invalid frequency </h3>
|
<h3> Status: 400 - Invalid JSON request </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetDelete-400-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetDelete-400-schema">
|
||||||
|
<div id='responses-instancePresetDelete-400-schema-400' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Invalid JSON request",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetDelete-400-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetDelete-400-schema-400');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetDelete-400-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 404 - Preset not found </h3>
|
<h3> Status: 404 - Preset not found </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetDelete-404-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetDelete-404-schema">
|
||||||
|
<div id='responses-instancePresetDelete-404-schema-404' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Preset not found",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetDelete-404-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetDelete-404-schema-404');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetDelete-404-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 500 - Error </h3>
|
<h3> Status: 500 - Error </h3>
|
||||||
@ -6195,7 +6265,7 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 400 - Preset type and device set type mismatch </h3>
|
<h3> Status: 400 - Invalid JSON request or preset type and device set type mismatch </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
<li class="active">
|
<li class="active">
|
||||||
@ -6210,7 +6280,7 @@ $(document).ready(function() {
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var schemaWrapper = {
|
var schemaWrapper = {
|
||||||
"description" : "Preset type and device set type mismatch",
|
"description" : "Invalid JSON request or preset type and device set type mismatch",
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"$ref" : "#/definitions/ErrorResponse"
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
}
|
}
|
||||||
@ -6633,6 +6703,49 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3> Status: 400 - Invalid JSON request </h3>
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetPost-400-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetPost-400-schema">
|
||||||
|
<div id='responses-instancePresetPost-400-schema-400' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Invalid JSON request",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetPost-400-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetPost-400-schema-400');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetPost-400-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3> Status: 404 - Device set not found </h3>
|
<h3> Status: 404 - Device set not found </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
@ -6676,7 +6789,7 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 409 - Error </h3>
|
<h3> Status: 409 - Preset already exists </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
<li class="active">
|
<li class="active">
|
||||||
@ -6691,7 +6804,7 @@ $(document).ready(function() {
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var schemaWrapper = {
|
var schemaWrapper = {
|
||||||
"description" : "Error",
|
"description" : "Preset already exists",
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"$ref" : "#/definitions/ErrorResponse"
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
}
|
}
|
||||||
@ -6719,6 +6832,49 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3> Status: 500 - Error </h3>
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetPost-500-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetPost-500-schema">
|
||||||
|
<div id='responses-instancePresetPost-500-schema-500' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Error",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetPost-500-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetPost-500-schema-500');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetPost-500-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3> Status: 501 - Function not implemented </h3>
|
<h3> Status: 501 - Function not implemented </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
@ -7028,6 +7184,49 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3> Status: 400 - Invalid JSON request </h3>
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetPut-400-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetPut-400-schema">
|
||||||
|
<div id='responses-instancePresetPut-400-schema-400' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Invalid JSON request",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetPut-400-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetPut-400-schema-400');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetPut-400-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3> Status: 404 - No preset or device set found </h3>
|
<h3> Status: 404 - No preset or device set found </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
@ -7439,7 +7638,7 @@ except ApiException as e:
|
|||||||
</div>
|
</div>
|
||||||
<div id="generator">
|
<div id="generator">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
Generated 2017-11-25T18:28:10.878+01:00
|
Generated 2017-11-25T19:38:10.216+01:00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -174,6 +174,15 @@ public:
|
|||||||
Swagger::SWGErrorResponse& error __attribute__((unused)))
|
Swagger::SWGErrorResponse& error __attribute__((unused)))
|
||||||
{ return 501; }
|
{ return 501; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler of /sdrangel/preset (DELETE) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
|
||||||
|
* returns the Http status code (default 501: not implemented)
|
||||||
|
*/
|
||||||
|
virtual int instancePresetDelete(
|
||||||
|
Swagger::SWGPresetIdentifier& response __attribute__((unused)),
|
||||||
|
Swagger::SWGErrorResponse& error __attribute__((unused)))
|
||||||
|
{ return 501; }
|
||||||
|
|
||||||
static QString instanceSummaryURL;
|
static QString instanceSummaryURL;
|
||||||
static QString instanceDevicesURL;
|
static QString instanceDevicesURL;
|
||||||
static QString instanceChannelsURL;
|
static QString instanceChannelsURL;
|
||||||
|
@ -352,12 +352,23 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request,
|
|||||||
if (parseJsonBody(jsonStr, response))
|
if (parseJsonBody(jsonStr, response))
|
||||||
{
|
{
|
||||||
query.fromJson(jsonStr);
|
query.fromJson(jsonStr);
|
||||||
int status = m_adapter->instancePresetPatch(query, normalResponse, errorResponse);
|
|
||||||
response.setStatus(status);
|
|
||||||
|
|
||||||
if (status == 200) {
|
if (validatePresetTransfer(query))
|
||||||
response.write(normalResponse.asJson().toUtf8());
|
{
|
||||||
} else {
|
int status = m_adapter->instancePresetPatch(query, normalResponse, errorResponse);
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status == 200) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.setStatus(400,"Invalid JSON request");
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Invalid JSON request";
|
||||||
response.write(errorResponse.asJson().toUtf8());
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,12 +382,23 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request,
|
|||||||
if (parseJsonBody(jsonStr, response))
|
if (parseJsonBody(jsonStr, response))
|
||||||
{
|
{
|
||||||
query.fromJson(jsonStr);
|
query.fromJson(jsonStr);
|
||||||
int status = m_adapter->instancePresetPut(query, normalResponse, errorResponse);
|
|
||||||
response.setStatus(status);
|
|
||||||
|
|
||||||
if (status == 200) {
|
if (validatePresetTransfer(query))
|
||||||
response.write(normalResponse.asJson().toUtf8());
|
{
|
||||||
} else {
|
int status = m_adapter->instancePresetPut(query, normalResponse, errorResponse);
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status == 200) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.setStatus(400,"Invalid JSON request");
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Invalid JSON request";
|
||||||
response.write(errorResponse.asJson().toUtf8());
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,12 +412,52 @@ void WebAPIRequestMapper::instancePresetService(qtwebapp::HttpRequest& request,
|
|||||||
if (parseJsonBody(jsonStr, response))
|
if (parseJsonBody(jsonStr, response))
|
||||||
{
|
{
|
||||||
query.fromJson(jsonStr);
|
query.fromJson(jsonStr);
|
||||||
int status = m_adapter->instancePresetPost(query, normalResponse, errorResponse);
|
|
||||||
response.setStatus(status);
|
|
||||||
|
|
||||||
if (status == 200) {
|
if (validatePresetTransfer(query))
|
||||||
response.write(normalResponse.asJson().toUtf8());
|
{
|
||||||
} else {
|
int status = m_adapter->instancePresetPost(query, normalResponse, errorResponse);
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status == 200) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.setStatus(400,"Invalid JSON request");
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Invalid JSON request";
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (request.getMethod() == "DELETE")
|
||||||
|
{
|
||||||
|
Swagger::SWGPresetIdentifier normalResponse;
|
||||||
|
QString jsonStr = request.getBody();
|
||||||
|
|
||||||
|
if (parseJsonBody(jsonStr, response))
|
||||||
|
{
|
||||||
|
normalResponse.fromJson(jsonStr);
|
||||||
|
|
||||||
|
if (validatePresetIdentifer(normalResponse))
|
||||||
|
{
|
||||||
|
int status = m_adapter->instancePresetDelete(normalResponse, errorResponse);
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status == 200) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.setStatus(400,"Invalid JSON request");
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Invalid JSON request";
|
||||||
response.write(errorResponse.asJson().toUtf8());
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -439,3 +501,21 @@ bool WebAPIRequestMapper::parseJsonBody(QString& jsonStr, qtwebapp::HttpResponse
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WebAPIRequestMapper::validatePresetTransfer(Swagger::SWGPresetTransfer& presetTransfer)
|
||||||
|
{
|
||||||
|
Swagger::SWGPresetIdentifier *presetIdentifier = presetTransfer.getPreset();
|
||||||
|
|
||||||
|
if (presetIdentifier == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return validatePresetIdentifer(*presetIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebAPIRequestMapper::validatePresetIdentifer(Swagger::SWGPresetIdentifier& presetIdentifier)
|
||||||
|
{
|
||||||
|
return (presetIdentifier.getGroupName() && presetIdentifier.getName() && presetIdentifier.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,6 +27,12 @@
|
|||||||
#include "staticfilecontroller.h"
|
#include "staticfilecontroller.h"
|
||||||
#include "webapiadapterinterface.h"
|
#include "webapiadapterinterface.h"
|
||||||
|
|
||||||
|
namespace Swagger
|
||||||
|
{
|
||||||
|
class SWGPresetTransfer;
|
||||||
|
class SWGPresetIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
class WebAPIRequestMapper : public qtwebapp::HttpRequestHandler {
|
class WebAPIRequestMapper : public qtwebapp::HttpRequestHandler {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@ -48,6 +54,9 @@ private:
|
|||||||
void instanceDVSerialService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void instanceDVSerialService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
void instancePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void instancePresetService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
|
|
||||||
|
bool validatePresetTransfer(Swagger::SWGPresetTransfer& presetTransfer);
|
||||||
|
bool validatePresetIdentifer(Swagger::SWGPresetIdentifier& presetIdentifier);
|
||||||
|
|
||||||
bool parseJsonBody(QString& jsonStr, qtwebapp::HttpResponse& response);
|
bool parseJsonBody(QString& jsonStr, qtwebapp::HttpResponse& response);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
|
|
||||||
MESSAGE_CLASS_DEFINITION(MainWindow::MsgLoadPreset, Message)
|
MESSAGE_CLASS_DEFINITION(MainWindow::MsgLoadPreset, Message)
|
||||||
MESSAGE_CLASS_DEFINITION(MainWindow::MsgSavePreset, Message)
|
MESSAGE_CLASS_DEFINITION(MainWindow::MsgSavePreset, Message)
|
||||||
|
MESSAGE_CLASS_DEFINITION(MainWindow::MsgDeletePreset, Message)
|
||||||
|
|
||||||
MainWindow *MainWindow::m_instance = 0;
|
MainWindow *MainWindow::m_instance = 0;
|
||||||
|
|
||||||
@ -674,6 +675,37 @@ bool MainWindow::handleMessage(const Message& cmd)
|
|||||||
m_settings.save();
|
m_settings.save();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (MsgDeletePreset::match(cmd))
|
||||||
|
{
|
||||||
|
MsgDeletePreset& notif = (MsgDeletePreset&) cmd;
|
||||||
|
const Preset *presetToDelete = notif.getPreset();
|
||||||
|
|
||||||
|
// remove preset from tree
|
||||||
|
for (int ig = 0; ig < ui->presetTree->topLevelItemCount(); ig++)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *groupItem = ui->presetTree->topLevelItem(ig);
|
||||||
|
if (groupItem->text(0) == presetToDelete->getGroup())
|
||||||
|
{
|
||||||
|
for (int ip = 0; ip < groupItem->childCount(); ip++)
|
||||||
|
{
|
||||||
|
QTreeWidgetItem *presetItem = groupItem->child(ip);
|
||||||
|
const Preset* preset = qvariant_cast<const Preset*>(presetItem->data(0, Qt::UserRole));
|
||||||
|
|
||||||
|
if ((preset->getGroup() == presetToDelete->getGroup()) &&
|
||||||
|
(preset->getCenterFrequency() == presetToDelete->getCenterFrequency()) &&
|
||||||
|
(preset->getDescription() == presetToDelete->getDescription()) &&
|
||||||
|
(preset->isSourcePreset() == presetToDelete->isSourcePreset()))
|
||||||
|
{
|
||||||
|
groupItem->takeChild(ip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove preset from settings
|
||||||
|
m_settings.deletePreset(presetToDelete);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,27 @@ private:
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
class MsgDeletePreset : public Message {
|
||||||
|
MESSAGE_CLASS_DECLARATION
|
||||||
|
|
||||||
|
public:
|
||||||
|
const Preset *getPreset() const { return m_preset; }
|
||||||
|
|
||||||
|
static MsgDeletePreset* create(const Preset *preset)
|
||||||
|
{
|
||||||
|
return new MsgDeletePreset(preset);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
const Preset *m_preset;
|
||||||
|
|
||||||
|
MsgDeletePreset(const Preset *preset) :
|
||||||
|
Message(),
|
||||||
|
m_preset(preset)
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
PGroup,
|
PGroup,
|
||||||
PItem
|
PItem
|
||||||
};
|
};
|
||||||
|
@ -586,6 +586,34 @@ int WebAPIAdapterGUI::instancePresetPost(
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WebAPIAdapterGUI::instancePresetDelete(
|
||||||
|
Swagger::SWGPresetIdentifier& response,
|
||||||
|
Swagger::SWGErrorResponse& error)
|
||||||
|
{
|
||||||
|
const Preset *selectedPreset = m_mainWindow.m_settings.getPreset(*response.getGroupName(),
|
||||||
|
response.getCenterFrequency(),
|
||||||
|
*response.getName());
|
||||||
|
|
||||||
|
if (selectedPreset == 0)
|
||||||
|
{
|
||||||
|
*error.getMessage() = QString("There is no preset [%1, %2, %3]")
|
||||||
|
.arg(*response.getGroupName())
|
||||||
|
.arg(response.getCenterFrequency())
|
||||||
|
.arg(*response.getName());
|
||||||
|
return 404;
|
||||||
|
}
|
||||||
|
|
||||||
|
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||||
|
*response.getGroupName() = selectedPreset->getGroup();
|
||||||
|
*response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
|
||||||
|
*response.getName() = selectedPreset->getDescription();
|
||||||
|
|
||||||
|
MainWindow::MsgDeletePreset *msg = MainWindow::MsgDeletePreset::create(const_cast<Preset*>(selectedPreset));
|
||||||
|
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
QtMsgType WebAPIAdapterGUI::getMsgTypeFromString(const QString& msgTypeString)
|
QtMsgType WebAPIAdapterGUI::getMsgTypeFromString(const QString& msgTypeString)
|
||||||
{
|
{
|
||||||
if (msgTypeString == "debug") {
|
if (msgTypeString == "debug") {
|
||||||
|
@ -93,6 +93,10 @@ public:
|
|||||||
Swagger::SWGPresetIdentifier& response,
|
Swagger::SWGPresetIdentifier& response,
|
||||||
Swagger::SWGErrorResponse& error);
|
Swagger::SWGErrorResponse& error);
|
||||||
|
|
||||||
|
virtual int instancePresetDelete(
|
||||||
|
Swagger::SWGPresetIdentifier& response,
|
||||||
|
Swagger::SWGErrorResponse& error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MainWindow& m_mainWindow;
|
MainWindow& m_mainWindow;
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/PresetIdentifier"
|
$ref: "#/definitions/PresetIdentifier"
|
||||||
"400":
|
"400":
|
||||||
description: Preset type and device set type mismatch
|
description: Invalid JSON request or preset type and device set type mismatch
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/ErrorResponse"
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"404":
|
"404":
|
||||||
@ -295,6 +295,10 @@ paths:
|
|||||||
description: On success return preset identification
|
description: On success return preset identification
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/PresetIdentifier"
|
$ref: "#/definitions/PresetIdentifier"
|
||||||
|
"400":
|
||||||
|
description: Invalid JSON request
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"404":
|
"404":
|
||||||
description: No preset or device set found
|
description: No preset or device set found
|
||||||
schema:
|
schema:
|
||||||
@ -322,6 +326,10 @@ paths:
|
|||||||
description: On success return preset identification
|
description: On success return preset identification
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/PresetIdentifier"
|
$ref: "#/definitions/PresetIdentifier"
|
||||||
|
"400":
|
||||||
|
description: Invalid JSON request
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"404":
|
"404":
|
||||||
description: Device set not found
|
description: Device set not found
|
||||||
schema:
|
schema:
|
||||||
@ -330,7 +338,7 @@ paths:
|
|||||||
description: Preset already exists
|
description: Preset already exists
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/ErrorResponse"
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"500":
|
"500":
|
||||||
description: Error
|
description: Error
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/ErrorResponse"
|
$ref: "#/definitions/ErrorResponse"
|
||||||
@ -354,9 +362,13 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/PresetIdentifier"
|
$ref: "#/definitions/PresetIdentifier"
|
||||||
"400":
|
"400":
|
||||||
description: Invalid frequency
|
description: Invalid JSON request
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"404":
|
"404":
|
||||||
description: Preset not found
|
description: Preset not found
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/ErrorResponse"
|
||||||
"500":
|
"500":
|
||||||
description: Error
|
description: Error
|
||||||
schema:
|
schema:
|
||||||
|
@ -5527,20 +5527,90 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 400 - Invalid frequency </h3>
|
<h3> Status: 400 - Invalid JSON request </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetDelete-400-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetDelete-400-schema">
|
||||||
|
<div id='responses-instancePresetDelete-400-schema-400' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Invalid JSON request",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetDelete-400-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetDelete-400-schema-400');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetDelete-400-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 404 - Preset not found </h3>
|
<h3> Status: 404 - Preset not found </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetDelete-404-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content" style='margin-bottom: 10px;'>
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetDelete-404-schema">
|
||||||
|
<div id='responses-instancePresetDelete-404-schema-404' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Preset not found",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetDelete-404-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetDelete-404-schema-404');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetDelete-404-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 500 - Error </h3>
|
<h3> Status: 500 - Error </h3>
|
||||||
@ -6195,7 +6265,7 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 400 - Preset type and device set type mismatch </h3>
|
<h3> Status: 400 - Invalid JSON request or preset type and device set type mismatch </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
<li class="active">
|
<li class="active">
|
||||||
@ -6210,7 +6280,7 @@ $(document).ready(function() {
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var schemaWrapper = {
|
var schemaWrapper = {
|
||||||
"description" : "Preset type and device set type mismatch",
|
"description" : "Invalid JSON request or preset type and device set type mismatch",
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"$ref" : "#/definitions/ErrorResponse"
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
}
|
}
|
||||||
@ -6633,6 +6703,49 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3> Status: 400 - Invalid JSON request </h3>
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetPost-400-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetPost-400-schema">
|
||||||
|
<div id='responses-instancePresetPost-400-schema-400' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Invalid JSON request",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetPost-400-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetPost-400-schema-400');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetPost-400-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3> Status: 404 - Device set not found </h3>
|
<h3> Status: 404 - Device set not found </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
@ -6676,7 +6789,7 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3> Status: 409 - Error </h3>
|
<h3> Status: 409 - Preset already exists </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
<li class="active">
|
<li class="active">
|
||||||
@ -6691,7 +6804,7 @@ $(document).ready(function() {
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
var schemaWrapper = {
|
var schemaWrapper = {
|
||||||
"description" : "Error",
|
"description" : "Preset already exists",
|
||||||
"schema" : {
|
"schema" : {
|
||||||
"$ref" : "#/definitions/ErrorResponse"
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
}
|
}
|
||||||
@ -6719,6 +6832,49 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3> Status: 500 - Error </h3>
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetPost-500-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetPost-500-schema">
|
||||||
|
<div id='responses-instancePresetPost-500-schema-500' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Error",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetPost-500-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetPost-500-schema-500');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetPost-500-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3> Status: 501 - Function not implemented </h3>
|
<h3> Status: 501 - Function not implemented </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
@ -7028,6 +7184,49 @@ $(document).ready(function() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h3> Status: 400 - Invalid JSON request </h3>
|
||||||
|
|
||||||
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
|
<li class="active">
|
||||||
|
<a data-toggle="tab" href="#responses-instancePresetPut-400-schema">Schema</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="tab-content" style='margin-bottom: 10px;'>
|
||||||
|
<div class="tab-pane active" id="responses-instancePresetPut-400-schema">
|
||||||
|
<div id='responses-instancePresetPut-400-schema-400' style="padding: 30px; border-left: 1px solid #eee; border-right: 1px solid #eee; border-bottom: 1px solid #eee;">
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
var schemaWrapper = {
|
||||||
|
"description" : "Invalid JSON request",
|
||||||
|
"schema" : {
|
||||||
|
"$ref" : "#/definitions/ErrorResponse"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var schema = schemaWrapper.schema;
|
||||||
|
if (schema.$ref != null) {
|
||||||
|
schema = defsParser.$refs.get(schema.$ref);
|
||||||
|
} else {
|
||||||
|
schemaWrapper.definitions = Object.assign({}, defs);
|
||||||
|
$RefParser.dereference(schemaWrapper).catch(function(err) {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
//console.log(JSON.stringify(schema));
|
||||||
|
var view = new JSONSchemaView(schema, 3);
|
||||||
|
$('#responses-instancePresetPut-400-schema-data').val(stringify(schema));
|
||||||
|
var result = $('#responses-instancePresetPut-400-schema-400');
|
||||||
|
result.empty();
|
||||||
|
result.append(view.render());
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
<input id='responses-instancePresetPut-400-schema-data' type='hidden' value=''></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h3> Status: 404 - No preset or device set found </h3>
|
<h3> Status: 404 - No preset or device set found </h3>
|
||||||
|
|
||||||
<ul class="nav nav-tabs nav-tabs-examples" >
|
<ul class="nav nav-tabs nav-tabs-examples" >
|
||||||
@ -7439,7 +7638,7 @@ except ApiException as e:
|
|||||||
</div>
|
</div>
|
||||||
<div id="generator">
|
<div id="generator">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
Generated 2017-11-25T18:28:10.878+01:00
|
Generated 2017-11-25T19:38:10.216+01:00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user