Skip to content

Commit 8830ec1

Browse files
authored
Docs: Update testing YAML per review comments (project-chip#31628)
* address review comments * regenerate tables * Docs: Exclude YAML tables from restyler The restyler removes all the newlines that cause the table to render correctly.
1 parent 7f5e208 commit 8830ec1

File tree

4 files changed

+107
-37
lines changed

4 files changed

+107
-37
lines changed

.restyled.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ exclude:
8686
- "scripts/setup/pigweed.json" # TODO(#29547). This file is temporary copy from pigweed repo that has minor edits. No restyle help in diff.
8787
- "docs/ERROR_CODES.md" # generated by scripts, not easy to align tables
8888
- "docs/clusters.md" # generated by scripts, not easy to align tables
89+
- "docs/testing/yaml_pseudocluster.md" # generated by scripts, restyler makes the tables render improperly
90+
- "docs/testing/yaml_schema.md" # generated by scripts, restyler makes the tables render improperly
8991

9092
changed_paths:
9193
maximum: 100000

docs/testing/yaml_pseudocluster.md

+34-10
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,69 @@ Script: generate_pseudo_cluster_doc_tables.py
66

77
# YAML Pseudo-clusters
88

9-
CommissionerCommands |command|args|arg type| arg optional| |:---|:---|:---|:---|
9+
10+
11+
CommissionerCommands
12+
|command|args|arg type| arg optional|
13+
|:---|:---|:---|:---|
1014
|PairWithCode|nodeId<br />payload<br />discoverOnce|node_id<br />char_string<br />boolean|false<br />false<br />true|
11-
|Unpair|nodeId|node_id|false| |GetCommissionerNodeId||||
15+
|Unpair|nodeId|node_id|false|
16+
|GetCommissionerNodeId||||
1217
|GetCommissionerNodeIdResponse|nodeId|node_id|false|
1318
|GetCommissionerRootCertificate||||
1419
|GetCommissionerRootCertificateResponse|RCAC|OCTET_STRING|false|
1520
|IssueNocChain|Elements<br />nodeId|octet_string<br />node_id|false<br />false|
1621
|IssueNocChainResponse|NOC<br />ICAC<br />RCAC<br />IPK|octet_string<br />octet_string<br />octet_string<br />octet_string|false<br />false<br />false<br />false|
1722

18-
DelayCommands |command|args|arg type| arg optional| |:---|:---|:---|:---|
23+
24+
DelayCommands
25+
|command|args|arg type| arg optional|
26+
|:---|:---|:---|:---|
1927
|WaitForCommissioning||||
2028
|WaitForCommissionee|nodeId<br />expireExistingSession|node_id<br />bool|false<br />true|
2129
|WaitForMs|ms|int16u|false|
2230
|WaitForMessage|registerKey<br />message|char_string<br />char_string|false<br />false|
2331

24-
DiscoveryCommands |command|args|arg type| arg optional| |:---|:---|:---|:---|
32+
33+
DiscoveryCommands
34+
|command|args|arg type| arg optional|
35+
|:---|:---|:---|:---|
2536
|FindCommissionable||||
2637
|FindCommissionableByShortDiscriminator|value|int16u|false|
2738
|FindCommissionableByLongDiscriminator|value|int16u|false|
2839
|FindCommissionableByCommissioningMode||||
2940
|FindCommissionableByVendorId|value|vendor_id|false|
30-
|FindCommissionableByDeviceType|value|devtype_id|false| |FindCommissioner||||
41+
|FindCommissionableByDeviceType|value|devtype_id|false|
42+
|FindCommissioner||||
3143
|FindCommissionerByVendorId|value|vendor_id|false|
3244
|FindCommissionerByDeviceType|value|devtype_id|false|
3345
|FindResponse|hostName<br />instanceName<br />longDiscriminator<br />shortDiscriminator<br />vendorId<br />productId<br />commissioningMode<br />deviceType<br />deviceName<br />rotatingId<br />rotatingIdLen<br />pairingHint<br />pairingInstruction<br />supportsTcp<br />numIPs<br />port<br />mrpRetryIntervalIdle<br />mrpRetryIntervalActive<br />mrpRetryActiveThreshold<br />isICDOperatingAsLIT|char_string<br />char_string<br />int16u<br />int16u<br />vendor_id<br />int16u<br />int8u<br />devtype_id<br />char_string<br />octet_string<br />int64u<br />int16u<br />char_string<br />boolean<br />int8u<br />int16u<br />int32u<br />int32u<br />int16u<br />boolean|false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />false<br />true<br />true<br />true<br />true|
3446

35-
EqualityCommands |command|args|arg type| arg optional| |:---|:---|:---|:---|
47+
48+
EqualityCommands
49+
|command|args|arg type| arg optional|
50+
|:---|:---|:---|:---|
3651
|BooleanEquals|Value1<br />Value2|boolean<br />boolean|false<br />false|
3752
|SignedNumberEquals|Value1<br />Value2|int64s<br />int64s|false<br />false|
3853
|UnsignedNumberEquals|Value1<br />Value2|int64u<br />int64u|false<br />false|
3954
|EqualityResponse|Equals|bool|false|
4055

41-
LogCommands |command|args|arg type| arg optional| |:---|:---|:---|:---|
56+
57+
LogCommands
58+
|command|args|arg type| arg optional|
59+
|:---|:---|:---|:---|
4260
|Log|message|char_string|false|
4361
|UserPrompt|message<br />expectedValue|char_string<br />char_string|false<br />true|
4462

45-
SystemCommands |command|args|arg type| arg optional| |:---|:---|:---|:---|
46-
|Start|registerKey<br />discriminator<br />port<br />minCommissioningTimeout<br />kvs<br />filepath<br />otaDownloadPath|char_string<br />int16u<br />int16u<br />int16u<br />char_string<br />char_string<br />char_string|true<br />true<br />true<br />true<br />true<br />true<br />true|
47-
|Stop|registerKey|char_string|true| |Reboot|registerKey|char_string|true|
63+
64+
SystemCommands
65+
|command|args|arg type| arg optional|
66+
|:---|:---|:---|:---|
67+
|Start|registerKey<br />discriminator<br />port<br />minCommissioningTimeout<br />kvs<br />filepath<br />otaDownloadPath<br />endUserSupportLogPath<br />networkDiagnosticsLogPath<br />crashLogPath|char_string<br />int16u<br />int16u<br />int16u<br />char_string<br />char_string<br />char_string<br />char_string<br />char_string<br />char_string|true<br />true<br />true<br />true<br />true<br />true<br />true<br />true<br />true<br />true|
68+
|Stop|registerKey|char_string|true|
69+
|Reboot|registerKey|char_string|true|
4870
|FactoryReset|registerKey|char_string|true|
4971
|CreateOtaImage|otaImageFilePath<br />rawImageFilePath<br />rawImageContent|char_string<br />char_string<br />char_string|false<br />false<br />false|
5072
|CompareFiles|file1<br />file2|char_string<br />char_string|false<br />false|
73+
|CreateFile|filePath<br />fileContent|char_string<br />char_string|false<br />false|
74+
|DeleteFile|filePath|char_string|false|

docs/testing/yaml_schema.md

+67-27
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,70 @@ Script: generate_yaml_doc_tables.py
66

77
# YAML Schema
88

9-
YAML schema |key | type| supports variables |:---|:---|:---| |name |str|| |PICS
10-
|str,list|| |config | | | |&emsp; nodeId |int|| |&emsp; cluster |str|| |&emsp;
11-
endpoint |int|| |&emsp; _variableName_ | | | |&emsp; &emsp; type |type|| |&emsp;
12-
&emsp; defaultValue |Any|| |tests | | | |&emsp; label |str|| |&emsp; identity
13-
|str|| |&emsp; nodeId |int|Y| |&emsp; runIf |str|| |&emsp; groupId |int|Y|
14-
|&emsp; endpoint |int|Y| |&emsp; cluster |str|| |&emsp; attribute |str|| |&emsp;
15-
command |str|| |&emsp; event |str|| |&emsp; eventNumber |int|Y| |&emsp; disabled
16-
|bool|| |&emsp; fabricFiltered |bool|| |&emsp; verification |str|| |&emsp; PICS
17-
|str|| |&emsp; arguments | | | |&emsp; &emsp; values | | | |&emsp; &emsp; &emsp;
18-
value |NoneType,bool,int,float,dict,list|Y| |&emsp; &emsp; &emsp; name |str||
19-
|&emsp; &emsp; value |NoneType,bool,int,float,dict,list|Y| |&emsp; response | |Y
20-
| |&emsp; &emsp; value |NoneType,bool,int,float,dict,list|Y| |&emsp; &emsp; name
21-
|str|| |&emsp; &emsp; error |str|| |&emsp; &emsp; clusterError |int|| |&emsp;
22-
&emsp; constraints | | | |&emsp; &emsp; &emsp; hasValue |bool|| |&emsp; &emsp;
23-
&emsp; type |str|| |&emsp; &emsp; &emsp; minLength |int|| |&emsp; &emsp; &emsp;
24-
maxLength |int|| |&emsp; &emsp; &emsp; isHexString |bool|| |&emsp; &emsp; &emsp;
25-
startsWith |str|| |&emsp; &emsp; &emsp; endsWith |str|| |&emsp; &emsp; &emsp;
26-
isUpperCase |bool|| |&emsp; &emsp; &emsp; isLowerCase |bool|| |&emsp; &emsp;
27-
&emsp; minValue |int,float|Y| |&emsp; &emsp; &emsp; maxValue |int,float|Y|
28-
|&emsp; &emsp; &emsp; contains |list|| |&emsp; &emsp; &emsp; excludes |list||
29-
|&emsp; &emsp; &emsp; hasMasksSet |list|| |&emsp; &emsp; &emsp; hasMasksClear
30-
|list|| |&emsp; &emsp; &emsp; notValue |NoneType,bool,int,float,list,dict|Y|
31-
|&emsp; &emsp; &emsp; anyOf |list|| |&emsp; &emsp; saveAs |str|| |&emsp; &emsp;
32-
saveDataVersschemaionAs |str|| |&emsp; saveResponseAs |str|| |&emsp; minInterval
33-
|int|| |&emsp; maxInterval |int|| |&emsp; keepSubscriptions |bool|| |&emsp;
34-
timeout |int|| |&emsp; timedInteractionTimeoutMs |int|| |&emsp; dataVersion
35-
|list,int|Y| |&emsp; busyWaitMs |int|| |&emsp; wait |str||
9+
YAML schema
10+
|key | type| supports variables
11+
|:---|:---|:---|
12+
|name |str||
13+
|PICS |str,list||
14+
|config | | |
15+
|&emsp; nodeId |int||
16+
|&emsp; cluster |str||
17+
|&emsp; endpoint |int||
18+
|&emsp; _variableName_ | | |
19+
|&emsp; &emsp; type |type||
20+
|&emsp; &emsp; defaultValue |Any||
21+
|tests | | |
22+
|&emsp; label |str||
23+
|&emsp; identity |str||
24+
|&emsp; nodeId |int|Y|
25+
|&emsp; runIf |str||
26+
|&emsp; groupId |int|Y|
27+
|&emsp; endpoint |int|Y|
28+
|&emsp; cluster |str||
29+
|&emsp; attribute |str||
30+
|&emsp; command |str||
31+
|&emsp; event |str||
32+
|&emsp; eventNumber |int|Y|
33+
|&emsp; disabled |bool||
34+
|&emsp; fabricFiltered |bool||
35+
|&emsp; verification |str||
36+
|&emsp; PICS |str||
37+
|&emsp; arguments | | |
38+
|&emsp; &emsp; values | | |
39+
|&emsp; &emsp; &emsp; value |NoneType,bool,int,float,dict,list|Y|
40+
|&emsp; &emsp; &emsp; name |str||
41+
|&emsp; &emsp; value |NoneType,bool,int,float,dict,list|Y|
42+
|&emsp; response | |Y |
43+
|&emsp; &emsp; value |NoneType,bool,int,float,dict,list|Y|
44+
|&emsp; &emsp; name |str||
45+
|&emsp; &emsp; error |str||
46+
|&emsp; &emsp; clusterError |int||
47+
|&emsp; &emsp; constraints | | |
48+
|&emsp; &emsp; &emsp; hasValue |bool||
49+
|&emsp; &emsp; &emsp; type |str||
50+
|&emsp; &emsp; &emsp; minLength |int||
51+
|&emsp; &emsp; &emsp; maxLength |int||
52+
|&emsp; &emsp; &emsp; isHexString |bool||
53+
|&emsp; &emsp; &emsp; startsWith |str||
54+
|&emsp; &emsp; &emsp; endsWith |str||
55+
|&emsp; &emsp; &emsp; isUpperCase |bool||
56+
|&emsp; &emsp; &emsp; isLowerCase |bool||
57+
|&emsp; &emsp; &emsp; minValue |int,float|Y|
58+
|&emsp; &emsp; &emsp; maxValue |int,float|Y|
59+
|&emsp; &emsp; &emsp; contains |list||
60+
|&emsp; &emsp; &emsp; excludes |list||
61+
|&emsp; &emsp; &emsp; hasMasksSet |list||
62+
|&emsp; &emsp; &emsp; hasMasksClear |list||
63+
|&emsp; &emsp; &emsp; notValue |NoneType,bool,int,float,list,dict|Y|
64+
|&emsp; &emsp; &emsp; anyOf |list||
65+
|&emsp; &emsp; saveAs |str||
66+
|&emsp; &emsp; saveDataVersschemaionAs |str||
67+
|&emsp; saveResponseAs |str||
68+
|&emsp; minInterval |int||
69+
|&emsp; maxInterval |int||
70+
|&emsp; keepSubscriptions |bool||
71+
|&emsp; timeout |int||
72+
|&emsp; timedInteractionTimeoutMs |int||
73+
|&emsp; dataVersion |list,int|Y|
74+
|&emsp; busyWaitMs |int||
75+
|&emsp; wait |str||

scripts/py_matter_yamltests/generate_yaml_doc_tables.py

+4
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,16 @@
2626

2727

2828
def get_type_list_and_vars(typetuple) -> (list[type], bool):
29+
"Returns a list of supported types for this type tuple and a bool indicating if variables are supported."
2930
# If str is one of the supported types, and other base types are supported,
3031
# this means it supports variables.
3132
# This is a heuristic, but it's true for now.
3233
try:
3334
typelist = list(typetuple)
3435
if str in typelist:
36+
# The tuple passed from the yaml parser is a tuple of type classes
37+
# Here, we directly compare to the base type because that's what
38+
# we get from the parser (ex. (bool, int, str))
3539
reduced = [t for t in typelist if t != str]
3640
if reduced != [list]:
3741
return (reduced, True)

0 commit comments

Comments
 (0)