Skip to content
Snippets Groups Projects
Commit e693e1ea authored by Detlef Runde's avatar Detlef Runde
Browse files

version 1.0.0

parent af39c704
No related branches found
No related tags found
1 merge request!2Use now API v1.0.0
# Description of version 0.0.6
# Description of version 1.0.0
auto-generated ASP.NET server code
......@@ -75,7 +75,7 @@ and at the value that is to become the MongoDB ID, add:
### folder `Services`
the folder `Services` should contain one common class with the DatabaseSettings (`DatabaseSettings.cs`) and one with the database-access-methods (create, get, update, remove) for each API. If some are missing create them like the ones you find there. Be aware to add the reference to these in the file `startup.cs` in this case.
the naming in the DatabaseSettings is the same as defined in `appsettings.json`, which you have to extend when creating new classes in this folder. changed `appsettings.json` in the folder `docker` accordingly. Make sure that the ConnectionString for the database contains the correct IP address as specified in `docker-compose.yml`.
the naming in the DatabaseSettings is the same as defined in `appsettings.json`, which you have to extend when creating new classes in this folder. Change `appsettings.json` in the folder `docker` accordingly. Make sure that the ConnectionString for the database contains the correct IP address as specified in `docker-compose.yml`.
### folder `wwwroot`
add in `openapi-original.json` in section `servers` the urls of the servers you want to use with swagger-ui
......
......@@ -3,7 +3,7 @@
*
* API ensuring interoperability between an authoring tool and a World Storage service
*
* The version of the OpenAPI document: 0.0.6
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
......@@ -72,7 +72,7 @@ namespace Org.OpenAPITools.Controllers
[SwaggerResponse(statusCode: 200, type: typeof(string), description: "Current version.")]
public override IActionResult GetVersion()
{
string version = "0.0.6";
string version = "1.0.0";
return new ObjectResult(version);
//return StatusCode(200, new ObjectResult(version));
}
......
......@@ -3,7 +3,7 @@
*
* API ensuring interoperability between an authoring tool and a World Storage service
*
* The version of the OpenAPI document: 0.0.6
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
......@@ -70,7 +70,7 @@ namespace Org.OpenAPITools.Controllers
return new ObjectResult(mytrackable);
}
catch (Exception e)
{
{
return StatusCode(400, e.Message);
}
}
......@@ -150,5 +150,35 @@ namespace Org.OpenAPITools.Controllers
List<Trackable> trackablelist = _trackableService.Get();
return new ObjectResult(trackablelist);
}
/// <summary>
/// Modify a Trackable.
/// </summary>
/// <remarks>Modify an existing Trackable given a json object containing all the required informations. &lt;br&gt; **Please note that ID of the object is required in the JSON**</remarks>
/// <param name="trackable">The Trackable to be modified in the world storage.</param>
/// <response code="200">OK, return the UUID of the modified Trackable.</response>
/// <response code="400">Bad request.</response>
/// <response code="404">Not found, could not find UUID in database.</response>
/// <response code="0">Unexpected error.</response>
[HttpPut]
[Route("/trackables")]
[Consumes("application/json")]
[ValidateModelState]
[SwaggerOperation("ModifyTrackable")]
[SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")]
public override IActionResult ModifyTrackable([FromBody] Trackable trackable)
{
ReplaceOneResult result = _trackableService.Update(trackable.UUID, trackable);
if (result.MatchedCount == 0)
{
return StatusCode(404, "Not found, could not find UUID in database.");
}
else
{
return StatusCode(200, trackable.UUID);
}
}
}
}
......@@ -3,7 +3,7 @@
*
* API ensuring interoperability between an authoring tool and a World Storage service
*
* The version of the OpenAPI document: 0.0.6
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
......@@ -150,5 +150,37 @@ namespace Org.OpenAPITools.Controllers
List<WorldAnchor> worldanchorlist = _worldAnchorService.Get();
return new ObjectResult(worldanchorlist);
}
/// <summary>
/// Modify a World Anchor.
/// </summary>
/// <remarks>Modify an existing World Anchor given a json object containing all the required informations. &lt;br&gt; **Please note that ID of the object is required in the JSON**</remarks>
/// <param name="worldAnchor">The World Anchor to be modified in the world storage.</param>
/// <response code="200">OK, return the UUID of the modified World Anchor.</response>
/// <response code="400">Bad request.</response>
/// <response code="404">Not found, could not find UUID in database.</response>
/// <response code="0">Unexpected error.</response>
[HttpPut]
[Route("/worldAnchors")]
[Consumes("application/json")]
[ValidateModelState]
[SwaggerOperation("ModifyWorldAnchor")]
[SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")]
public override IActionResult ModifyWorldAnchor([FromBody] WorldAnchor worldAnchor)
{
ReplaceOneResult result = _worldAnchorService.Update(worldAnchor.UUID, worldAnchor);
if (result.MatchedCount == 0)
{
return StatusCode(404, "Not found, could not find UUID in database.");
}
else
{
return StatusCode(200, worldAnchor.UUID);
}
}
}
}
......@@ -3,7 +3,7 @@
*
* API ensuring interoperability between an authoring tool and a World Storage service
*
* The version of the OpenAPI document: 0.0.6
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
......@@ -201,5 +201,35 @@ namespace Org.OpenAPITools.Controllers
}
return new ObjectResult(worldlinklist);
}
/// <summary>
/// Modify a World Link.
/// </summary>
/// <remarks>Modify an existing World Link given a json object containing all the required informations. &lt;br&gt; **Please note that ID of the object is required in the JSON**</remarks>
/// <param name="worldLink">The World Link to be modified in the world storage.</param>
/// <response code="200">OK, return the UUID of the modified World Link.</response>
/// <response code="400">Bad request.</response>
/// <response code="404">Not found, could not find UUID in database.</response>
/// <response code="0">Unexpected error.</response>
[HttpPut]
[Route("/worldLinks")]
[Consumes("application/json")]
[ValidateModelState]
[SwaggerOperation("ModifyWorldLink")]
[SwaggerResponse(statusCode: 0, type: typeof(Error), description: "Unexpected error.")]
public override IActionResult ModifyWorldLink([FromBody] WorldLink worldLink)
{
ReplaceOneResult result = _worldLinkService.Update(worldLink.UUID, worldLink);
if (result.MatchedCount == 0)
{
return StatusCode(404, "Not found, could not find UUID in database.");
}
else
{
return StatusCode(200, worldLink.UUID);
}
}
}
}
......@@ -3,7 +3,7 @@
*
* API ensuring interoperability between an authoring tool and a World Storage service
*
* The version of the OpenAPI document: 0.0.6
* The version of the OpenAPI document: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
......@@ -88,7 +88,7 @@ namespace Org.OpenAPITools
services
.AddSwaggerGen(c =>
{
c.SwaggerDoc("0.0.6", new OpenApiInfo
c.SwaggerDoc("1.0.0", new OpenApiInfo
{
Title = "World Storage API",
Description = "World Storage API (ASP.NET Core 3.1)",
......@@ -104,7 +104,7 @@ namespace Org.OpenAPITools
Name = "NoLicense",
Url = new Uri("https://opensource.org/licenses/BSD-3-Clause")
},
Version = "0.0.6",
Version = "1.0.0",
});
c.CustomSchemaIds(type => type.FriendlyId(true));
c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{Assembly.GetEntryAssembly().GetName().Name}.xml");
......@@ -145,7 +145,7 @@ namespace Org.OpenAPITools
// set route prefix to openapi, e.g. http://localhost:8080/openapi/index.html
c.RoutePrefix = "openapi";
//TODO: Either use the SwaggerGen generated OpenAPI contract (generated from C# classes)
//c.SwaggerEndpoint("/openapi/0.0.6/openapi.json", "World Storage API");
//c.SwaggerEndpoint("/openapi/1.0.0/openapi.json", "World Storage API");
//TODO: Or alternatively use the original OpenAPI contract that's included in the static files
c.SwaggerEndpoint("/openapi-original.json", "World Storage API Original");
......
......@@ -3,7 +3,7 @@
"CollectionNameWorldLink": "WorldLink",
"CollectionNameTrackables": "Trackables",
"CollectionNameWorldAnchor": "WorldAnchor",
"ConnectionString": "mongodb://vm009254.fe.hhi.de:27017",
"ConnectionString": "mongodb://localhost:27017",
"DatabaseName": "WorldStorageAPI"
},
"Logging": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment