Skip to content

Commit

Permalink
Splitting out some models into separate files
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremypoulter committed Sep 11, 2021
1 parent 0666930 commit 13e240b
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 186 deletions.
2 changes: 1 addition & 1 deletion .stoplight.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"json_schema": {
"rootDir": "models",
"include": [
"**"
"models/**"
]
},
"markdown": {
Expand Down
55 changes: 11 additions & 44 deletions api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Properties'
$ref: ./models/Properties.yaml
'404':
$ref: '#/components/responses/NotFound'
operationId: getManualOverride
Expand All @@ -121,7 +121,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Properties'
$ref: ./models/Properties.yaml
responses:
'200':
description: OK
Expand Down Expand Up @@ -161,7 +161,7 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/Claim'
$ref: ./models/Claim.yaml
operationId: listClaims
tags:
- Claims
Expand All @@ -174,7 +174,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Properties'
$ref: ./models/Properties.yaml
'404':
$ref: '#/components/responses/NotFound'
parameters: []
Expand All @@ -188,7 +188,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/Properties'
$ref: ./models/Properties.yaml
responses:
'200':
description: OK
Expand Down Expand Up @@ -236,7 +236,7 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/ScheduleEvent'
$ref: ./models/EvseState.yaml
'400':
$ref: '#/components/responses/BadRequest'
operationId: listSchedule
Expand All @@ -258,7 +258,7 @@ paths:
schema:
type: array
items:
$ref: '#/components/schemas/ScheduleEvent'
$ref: ./models/EvseState.yaml
examples:
example-1:
value:
Expand Down Expand Up @@ -287,7 +287,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ScheduleEvent'
$ref: ./models/EvseState.yaml
operationId: getScheduleEvent
tags:
- Schedule
Expand All @@ -299,7 +299,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ScheduleEvent'
$ref: ./models/EvseState.yaml
description: ''
operationId: setScheduleEvent
tags:
Expand Down Expand Up @@ -365,54 +365,21 @@ paths:
required: true
components:
schemas:
Properties:
title: EVSE properties
type: object
properties:
state:
$ref: '#/components/schemas/EvseState'
auto_release:
type: boolean
description: |
`true` if the manual override is auto-released when the vehicle is
disconnected, `false` if manual override will persist after vehicle
disconnection.
Message:
title: Informational message
type: object
properties:
msg:
type: string
description: The message
ClientId:
title: EVSE Client ID
type: integer
description: 'The client ID, defined by [OpenEVSE](https://github.com/OpenEVSE/ESP32_WiFi_V4.x/blob/master/src/evse_man.h#L25)'
Claim:
title: EVSE claim
allOf:
- type: object
properties:
client:
$ref: '#/components/schemas/ClientId'
priority:
type: integer
description: 'The priority of the claim, the higher the number the higher the priority'
- $ref: '#/components/schemas/Properties'
EvseState:
title: EVSE state
type: string
enum:
- active
- disabled
ScheduleEvent:
type: object
properties:
id:
type: integer
example: 1
state:
$ref: '#/components/schemas/EvseState'
$ref: './models/EvseState.yaml'
time:
type: string
format: time
Expand Down Expand Up @@ -463,7 +430,7 @@ components:
- notification
- warning
managerState:
$ref: '#/components/schemas/EvseState'
$ref: './models/EvseState.yaml'
evseState:
type: integer
minimum: 0
Expand Down
13 changes: 13 additions & 0 deletions models/Claim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: EVSE claim
allOf:
- type: object
properties:
client:
type: integer
description: 'The client ID, defined by [OpenEVSE](src/evse_man.h#L25)'
priority:
type: integer
description: 'The priority of the claim, the higher the number the higher the priority'
- $ref: ./Properties.yaml
x-tags:
- Claims
2 changes: 2 additions & 0 deletions models/Config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,3 +347,5 @@ properties:
charge_mode:
type: string
minLength: 1
x-tags:
- Config
8 changes: 8 additions & 0 deletions models/EvseState.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
title: EvseState
type: string
enum:
- active
- disabled
x-tags:
- Claims
- Status
14 changes: 14 additions & 0 deletions models/Properties.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
title: Properties
type: object
x-tags:
- Claims
properties:
state:
$ref: ./EvseState.yaml
auto_release:
type: boolean
description: |
`true` if the manual override is auto-released when the vehicle is
disconnected, `false` if manual override will persist after vehicle
disconnection.
description: ''
Loading

0 comments on commit 13e240b

Please sign in to comment.