Skip to content

Commit 8a21bab

Browse files
authored
OpenAPI: add validation, fix format (#826)
1 parent 56da757 commit 8a21bab

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: openapi-validate
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "static/rest-api.yaml"
7+
- ".github/workflows/openapi-validate.yml"
8+
9+
jobs:
10+
validate-openapi:
11+
name: Validate OpenAPI spec
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Validate OpenAPI spec
17+
run: go run github.com/getkin/kin-openapi/cmd/validate@latest -- static/rest-api.yaml

static/rest-api.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,10 @@ paths:
480480
value: 2500
481481
summary: If SoC is not available => specify power in Watt
482482
schema:
483-
oneOf:
484-
- $ref: "#/components/parameters/soc"
485-
- $ref: "#/components/parameters/power"
483+
type: number
484+
anyOf:
485+
- $ref: "#/components/schemas/Soc"
486+
- $ref: "#/components/schemas/Power"
486487
- name: type
487488
in: path
488489
required: true
@@ -563,6 +564,8 @@ paths:
563564
more.](/en/docs/features/vehicle)
564565
tags:
565566
- Loadpoints
567+
parameters:
568+
- $ref: "#/components/parameters/id"
566569
responses:
567570
"200":
568571
$ref: "#/components/responses/EmptyResult"
@@ -1154,7 +1157,9 @@ components:
11541157
minimum: 0
11551158
example: 2500
11561159
Precondition:
1157-
description: Late charging duration in seconds. [Read more.](/en/docs/features/plans#late-charging)
1160+
description: >-
1161+
Late charging duration in seconds. [Read
1162+
more.](/en/docs/features/plans#late-charging)
11581163
type: integer
11591164
example: 3600
11601165
minimum: 0
@@ -1405,15 +1410,12 @@ components:
14051410
in: path
14061411
required: true
14071412
schema:
1408-
oneOf:
1409-
- type: boolean
1410-
- type: string
1411-
- type: number
1413+
type: string
14121414
enum:
14131415
- "true"
14141416
- "false"
1415-
- 1
1416-
- 0
1417+
- "1"
1418+
- "0"
14171419
responses:
14181420
NanoSecondsResult:
14191421
description: Success - Number result - Unit is **nanoseconds**
@@ -1500,6 +1502,7 @@ components:
15001502
enum:
15011503
- Unauthorized
15021504
BatteryModeResult:
1505+
description: Battery mode.
15031506
content:
15041507
application/json:
15051508
schema:

0 commit comments

Comments
 (0)