Skip to content

Commit 0efeaeb

Browse files
committed
chore: update config schema
1 parent 61c0ec9 commit 0efeaeb

File tree

2 files changed

+161
-147
lines changed

2 files changed

+161
-147
lines changed

etc/robot.json

Lines changed: 146 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -2,145 +2,6 @@
22
"$id": "robotframework:https://raw.githubusercontent.com/d-biehl/robotcode/main/etc/robot.json",
33
"$schema": "http://json-schema.org/draft-07/schema#",
44
"definitions": {
5-
"Configuration": {
6-
"description": "Configuration(args: 'List[str]' = <factory>, documentation: 'Optional[str]' = None, python_path: 'List[str]' = <factory>, env: 'Dict[str, str]' = <factory>, variables: 'Dict[str, Any]' = <factory>, variable_files: 'List[str]' = <factory>, paths: 'List[str]' = <factory>, output_dir: 'Optional[str]' = None, output_file: 'Optional[str]' = None, log_file: 'Optional[str]' = None, debug_file: 'Optional[str]' = None, log_level: 'Optional[str]' = None, console: 'Optional[str]' = None, mode: 'Optional[Mode]' = None, meta_data: 'List[str]' = <factory>, languages: 'List[str]' = <factory>, parsers: 'Dict[str, List[Any]]' = <factory>, pre_run_modifiers: 'Dict[str, List[Any]]' = <factory>, pre_rebot_modifiers: 'Dict[str, List[Any]]' = <factory>, listeners: 'Dict[str, List[Any]]' = <factory>, dry_run: 'Optional[bool]' = None, configurations: 'Dict[str, DetachableConfiguration]' = <factory>)",
7-
"properties": {
8-
"args": {
9-
"description": "Extra arguments to be passed to Robot Framework\n\nExamples:\n```toml\nargs = [\"-t\", \"abc\"]\n```\n",
10-
"items": {
11-
"type": "string"
12-
},
13-
"title": "Args",
14-
"type": "array"
15-
},
16-
"configurations": {
17-
"additionalProperties": {
18-
"$ref": "#/definitions/DetachableConfiguration"
19-
},
20-
"description": "Configurations for Robot Framework.",
21-
"title": "Configurations",
22-
"type": "object"
23-
},
24-
"console": {
25-
"title": "Console",
26-
"type": "string"
27-
},
28-
"debug-file": {
29-
"title": "Debug-File",
30-
"type": "string"
31-
},
32-
"documentation": {
33-
"description": "Documentation for the test suite.",
34-
"title": "Documentation",
35-
"type": "string"
36-
},
37-
"dry-run": {
38-
"title": "Dry-Run",
39-
"type": "boolean"
40-
},
41-
"env": {
42-
"additionalProperties": {
43-
"type": "string"
44-
},
45-
"description": "Environment variables to be set before running tests.\n\nExamples:\n```toml\n[env]\nTEST_VAR = \"test\"\nSECRET = \"password\"\n```\n",
46-
"title": "Env",
47-
"type": "object"
48-
},
49-
"languages": {
50-
"items": {
51-
"type": "string"
52-
},
53-
"title": "Languages",
54-
"type": "array"
55-
},
56-
"listeners": {
57-
"additionalProperties": {
58-
"items": {},
59-
"type": "array"
60-
},
61-
"title": "Listeners",
62-
"type": "object"
63-
},
64-
"log-file": {
65-
"title": "Log-File",
66-
"type": "string"
67-
},
68-
"log-level": {
69-
"title": "Log-Level",
70-
"type": "string"
71-
},
72-
"meta-data": {
73-
"items": {
74-
"type": "string"
75-
},
76-
"title": "Meta-Data",
77-
"type": "array"
78-
},
79-
"mode": {
80-
"$ref": "#/definitions/Mode"
81-
},
82-
"output-dir": {
83-
"title": "Output-Dir",
84-
"type": "string"
85-
},
86-
"output-file": {
87-
"title": "Output-File",
88-
"type": "string"
89-
},
90-
"parsers": {
91-
"additionalProperties": {
92-
"items": {},
93-
"type": "array"
94-
},
95-
"title": "Parsers",
96-
"type": "object"
97-
},
98-
"paths": {
99-
"items": {
100-
"type": "string"
101-
},
102-
"title": "Paths",
103-
"type": "array"
104-
},
105-
"pre-rebot-modifiers": {
106-
"additionalProperties": {
107-
"items": {},
108-
"type": "array"
109-
},
110-
"title": "Pre-Rebot-Modifiers",
111-
"type": "object"
112-
},
113-
"pre-run-modifiers": {
114-
"additionalProperties": {
115-
"items": {},
116-
"type": "array"
117-
},
118-
"title": "Pre-Run-Modifiers",
119-
"type": "object"
120-
},
121-
"python-path": {
122-
"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",
123-
"items": {
124-
"type": "string"
125-
},
126-
"title": "Python-Path",
127-
"type": "array"
128-
},
129-
"variable-files": {
130-
"items": {
131-
"type": "string"
132-
},
133-
"title": "Variable-Files",
134-
"type": "array"
135-
},
136-
"variables": {
137-
"title": "Variables",
138-
"type": "object"
139-
}
140-
},
141-
"title": "Configuration",
142-
"type": "object"
143-
},
1445
"DetachableConfiguration": {
1456
"properties": {
1467
"args": {
@@ -273,7 +134,7 @@
273134
"type": "object"
274135
}
275136
},
276-
"title": "DetachableConfiguration",
137+
"title": "robot.toml",
277138
"type": "object"
278139
},
279140
"Mode": {
@@ -286,5 +147,149 @@
286147
"title": "Mode"
287148
}
288149
},
289-
"title": "Robot Framework Configuration"
150+
"description": "Configuration for Robot Framework.",
151+
"properties": {
152+
"args": {
153+
"description": "Extra arguments to be passed to Robot Framework\n\nExamples:\n```toml\nargs = [\"-t\", \"abc\"]\n```\n",
154+
"items": {
155+
"type": "string"
156+
},
157+
"title": "Args",
158+
"type": "array"
159+
},
160+
"configurations": {
161+
"additionalProperties": {
162+
"$ref": "#/definitions/DetachableConfiguration"
163+
},
164+
"description": "Configurations for Robot Framework.",
165+
"title": "Configurations",
166+
"type": "object"
167+
},
168+
"console": {
169+
"title": "Console",
170+
"type": "string"
171+
},
172+
"debug-file": {
173+
"title": "Debug-File",
174+
"type": "string"
175+
},
176+
"documentation": {
177+
"description": "Documentation for the test suite.",
178+
"title": "Documentation",
179+
"type": "string"
180+
},
181+
"dry-run": {
182+
"title": "Dry-Run",
183+
"type": "boolean"
184+
},
185+
"env": {
186+
"additionalProperties": {
187+
"type": "string"
188+
},
189+
"description": "Environment variables to be set before running tests.\n\nExamples:\n```toml\n[env]\nTEST_VAR = \"test\"\nSECRET = \"password\"\n```\n",
190+
"title": "Env",
191+
"type": "object"
192+
},
193+
"languages": {
194+
"items": {
195+
"type": "string"
196+
},
197+
"title": "Languages",
198+
"type": "array"
199+
},
200+
"listeners": {
201+
"additionalProperties": {
202+
"items": {},
203+
"type": "array"
204+
},
205+
"title": "Listeners",
206+
"type": "object"
207+
},
208+
"log-file": {
209+
"title": "Log-File",
210+
"type": "string"
211+
},
212+
"log-level": {
213+
"title": "Log-Level",
214+
"type": "string"
215+
},
216+
"meta-data": {
217+
"items": {
218+
"type": "string"
219+
},
220+
"title": "Meta-Data",
221+
"type": "array"
222+
},
223+
"mode": {
224+
"$ref": "#/definitions/Mode"
225+
},
226+
"output-dir": {
227+
"title": "Output-Dir",
228+
"type": "string"
229+
},
230+
"output-file": {
231+
"title": "Output-File",
232+
"type": "string"
233+
},
234+
"parsers": {
235+
"additionalProperties": {
236+
"items": {},
237+
"type": "array"
238+
},
239+
"title": "Parsers",
240+
"type": "object"
241+
},
242+
"paths": {
243+
"items": {
244+
"type": "string"
245+
},
246+
"title": "Paths",
247+
"type": "array"
248+
},
249+
"pre-rebot-modifiers": {
250+
"additionalProperties": {
251+
"items": {},
252+
"type": "array"
253+
},
254+
"title": "Pre-Rebot-Modifiers",
255+
"type": "object"
256+
},
257+
"pre-run-modifiers": {
258+
"additionalProperties": {
259+
"items": {},
260+
"type": "array"
261+
},
262+
"title": "Pre-Run-Modifiers",
263+
"type": "object"
264+
},
265+
"python-path": {
266+
"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",
267+
"items": {
268+
"type": "string"
269+
},
270+
"title": "Python-Path",
271+
"type": "array"
272+
},
273+
"variable-files": {
274+
"items": {
275+
"type": "string"
276+
},
277+
"title": "Variable-Files",
278+
"type": "array"
279+
},
280+
"variables": {
281+
"title": "Variables",
282+
"type": "object"
283+
}
284+
},
285+
"title": "robot.toml",
286+
"type": "object",
287+
"x-taplo-info": {
288+
"authors": [
289+
"d-biehl (https://github.com/d-biehl)"
290+
],
291+
"patterns": [
292+
"^(.*(/|\\\\)robot\\.toml|robot\\.toml)$"
293+
]
294+
}
290295
}

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,15 @@ def _decode_case(cls, s: str) -> str:
9595

9696
@dataclass
9797
class DetachableConfiguration(BaseConfiguration):
98+
"""Detachable Configuration for Robot Framework."""
99+
98100
detached: bool = False
99101

100102

101103
@dataclass
102104
class Configuration(BaseConfiguration):
105+
"""Configuration for Robot Framework."""
106+
103107
configurations: Dict[str, DetachableConfiguration] = field(
104108
default_factory=dict,
105109
metadata={"description": "Configurations for Robot Framework."},
@@ -113,19 +117,24 @@ class Configuration(BaseConfiguration):
113117
# import pydantic
114118

115119
# class Config:
120+
# title = "robot.toml"
121+
# description = "Configuration for Robot Framework."
122+
116123
# @classmethod
117124
# def alias_generator(cls, string: str) -> str:
118125
# # this is the same as `alias_generator = to_camel` above
119126
# return string.replace("_", "-")
120127

121128
# model = pydantic.dataclasses.create_pydantic_model_from_dataclass(Configuration, config=Config) # type: ignore
122-
123-
# schema = pydantic.schema.schema([model], title="Robot Framework Configuration")
129+
# schema = model.schema()
124130

125131
# schema["$schema"] = "http://json-schema.org/draft-07/schema#"
126-
# schema["$id"] = "robotframework:https://raw.githubusercontent.com/d-biehl/robotcode/main/etc/robot.json"
127-
132+
# schema[
133+
# "$id"
134+
# ] = "robotframework:https://raw.githubusercontent.com/d-biehl/robotcode/main/etc/robot.json"
135+
# schema["x-taplo-info"] = {
136+
# "authors": ["d-biehl (https://github.com/d-biehl)"],
137+
# "patterns": ["^(.*(/|\\\\)robot\\.toml|robot\\.toml)$"],
138+
# }
128139
# json_str = json.dumps(schema, indent=2, sort_keys=True)
129-
130-
# # TODO add $id and $schema
131140
# pathlib.Path("etc", "robot.json").write_text(json_str, "utf-8")

0 commit comments

Comments
 (0)