diff --git a/pom.xml b/pom.xml
index 63f66de..75ad533 100644
--- a/pom.xml
+++ b/pom.xml
@@ -54,6 +54,11 @@
ktor-server-content-negotiation-jvm
${ktor.version}
+
+ io.ktor
+ ktor-server-swagger-jvm
+ ${ktor.version}
+
org.jetbrains.kotlin
kotlin-test-junit5
diff --git a/src/main/App.kt b/src/main/App.kt
index d043ea4..4bd8579 100644
--- a/src/main/App.kt
+++ b/src/main/App.kt
@@ -7,6 +7,7 @@ import io.ktor.server.plugins.contentnegotiation.*
import io.ktor.server.request.*
import io.ktor.server.response.*
import io.ktor.server.routing.*
+import io.ktor.server.plugins.swagger.*
fun main(args: Array): Unit = io.ktor.server.netty.EngineMain.main(args)
@@ -47,5 +48,6 @@ fun Application.module() {
call.respond(result)
}
}
+ swaggerUI(path="openapi", swaggerFile = "openapi/documentation.yaml")
}
}
diff --git a/src/main/resources/openapi/documentation.yaml b/src/main/resources/openapi/documentation.yaml
new file mode 100644
index 0000000..7b539be
--- /dev/null
+++ b/src/main/resources/openapi/documentation.yaml
@@ -0,0 +1,49 @@
+openapi: "3.0.3"
+info:
+ title: "Load Flow Service API"
+ description: "An API that interacts with Powsybl"
+ version: "1.0.0"
+servers:
+ - url: "http://0.0.0.0:8080"
+paths:
+ /get-buses:
+ post:
+ operationId: getBuses
+ description: "Return all buses in the network"
+ requestBody:
+ description: "Form with network sent as file"
+ required: true
+ content:
+ multipart/form-data:
+ schema:
+ type: object
+ properties:
+ network:
+ type: string
+ format: binary
+ responses:
+ "200":
+ description: "List with all buses in the network"
+ content:
+ application/json:
+ schema:
+ type: array
+ items:
+ $ref: "#/components/schemas/Bus"
+
+
+components:
+ schemas:
+ Bus:
+ type: object
+ properties:
+ id:
+ type: string
+ voltage:
+ type: double
+ angle:
+ type: double
+ activePower:
+ type: double
+ reactivePower:
+ type: double