From 0c347260fa2466001db07f133799a68db88a3d8a Mon Sep 17 00:00:00 2001 From: TJ Date: Mon, 19 Feb 2024 12:04:41 +0900 Subject: [PATCH 1/2] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20isolate=20Comman?= =?UTF-8?q?dResponseType=20CommandResultType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for re-use in OCPI server --- .../requestBodies/StartSession.yaml | 55 ------------------- .../components/schemas/CommandResponse.yaml | 8 +-- .../schemas/CommandResponseType.yaml | 7 +++ openapi/components/schemas/CommandResult.yaml | 14 +---- ...ltTypeEnum.yaml => CommandResultType.yaml} | 0 openapi/components/schemas/CommandType.yaml | 8 +++ openapi/paths/commands_start_session.yaml | 5 +- 7 files changed, 18 insertions(+), 79 deletions(-) create mode 100644 openapi/components/schemas/CommandResponseType.yaml rename openapi/components/schemas/{CommandResultTypeEnum.yaml => CommandResultType.yaml} (100%) create mode 100644 openapi/components/schemas/CommandType.yaml diff --git a/openapi/components/requestBodies/StartSession.yaml b/openapi/components/requestBodies/StartSession.yaml index 36bb95c..66323e2 100644 --- a/openapi/components/requestBodies/StartSession.yaml +++ b/openapi/components/requestBodies/StartSession.yaml @@ -3,58 +3,3 @@ content: application/json: schema: $ref: ../schemas/StartSession.yaml - examples: - 'Simple StartSession example of just starting a session': - value: - country_code: 'NL' - party_id: 'STK' - id: '101' - start_date_time: '2020-03-09T10:17:09Z' - kwh: 0.0 - cdr_token: - uid: '123abc' - type: 'RFID' - contract_id: 'NL-TST-C12345678-S' - auth_method: 'WHITELIST' - location_id: 'LOC1' - evse_uid: '3256' - connector_id: '1' - currency: 'EUR' - total_cost: - excl_vat: 2.5 - status: 'PENDING' - last_updated: '2020-03-09T10:17:09Z' - 'Simple StartSession example of a short finished session': - value: - country_code: 'BE' - party_id: 'BEC' - id: '101' - start_date_time: '2015-06-29T22:39:09Z' - end_date_time: '2015-06-29T23:50:16Z' - kwh: 41.00 - cdr_token: - uid: '123abc' - type: 'RFID' - contract_id: 'NL-TST-C12345678-S' - auth_method: 'WHITELIST' - location_id: 'LOC1' - evse_uid: '3256' - connector_id: '1' - currency: 'EUR' - charging_periods: - - start_date_time: '2015-06-29T22:39:09Z' - dimensions: - - type: 'ENERGY' - volume: 120 - - type: 'MAX_CURRENT' - volume: 30 - - start_date_time: '2015-06-29T22:40:54Z' - dimensions: - - type: 'ENERGY' - volume: 41000 - - type: 'MIN_CURRENT' - volume: 34 - - start_date_time: '2015-06-29T23:07:09Z' - dimensions: - - type: 'ENERGY' - volume: 41000 diff --git a/openapi/components/schemas/CommandResponse.yaml b/openapi/components/schemas/CommandResponse.yaml index 6028f6c..def5e73 100644 --- a/openapi/components/schemas/CommandResponse.yaml +++ b/openapi/components/schemas/CommandResponse.yaml @@ -4,13 +4,7 @@ required: - timeout properties: result: - type: string - enum: - - NOT_SUPPORTED - - REJECTED - - UNKNOWN_SESSION - - ACCEPTED - example: ACCEPTED + $ref: ../schemas/CommandResponseType.yaml timeout: type: integer message: diff --git a/openapi/components/schemas/CommandResponseType.yaml b/openapi/components/schemas/CommandResponseType.yaml new file mode 100644 index 0000000..535a0a9 --- /dev/null +++ b/openapi/components/schemas/CommandResponseType.yaml @@ -0,0 +1,7 @@ +type: string +summary: CommandResponseType enum +enum: + - NOT_SUPPORTED + - REJECTED + - ACCEPTED + - UNKNOWN_SESSION diff --git a/openapi/components/schemas/CommandResult.yaml b/openapi/components/schemas/CommandResult.yaml index 7623f24..ab35324 100644 --- a/openapi/components/schemas/CommandResult.yaml +++ b/openapi/components/schemas/CommandResult.yaml @@ -4,18 +4,6 @@ required: type: object properties: result: - type: string - summary: CommandResultType enum - description: Result of the command that was send to the Charge Point. - enum: - - ACCEPTED - - CANCELED_RESERVATION - - EVSE_OCCUPIED - - EVSE_INOPERATIVE - - FAILED - - NOT_SUPPORTED - - REJECTED - - TIMEOUT - - UNKNOWN_RESERVATION + $ref: CommandResultType.yaml message: $ref: ../schemas/DisplayText.yaml diff --git a/openapi/components/schemas/CommandResultTypeEnum.yaml b/openapi/components/schemas/CommandResultType.yaml similarity index 100% rename from openapi/components/schemas/CommandResultTypeEnum.yaml rename to openapi/components/schemas/CommandResultType.yaml diff --git a/openapi/components/schemas/CommandType.yaml b/openapi/components/schemas/CommandType.yaml new file mode 100644 index 0000000..f56f36a --- /dev/null +++ b/openapi/components/schemas/CommandType.yaml @@ -0,0 +1,8 @@ +type: string +summary: CommandType enum +enum: + - CANCEL_RESERVATION + - RESERVE_NOW + - START_SESSION + - STOP_SESSION + - UNLOCK_CONNECTOR diff --git a/openapi/paths/commands_start_session.yaml b/openapi/paths/commands_start_session.yaml index 9b32b94..7bdf4ff 100644 --- a/openapi/paths/commands_start_session.yaml +++ b/openapi/paths/commands_start_session.yaml @@ -8,10 +8,7 @@ post: - tokenAuth: [] operationId: startSession requestBody: - content: - application/json: - schema: - $ref: ../components/schemas/StartSession.yaml + $ref: ../components/requestBodies/StartSession.yaml responses: 200: $ref: ../components/responses/CommandResponse.yaml From 2fddd569b76a37803269971c4faddd34cc44da2d Mon Sep 17 00:00:00 2001 From: TJ Date: Mon, 19 Feb 2024 12:05:05 +0900 Subject: [PATCH 2/2] =?UTF-8?q?chore:=20=F0=9F=A4=96=200.0.16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openapi/openapi.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index 212654b..c526148 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -1,6 +1,6 @@ openapi: 3.1.0 info: - version: 0.0.15 + version: 0.0.16 title: OCPI contact: