switch to openapi

This commit is contained in:
John
2021-04-05 10:06:22 +02:00
parent ca3bb9bac5
commit d2fab9fe56
2 changed files with 759 additions and 457 deletions
+759
View File
@@ -0,0 +1,759 @@
openapi: 3.0.1
info:
title: ebusd-http
description: The API that ebusd provides on HTTP port.
version: "21.3"
servers:
- url: http://127.0.0.1:8080/
paths:
/data:
get:
summary: Get all messages of all circuits.
parameters:
- name: since
in: query
description: limit to messages that have changed since the specified UTC seconds.
allowEmptyValue: false
schema:
minimum: 0
type: integer
- name: poll
in: query
description: set the poll priority of matching message(s) to prio.
allowEmptyValue: false
schema:
minimum: 0
type: integer
- name: verbose
in: query
description: include comments and field units.
allowEmptyValue: false
schema:
type: boolean
- name: indexed
in: query
description: always return field indexes instead of names.
allowEmptyValue: false
schema:
type: boolean
- name: numeric
in: query
description: return numeric values of value list entries.
allowEmptyValue: false
schema:
type: boolean
- name: valuename
in: query
description: include value and name for named values.
allowEmptyValue: false
schema:
type: boolean
- name: full
in: query
description: include all available attributes.
allowEmptyValue: false
schema:
type: boolean
- name: required
in: query
description: retrieve the data from the bus if not yet cached.
allowEmptyValue: false
schema:
type: boolean
- name: write
in: query
description: retrieve write messages in addition to read/poll messages.
allowEmptyValue: false
schema:
type: boolean
- name: raw
in: query
description: include raw master/slave data.
allowEmptyValue: false
schema:
type: boolean
- name: def
in: query
description: include message and field definition.
allowEmptyValue: false
schema:
type: boolean
- name: user
in: query
description: authenticate with user name.
allowEmptyValue: false
schema:
type: string
- name: secret
in: query
description: authenticate with user secret.
allowEmptyValue: false
schema:
type: string
responses:
200:
description: Success.
content:
application/json;charset=utf-8:
schema:
$ref: '#/components/schemas/Data'
400:
description: Invalid request parameters.
content: { }
403:
description: User not authorized.
content: { }
404:
description: Circuit or message not found.
content: { }
500:
description: General error.
content: { }
/data/{circuit}:
get:
summary: Get all messages of a particular circuit.
parameters:
- name: circuit
in: path
required: true
schema:
type: string
- name: since
in: query
description: limit to messages that have changed since the specified UTC seconds.
allowEmptyValue: false
schema:
minimum: 0
type: integer
- name: poll
in: query
description: set the poll priority of matching message(s) to prio.
allowEmptyValue: false
schema:
minimum: 0
type: integer
- name: exact
in: query
description: exact search for circuit/message name.
allowEmptyValue: false
schema:
type: boolean
- name: verbose
in: query
description: include comments and field units.
allowEmptyValue: false
schema:
type: boolean
- name: indexed
in: query
description: always return field indexes instead of names.
allowEmptyValue: false
schema:
type: boolean
- name: numeric
in: query
description: return numeric values of value list entries.
allowEmptyValue: false
schema:
type: boolean
- name: valuename
in: query
description: include value and name for named values.
allowEmptyValue: false
schema:
type: boolean
- name: full
in: query
description: include all available attributes.
allowEmptyValue: false
schema:
type: boolean
- name: required
in: query
description: retrieve the data from the bus if not yet cached.
allowEmptyValue: false
schema:
type: boolean
- name: write
in: query
description: retrieve write messages in addition to read/poll messages.
allowEmptyValue: false
schema:
type: boolean
- name: raw
in: query
description: include raw master/slave data.
allowEmptyValue: false
schema:
type: boolean
- name: def
in: query
description: include message and field definition.
allowEmptyValue: false
schema:
type: boolean
- name: user
in: query
description: authenticate with user name.
allowEmptyValue: false
schema:
type: string
- name: secret
in: query
description: authenticate with user secret.
allowEmptyValue: false
schema:
type: string
responses:
200:
description: Success.
content:
application/json;charset=utf-8:
schema:
$ref: '#/components/schemas/Data'
400:
description: Invalid request parameters.
content: { }
403:
description: User not authorized.
content: { }
404:
description: Circuit or message not found.
content: { }
500:
description: General error.
content: { }
/data/{circuit}/{message}:
get:
summary: Get a particular message of a particular circuit.
parameters:
- name: circuit
in: path
required: true
schema:
type: string
- name: message
in: path
required: true
schema:
type: string
- name: since
in: query
description: limit to messages that have changed since the specified UTC seconds.
allowEmptyValue: false
schema:
minimum: 0
type: integer
- name: poll
in: query
description: set the poll priority of matching message(s) to prio.
allowEmptyValue: false
schema:
minimum: 0
type: integer
- name: exact
in: query
description: exact search for circuit/message name.
allowEmptyValue: false
schema:
type: boolean
- name: verbose
in: query
description: include comments and field units.
allowEmptyValue: false
schema:
type: boolean
- name: indexed
in: query
description: always return field indexes instead of names.
allowEmptyValue: false
schema:
type: boolean
- name: numeric
in: query
description: return numeric values of value list entries.
allowEmptyValue: false
schema:
type: boolean
- name: valuename
in: query
description: include value and name for named values.
allowEmptyValue: false
schema:
type: boolean
- name: full
in: query
description: include all available attributes.
allowEmptyValue: false
schema:
type: boolean
- name: required
in: query
description: retrieve the data from the bus if not yet cached.
allowEmptyValue: false
schema:
type: boolean
- name: write
in: query
description: retrieve write messages in addition to read/poll messages.
allowEmptyValue: false
schema:
type: boolean
- name: raw
in: query
description: include raw master/slave data.
allowEmptyValue: false
schema:
type: boolean
- name: def
in: query
description: include message and field definition.
allowEmptyValue: false
schema:
type: boolean
- name: user
in: query
description: authenticate with user name.
allowEmptyValue: false
schema:
type: string
- name: secret
in: query
description: authenticate with user secret.
allowEmptyValue: false
schema:
type: string
responses:
200:
description: Success
content:
application/json;charset=utf-8:
schema:
$ref: '#/components/schemas/Data'
500:
description: Circuit or message not found.
content: { }
/{file}:
get:
summary: Retrieve a particular file.
parameters:
- name: file
in: path
description: the file to retrieve.
required: true
schema:
type: string
responses:
200:
description: Success
content:
text/html:
schema:
type: string
format: binary
text/css:
schema:
type: string
format: binary
application/javascript:
schema:
type: string
format: binary
image/png:
schema:
type: string
format: binary
image/jpeg:
schema:
type: string
format: binary
image/svg+xml:
schema:
type: string
format: binary
application/json;charset=utf-8:
schema:
type: string
format: binary
application/yaml;charset=utf-8:
schema:
type: string
format: binary
400:
description: Invalid request parameters.
content: { }
403:
description: User not authorized.
content: { }
404:
description: Circuit or message not found.
content: { }
500:
description: General error.
content: { }
head:
summary: Retrieve headers for a certain file.
parameters:
- name: file
in: path
description: the file to retrieve.
required: true
schema:
type: string
responses:
200:
description: Success
content:
application/json;charset=utf-8:
schema:
$ref: '#/components/schemas/Data'
400:
description: Circuit or message not found.
content: { }
components:
schemas:
Global:
required:
- lastup
- masters
- messages
- reconnects
- signal
- version
type: object
properties:
version:
pattern: '[0-9]+\.[0-9]+\.[0-9a-f]+\.'
type: string
description: the ebusd version (major.minor.sha1 or major.minor.date).
example: 3.0.1234abc
updatecheck:
type: string
description: the result of update check ("OK" or string describing available
updates).
example: revision 1234abd available, 5 newer configuration files available
signal:
type: boolean
description: whether signal is available.
example: true
symbolrate:
minimum: 0
type: integer
description: the current symbol rate on the bus.
example: 31
maxsymbolrate:
minimum: 0
type: integer
description: the maximum symbol rate on the bus seen since start.
example: 167
qq:
maximum: 255
minimum: 0
type: integer
description: the ebusd master address (only if not readonly).
example: 49
reconnects:
minimum: 0
type: integer
description: the number of reconnects to the device since start.
example: 0
masters:
minimum: 0
type: integer
description: the number of masters recognized on the bus.
example: 5
messages:
minimum: 0
type: integer
description: the number of known message definitions.
example: 893
lastup:
minimum: 0
type: integer
description: the time in UTC seconds of the last update of any message.
example: 1493483370
Circuit:
type: object
properties:
name:
type: string
description: the circuit name.
zz:
maximum: 255
minimum: 0
type: integer
description: the circuit slave address.
example: 8
messages:
type: object
additionalProperties:
$ref: '#/components/schemas/Message'
Message:
required:
- lastup
- name
- passive
- write
type: object
properties:
name:
type: string
description: the message name.
passive:
type: boolean
description: true when this is a passive message.
write:
type: boolean
description: true for a write message, false for a read message.
lastup:
minimum: 0
type: integer
description: the time in UTC seconds of the last update of the message (0
for never).
qq:
maximum: 255
minimum: 0
type: integer
description: limited source master address (only with def).
example: 49
zz:
maximum: 255
minimum: 0
type: integer
description: destination master or slave address.
example: 8
id:
type: array
description: the message ID composed of PBSB and further master data bytes
(only with def).
items:
maximum: 255
minimum: 0
type: integer
comment:
type: string
description: the message comment (only with verbose).
master:
type: array
description: the last seen master data bytes (only with raw and if available).
items:
maximum: 255
minimum: 0
type: integer
slave:
type: array
description: the last seen slave data bytes (only with raw and if available).
items:
maximum: 255
minimum: 0
type: integer
fields:
type: object
additionalProperties:
$ref: '#/components/schemas/Field'
description: the decoded fields the message is composed of (only if available).
fielddefs:
type: array
description: the field definitions the message is composed of (only with
def).
items:
$ref: '#/components/schemas/FieldDef'
Field:
type: object
properties:
name:
type: string
description: the field name.
value:
type: object
description: the field value.
unit:
type: string
description: the field unit (only with verbose).
comment:
type: string
description: the field comment (only with verbose).
FieldDef:
required:
- isbits
- length
- name
- slave
- type
type: object
properties:
name:
type: string
description: the field name.
slave:
type: boolean
description: whether the field is part of the slave data.
type:
type: string
description: the field type.
isbits:
type: boolean
description: true when the length is in bits.
length:
type: number
description: the field length in bytes (-1 for remainder, number of bits
when isbits is true).
divisor:
type: number
description: the extra divisor applied to the raw value (only if applicable).
value:
type: string
description: the constant value (only if applicable).
verify:
type: boolean
description: whether the constant value is verified when decoding (only
if applicable).
values:
type: object
additionalProperties:
type: string
description: the value name.
description: the raw numeric value to name assignments (only if applicable).
unit:
type: string
description: the field unit.
comment:
type: string
description: the field comment.
Data:
required:
- global
type: object
properties:
global:
$ref: '#/components/schemas/Global'
additionalProperties:
$ref: '#/components/schemas/Circuit'
responses:
BadRequest:
description: Invalid request parameters.
content: { }
GeneralError:
description: General error.
content: { }
NotAuthorized:
description: User not authorized.
content: { }
NotFound:
description: Circuit or message not found.
content: { }
parameters:
circuitParam:
name: circuit
in: path
required: true
schema:
type: string
messageParam:
name: message
in: path
required: true
schema:
type: string
sinceQuery:
name: since
in: query
description: limit to messages that have changed since the specified UTC seconds.
allowEmptyValue: false
schema:
minimum: 0
type: integer
pollQuery:
name: poll
in: query
description: set the poll priority of matching message(s) to prio.
allowEmptyValue: false
schema:
minimum: 0
type: integer
exactQuery:
name: exact
in: query
description: exact search for circuit/message name.
allowEmptyValue: false
schema:
type: boolean
verboseQuery:
name: verbose
in: query
description: include comments and field units.
allowEmptyValue: false
schema:
type: boolean
indexedQuery:
name: indexed
in: query
description: always return field indexes instead of names.
allowEmptyValue: false
schema:
type: boolean
numericQuery:
name: numeric
in: query
description: return numeric values of value list entries.
allowEmptyValue: false
schema:
type: boolean
valuenameQuery:
name: valuename
in: query
description: include value and name for named values.
allowEmptyValue: false
schema:
type: boolean
fullQuery:
name: full
in: query
description: include all available attributes.
allowEmptyValue: false
schema:
type: boolean
requiredQuery:
name: required
in: query
description: retrieve the data from the bus if not yet cached.
allowEmptyValue: false
schema:
type: boolean
writeQuery:
name: write
in: query
description: retrieve write messages in addition to read/poll messages.
allowEmptyValue: false
schema:
type: boolean
rawQuery:
name: raw
in: query
description: include raw master/slave data.
allowEmptyValue: false
schema:
type: boolean
defQuery:
name: def
in: query
description: include message and field definition.
allowEmptyValue: false
schema:
type: boolean
userQuery:
name: user
in: query
description: authenticate with user name.
allowEmptyValue: false
schema:
type: string
secretQuery:
name: secret
in: query
description: authenticate with user secret.
allowEmptyValue: false
schema:
type: string