Skip to content

Commit 7c8d2db

Browse files
committed
fix(openapi): Fix OpenAPI docs which caused out-of-memory errors in redoc
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
1 parent 8bc1fe2 commit 7c8d2db

File tree

4 files changed

+120
-77
lines changed

4 files changed

+120
-77
lines changed

doc/openapi/components/schemas/config/nodes/modbus.yaml

Lines changed: 16 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -4,90 +4,16 @@
44
---
55
allOf:
66
- type: object
7-
anyOf:
8-
- required: [transport, remote]
9-
properties:
10-
11-
transport:
12-
type: string
13-
enum:
14-
- tcp
15-
16-
remote:
17-
type: string
18-
description: The hostname or IP of the modbus TCP device.
19-
example: example.com
20-
21-
port:
22-
type: integer
23-
description: The port number of the modbus TCP device.
24-
default: 1883
25-
26-
unit:
27-
type: integer
28-
description: The addressed unit used for serial communication. This is optional for TCP.
29-
minimum: 0
30-
maximum: 65535
31-
example: 1
32-
33-
- required: [transport, device, baudrate, parity, data_bits, stop_bits, unit]
34-
properties:
35-
36-
transport:
37-
type: string
38-
enum:
39-
- rtu
40-
41-
device:
42-
type: string
43-
description: Path to the serial device file.
44-
example: /dev/ttyS0
45-
46-
baudrate:
47-
type: integer
48-
description: The baudrate used for serial communication.
49-
example: 9600
50-
51-
parity:
52-
type: string
53-
enum:
54-
- none
55-
- even
56-
- odd
57-
description: The parity used for serial communication.
58-
example: none
59-
60-
data_bits:
61-
type: integer
62-
description: The data bits used for serial communication.
63-
minimum: 5
64-
maximum: 8
65-
example: 5
66-
67-
stop_bits:
68-
type: integer
69-
description: The stop bits used for serial communication.
70-
minimum: 1
71-
maximum: 2
72-
example: 5
73-
74-
unit:
75-
type: integer
76-
description: The addressed unit used for serial communication. This is optional for TCP.
77-
minimum: 0
78-
maximum: 65535
79-
example: 1
80-
7+
requires: [transport]
818
properties:
82-
839
response_timeout:
8410
type: number
85-
description: The timeout in seconds when waiting for responses from a modbus server.
11+
description: The timeout in seconds when waiting for responses from a Modbus server.
8612
example: 1.0
8713

8814
rate:
8915
type: number
90-
description: The rate at which modbus device registers are queried for changes.
16+
description: The rate at which Modbus device registers are queried for changes.
9117
example: 1.0
9218

9319
in:
@@ -106,4 +32,17 @@ allOf:
10632
items:
10733
$ref: ./signals/modbus_signal.yaml
10834

35+
transport:
36+
type: string
37+
description: The transport protocol used for Modbus communication.
38+
enum:
39+
- tcp
40+
- rtu
41+
42+
discriminator:
43+
propertyName: transport
44+
mapping:
45+
tcp: modbus_tcp.yaml
46+
rtu: modbus_rtu.yaml
47+
10948
- $ref: ../node.yaml
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# yaml-language-server: $schema=http://json-schema.org/draft-07/schema
2+
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
3+
# SPDX-License-Identifier: Apache-2.0
4+
---
5+
type: object
6+
properties:
7+
response_timeout:
8+
type: number
9+
description: The timeout in seconds when waiting for responses from a Modbus server.
10+
example: 1.0
11+
12+
rate:
13+
type: number
14+
description: The rate at which Modbus device registers are queried for changes.
15+
example: 1.0
16+
17+
in:
18+
type: object
19+
properties:
20+
signals:
21+
type: array
22+
items:
23+
$ref: ./signals/modbus_signal.yaml
24+
25+
out:
26+
type: object
27+
properties:
28+
signals:
29+
type: array
30+
items:
31+
$ref: ./signals/modbus_signal.yaml
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# yaml-language-server: $schema=http://json-schema.org/draft-07/schema
2+
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
3+
# SPDX-License-Identifier: Apache-2.0
4+
---
5+
type: object
6+
required: [device, baudrate, parity, data_bits, stop_bits, unit]
7+
8+
properties:
9+
10+
device:
11+
type: string
12+
description: Path to the serial device file.
13+
example: /dev/ttyS0
14+
15+
baudrate:
16+
type: integer
17+
description: The baudrate used for serial communication.
18+
example: 9600
19+
20+
parity:
21+
type: string
22+
enum:
23+
- none
24+
- even
25+
- odd
26+
description: The parity used for serial communication.
27+
example: none
28+
29+
data_bits:
30+
type: integer
31+
description: The data bits used for serial communication.
32+
minimum: 5
33+
maximum: 8
34+
example: 5
35+
36+
stop_bits:
37+
type: integer
38+
description: The stop bits used for serial communication.
39+
minimum: 1
40+
maximum: 2
41+
example: 5
42+
43+
unit:
44+
type: integer
45+
description: The addressed unit used for serial communication. This is optional for TCP.
46+
minimum: 0
47+
maximum: 65535
48+
example: 1
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# yaml-language-server: $schema=http://json-schema.org/draft-07/schema
2+
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
3+
# SPDX-License-Identifier: Apache-2.0
4+
---
5+
type: object
6+
required: [remote]
7+
8+
properties:
9+
10+
remote:
11+
type: string
12+
description: The hostname or IP of the Modbus TCP device.
13+
example: example.com
14+
15+
port:
16+
type: integer
17+
description: The port number of the Modbus TCP device.
18+
default: 1883
19+
20+
unit:
21+
type: integer
22+
description: The addressed unit used for serial communication. This is optional for TCP.
23+
minimum: 0
24+
maximum: 65535
25+
example: 1

0 commit comments

Comments
 (0)