FSN#40005 Documenteren API2 volgens OpenAPI Specification
svn path=/Website/trunk/; revision=33396
This commit is contained in:
@@ -105,6 +105,9 @@
|
||||
{
|
||||
//if ("autfunction" in model && !user.has(model.autfunction))
|
||||
// return {};
|
||||
var auttext = "";
|
||||
if (model.autfunction)
|
||||
auttext = "<br>Requires authorization {0} ({1})".format(model.autfunction, L("lcl_" + model.autfunction));
|
||||
model.records_title = model.records_title || model.records_name;
|
||||
model.record_title = model.record_title || model.record_name;
|
||||
var result = {
|
||||
@@ -114,13 +117,16 @@
|
||||
getQParamSafe("module", "XXX")
|
||||
],
|
||||
"summary": "Get all {0}".format(model.records_title),
|
||||
"description": "Returns all {0} from the system that the user has access to".format(model.records_title),
|
||||
"description": "Returns all {0} from the system that the user has access to.".format(model.records_title) + auttext,
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A list of " + model.records_title,
|
||||
"schema": {
|
||||
"$ref": "#/schema/{0}".format(model.records_name)
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
@@ -201,7 +207,7 @@
|
||||
if (getQParamInt("single", 0) == 1)
|
||||
{
|
||||
result["get"].summary = "Get one {0}".format(model.record_title);
|
||||
result["get"].description = "Returns the {0}".format(model.record_title),
|
||||
result["get"].description = "Returns the {0}.".format(model.record_title) + + auttext,
|
||||
|
||||
result["get"].parameters.push(
|
||||
{
|
||||
@@ -213,13 +219,11 @@
|
||||
"format":"int64"
|
||||
}
|
||||
);
|
||||
result["get"]["responses"] =
|
||||
result["get"]["responses"]["200"] =
|
||||
{
|
||||
"200": {
|
||||
"description": "A " + model.record_title,
|
||||
"schema": {
|
||||
"$ref": "#/schema/" + model.record_name
|
||||
}
|
||||
"description": "A " + model.record_title,
|
||||
"schema": {
|
||||
"$ref": "#/schema/" + model.record_name
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -229,7 +233,7 @@
|
||||
"tags":[
|
||||
getQParamSafe("module", "XXX")
|
||||
],
|
||||
"summary":"Add a new {0} to FACILITOR".format(model.record_title),
|
||||
"summary":"Add a new {0} to FACILITOR.".format(model.record_title) + auttext,
|
||||
"description":"",
|
||||
"operationId":"add" + model.records_name,
|
||||
"parameters":[
|
||||
@@ -255,6 +259,9 @@
|
||||
},
|
||||
"405":{
|
||||
"description":"Invalid input"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
}
|
||||
},
|
||||
"security":[
|
||||
@@ -270,7 +277,7 @@
|
||||
"tags":[
|
||||
getQParamSafe("module", "XXX")
|
||||
],
|
||||
"summary":"Update an existing {0} in FACILITOR".format(model.record_title),
|
||||
"summary":"Update an existing {0} in FACILITOR.".format(model.record_title) + + auttext,
|
||||
"description":"",
|
||||
"operationId":"add" + model.records_name,
|
||||
"parameters":[
|
||||
@@ -302,6 +309,9 @@
|
||||
"$ref": "#/schema/" + model.record_name
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"405":{
|
||||
"description":"Invalid input"
|
||||
}
|
||||
@@ -319,7 +329,7 @@
|
||||
"tags":[
|
||||
getQParamSafe("module", "XXX")
|
||||
],
|
||||
"summary":"Delete a {0} from FACILITOR".format(model.record_title),
|
||||
"summary":"Delete a {0} from FACILITOR.".format(model.record_title) + auttext,
|
||||
"description":"",
|
||||
"operationId":"add" + model.records_name,
|
||||
"parameters":[
|
||||
@@ -336,6 +346,9 @@
|
||||
"204":{
|
||||
"description":"No content"
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden"
|
||||
},
|
||||
"405":{
|
||||
"description":"Invalid input"
|
||||
}
|
||||
|
||||
@@ -33,10 +33,12 @@ model_apis =
|
||||
user.checkAutorisation(autfunction); // pessimistisch
|
||||
|
||||
var result = {
|
||||
"swagger":"2.0",
|
||||
"swagger": "2.0",
|
||||
"info":{
|
||||
"description":"This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.",
|
||||
"version":"1.0.0",
|
||||
"description":"This is a description of the FACILITOR API2."
|
||||
+ "<br>You are logged in as {0} ({1})".format(user.naam(), user.oslogin())
|
||||
+ "\n\nWarning: for POST/PUT/DELETE you must be logged off and specifiy an APIKEY in <Authorize>",
|
||||
"version": FCLTVersion,
|
||||
"title":"FACILITOR",
|
||||
"termsOfService":"http://swagger.io/terms/",
|
||||
"contact":{
|
||||
@@ -79,7 +81,7 @@ model_apis =
|
||||
if (api2_mapper[dispatch].hidden)
|
||||
continue;
|
||||
|
||||
//if (nn++ > 40)
|
||||
//if (nn++ > 4)
|
||||
// break;
|
||||
var filepath = api2_mapper[dispatch].filename;
|
||||
var filename = filepath.split('/').pop();
|
||||
|
||||
Reference in New Issue
Block a user