Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add first version of swagger documentation #8

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
<artifactId>ktor-server-content-negotiation-jvm</artifactId>
<version>${ktor.version}</version>
</dependency>
<dependency>
<groupId>io.ktor</groupId>
<artifactId>ktor-server-swagger-jvm</artifactId>
<version>${ktor.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test-junit5</artifactId>
Expand Down
2 changes: 2 additions & 0 deletions src/main/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>): Unit = io.ktor.server.netty.EngineMain.main(args)

Expand Down Expand Up @@ -47,5 +48,6 @@ fun Application.module() {
call.respond(result)
}
}
swaggerUI(path="openapi", swaggerFile = "openapi/documentation.yaml")
}
}
49 changes: 49 additions & 0 deletions src/main/resources/openapi/documentation.yaml
Original file line number Diff line number Diff line change
@@ -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
Loading