diff --git a/.github/workflows/openapi-validate.yml b/.github/workflows/openapi-validate.yml new file mode 100644 index 000000000..e01f6e1c4 --- /dev/null +++ b/.github/workflows/openapi-validate.yml @@ -0,0 +1,17 @@ +name: openapi-validate + +on: + pull_request: + paths: + - "static/rest-api.yaml" + - ".github/workflows/openapi-validate.yml" + +jobs: + validate-openapi: + name: Validate OpenAPI spec + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Validate OpenAPI spec + run: go run github.com/getkin/kin-openapi/cmd/validate@latest -- static/rest-api.yaml diff --git a/static/rest-api.yaml b/static/rest-api.yaml index 13b358f08..8ca4c3b29 100644 --- a/static/rest-api.yaml +++ b/static/rest-api.yaml @@ -480,9 +480,10 @@ paths: value: 2500 summary: If SoC is not available => specify power in Watt schema: - oneOf: - - $ref: "#/components/parameters/soc" - - $ref: "#/components/parameters/power" + type: number + anyOf: + - $ref: "#/components/schemas/Soc" + - $ref: "#/components/schemas/Power" - name: type in: path required: true @@ -563,6 +564,8 @@ paths: more.](/en/docs/features/vehicle) tags: - Loadpoints + parameters: + - $ref: "#/components/parameters/id" responses: "200": $ref: "#/components/responses/EmptyResult" @@ -1154,7 +1157,9 @@ components: minimum: 0 example: 2500 Precondition: - description: Late charging duration in seconds. [Read more.](/en/docs/features/plans#late-charging) + description: >- + Late charging duration in seconds. [Read + more.](/en/docs/features/plans#late-charging) type: integer example: 3600 minimum: 0 @@ -1405,15 +1410,12 @@ components: in: path required: true schema: - oneOf: - - type: boolean - - type: string - - type: number + type: string enum: - "true" - "false" - - 1 - - 0 + - "1" + - "0" responses: NanoSecondsResult: description: Success - Number result - Unit is **nanoseconds** @@ -1500,6 +1502,7 @@ components: enum: - Unauthorized BatteryModeResult: + description: Battery mode. content: application/json: schema: