Skip to content

Commit baa24d5

Browse files
committed
chore: rename configurations to profile and add set additionalproperties to false
1 parent 0efeaeb commit baa24d5

File tree

3 files changed

+89
-33
lines changed

3 files changed

+89
-33
lines changed

etc/robot.json

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"$id": "robotframework:https://raw.githubusercontent.com/d-biehl/robotcode/main/etc/robot.json",
33
"$schema": "http://json-schema.org/draft-07/schema#",
4+
"additionalProperties": false,
45
"definitions": {
56
"DetachableConfiguration": {
7+
"additionalProperties": false,
68
"properties": {
79
"args": {
810
"description": "Extra arguments to be passed to Robot Framework\n\nExamples:\n```toml\nargs = [\"-t\", \"abc\"]\n```\n",
@@ -25,9 +27,9 @@
2527
"title": "Detached",
2628
"type": "boolean"
2729
},
28-
"documentation": {
29-
"description": "Documentation for the test suite.",
30-
"title": "Documentation",
30+
"doc": {
31+
"description": "Set the documentation of the top level suite.\nSimple formatting is supported (e.g. *bold*). If the\ndocumentation contains spaces, it must be quoted.\nIf the value is path to an existing file, actual\ndocumentation is read from that file.\n\nExamples:\n```toml\ndoc = \"\"\"Very *good* example\n\nThis is a second paragraph.\n\"\"\"\n```\n",
32+
"title": "Doc",
3133
"type": "string"
3234
},
3335
"dry-run": {
@@ -38,7 +40,7 @@
3840
"additionalProperties": {
3941
"type": "string"
4042
},
41-
"description": "Environment variables to be set before running tests.\n\nExamples:\n```toml\n[env]\nTEST_VAR = \"test\"\nSECRET = \"password\"\n```\n",
43+
"description": "Set variables in the test data. Only scalar\nvariables with string value are supported and name is\ngiven without `${}`\n\nExamples:\n```toml\n[env]\nTEST_VAR = \"test\"\nSECRET = \"password\"\n```\n",
4244
"title": "Env",
4345
"type": "object"
4446
},
@@ -130,6 +132,7 @@
130132
"type": "array"
131133
},
132134
"variables": {
135+
"description": "Set variables in the test data. Only scalar\nvariables with string value are supported and name is\ngiven without `${}`\n\nExamples:\n```toml\n[variables]\nTEST_VAR = \"test\"\nSECRET = \"password\"\n```\n",
133136
"title": "Variables",
134137
"type": "object"
135138
}
@@ -157,14 +160,6 @@
157160
"title": "Args",
158161
"type": "array"
159162
},
160-
"configurations": {
161-
"additionalProperties": {
162-
"$ref": "#/definitions/DetachableConfiguration"
163-
},
164-
"description": "Configurations for Robot Framework.",
165-
"title": "Configurations",
166-
"type": "object"
167-
},
168163
"console": {
169164
"title": "Console",
170165
"type": "string"
@@ -173,9 +168,9 @@
173168
"title": "Debug-File",
174169
"type": "string"
175170
},
176-
"documentation": {
177-
"description": "Documentation for the test suite.",
178-
"title": "Documentation",
171+
"doc": {
172+
"description": "Set the documentation of the top level suite.\nSimple formatting is supported (e.g. *bold*). If the\ndocumentation contains spaces, it must be quoted.\nIf the value is path to an existing file, actual\ndocumentation is read from that file.\n\nExamples:\n```toml\ndoc = \"\"\"Very *good* example\n\nThis is a second paragraph.\n\"\"\"\n```\n",
173+
"title": "Doc",
179174
"type": "string"
180175
},
181176
"dry-run": {
@@ -186,7 +181,7 @@
186181
"additionalProperties": {
187182
"type": "string"
188183
},
189-
"description": "Environment variables to be set before running tests.\n\nExamples:\n```toml\n[env]\nTEST_VAR = \"test\"\nSECRET = \"password\"\n```\n",
184+
"description": "Set variables in the test data. Only scalar\nvariables with string value are supported and name is\ngiven without `${}`\n\nExamples:\n```toml\n[env]\nTEST_VAR = \"test\"\nSECRET = \"password\"\n```\n",
190185
"title": "Env",
191186
"type": "object"
192187
},
@@ -262,6 +257,14 @@
262257
"title": "Pre-Run-Modifiers",
263258
"type": "object"
264259
},
260+
"profiles": {
261+
"additionalProperties": {
262+
"$ref": "#/definitions/DetachableConfiguration"
263+
},
264+
"description": "Execution Profiles.",
265+
"title": "Profiles",
266+
"type": "object"
267+
},
265268
"python-path": {
266269
"description": "Additional locations directories where\nto search test libraries and other extensions when\nthey are imported. Given path can also be a glob\npattern matching multiple paths.\n\nExamples:\n```toml\npython_path = [\"./lib\", \"./resources\"]\n```\n",
267270
"items": {
@@ -278,6 +281,7 @@
278281
"type": "array"
279282
},
280283
"variables": {
284+
"description": "Set variables in the test data. Only scalar\nvariables with string value are supported and name is\ngiven without `${}`\n\nExamples:\n```toml\n[variables]\nTEST_VAR = \"test\"\nSECRET = \"password\"\n```\n",
281285
"title": "Variables",
282286
"type": "object"
283287
}

packages/robot/robotcode/robot/config/model.py

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,26 @@ def _decode_case(cls, s: str) -> str:
4040
"""
4141
},
4242
)
43-
documentation: Optional[str] = field(default=None, metadata={"description": "Documentation for the test suite."})
43+
doc: Optional[str] = field(
44+
default=None,
45+
metadata={
46+
"description": """\
47+
Set the documentation of the top level suite.
48+
Simple formatting is supported (e.g. *bold*). If the
49+
documentation contains spaces, it must be quoted.
50+
If the value is path to an existing file, actual
51+
documentation is read from that file.
52+
53+
Examples:
54+
```toml
55+
doc = \"\"\"Very *good* example
56+
57+
This is a second paragraph.
58+
\"\"\"
59+
```
60+
"""
61+
},
62+
)
4463
"""Arguments to be passed to Robot Framework"""
4564
python_path: List[str] = field(
4665
default_factory=list,
@@ -62,7 +81,9 @@ def _decode_case(cls, s: str) -> str:
6281
default_factory=dict,
6382
metadata={
6483
"description": """\
65-
Environment variables to be set before running tests.
84+
Set variables in the test data. Only scalar
85+
variables with string value are supported and name is
86+
given without `${}`
6687
6788
Examples:
6889
```toml
@@ -73,7 +94,39 @@ def _decode_case(cls, s: str) -> str:
7394
"""
7495
},
7596
)
76-
variables: Dict[str, Any] = field(default_factory=dict)
97+
variables: Dict[str, Any] = field(
98+
default_factory=dict,
99+
metadata={
100+
"description": """\
101+
Set variables in the test data. Only scalar
102+
variables with string value are supported and name is
103+
given without `${}`
104+
105+
Examples:
106+
```toml
107+
[variables]
108+
TEST_VAR = "test"
109+
SECRET = "password"
110+
```
111+
"""
112+
},
113+
)
114+
meta_data: Dict[str, Any] = field(
115+
default_factory=dict,
116+
metadata={
117+
"description": """\
118+
Set metadata of the top level suite. Value can
119+
contain formatting and be read from a file similarly
120+
121+
Examples:
122+
```toml
123+
[meta-data]
124+
Version = "1.2"
125+
Release = "release.txt"
126+
```
127+
"""
128+
},
129+
)
77130
variable_files: List[str] = field(default_factory=list)
78131
paths: List[str] = field(default_factory=list)
79132
output_dir: Optional[str] = None
@@ -83,7 +136,6 @@ def _decode_case(cls, s: str) -> str:
83136
log_level: Optional[str] = None
84137
console: Optional[str] = None
85138
mode: Optional[Mode] = None
86-
meta_data: List[str] = field(default_factory=list)
87139
languages: List[str] = field(default_factory=list)
88140
parsers: Dict[str, List[Any]] = field(default_factory=dict)
89141
pre_run_modifiers: Dict[str, List[Any]] = field(default_factory=dict)
@@ -104,9 +156,9 @@ class DetachableConfiguration(BaseConfiguration):
104156
class Configuration(BaseConfiguration):
105157
"""Configuration for Robot Framework."""
106158

107-
configurations: Dict[str, DetachableConfiguration] = field(
159+
profiles: Dict[str, DetachableConfiguration] = field(
108160
default_factory=dict,
109-
metadata={"description": "Configurations for Robot Framework."},
161+
metadata={"description": "Execution Profiles."},
110162
)
111163

112164

@@ -119,6 +171,9 @@ class Configuration(BaseConfiguration):
119171
# class Config:
120172
# title = "robot.toml"
121173
# description = "Configuration for Robot Framework."
174+
# schema_extra = {
175+
# "additionalProperties": False,
176+
# }
122177

123178
# @classmethod
124179
# def alias_generator(cls, string: str) -> str:
@@ -129,9 +184,7 @@ class Configuration(BaseConfiguration):
129184
# schema = model.schema()
130185

131186
# schema["$schema"] = "http://json-schema.org/draft-07/schema#"
132-
# schema[
133-
# "$id"
134-
# ] = "robotframework:https://raw.githubusercontent.com/d-biehl/robotcode/main/etc/robot.json"
187+
# schema["$id"] = "robotframework:https://raw.githubusercontent.com/d-biehl/robotcode/main/etc/robot.json"
135188
# schema["x-taplo-info"] = {
136189
# "authors": ["d-biehl (https://github.com/d-biehl)"],
137190
# "patterns": ["^(.*(/|\\\\)robot\\.toml|robot\\.toml)$"],

tests/robotcode/language_server/robotframework/parts/data/robot.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
args = []
2-
3-
python_path = []
2+
python-path = []
43
documentation = """\
54
This is a *sample* test suite
65
@@ -19,19 +18,19 @@ c = [1, 2, "hello World"]
1918
MyListener = []
2019
Abc = ["def", 1]
2120

22-
[configurations.default]
21+
[profiles.default]
2322
args = ["abc"]
24-
python_path = ["abc", "def"]
23+
python-path = ["abc", "def"]
2524

26-
[configurations.default.envs]
25+
[profiles.default.envs]
2726
ENV_VAR2 = "2"
2827

29-
[configurations.devel]
28+
[profiles.devel]
3029
mode = "default"
3130

32-
[configurations.devel.listeners]
31+
[profiles.devel.listeners]
3332
AnotherListener = ["default"]
3433

35-
[configs.devel_detached]
34+
[profiles.devel-detached]
3635
detached = true
3736
mode = "default"

0 commit comments

Comments
 (0)