Skip to content

Commit 4e7e764

Browse files
committed
ready for PR
Signed-off-by: Jeff James <jeff@james-online.com>
1 parent 20ae1ca commit 4e7e764

11 files changed

Lines changed: 262 additions & 169 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"required": ["component", "config", "uid", "tags", "props", "timestamp"],
3+
"type": "object",
4+
"properties": {
5+
"component": {
6+
"type": "string"
7+
},
8+
"config": {
9+
"type": "object",
10+
"additionalProperties": true
11+
},
12+
"slots": {
13+
"type": "object",
14+
"additionalProperties": {
15+
"type": "array",
16+
"items": {
17+
"$ref": "#/components/schemas/UIComponent"
18+
}
19+
}
20+
},
21+
"uid": {
22+
"type": "string"
23+
},
24+
"tags": {
25+
"uniqueItems": true,
26+
"type": "array",
27+
"items": {
28+
"type": "string"
29+
}
30+
},
31+
"props": {
32+
"$ref": "#/components/schemas/ConfigDescription"
33+
},
34+
"timestamp": {
35+
"type": "string",
36+
"format": "date-time"
37+
}
38+
}
39+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"required": ["component", "config"],
3+
"type": "object",
4+
"properties": {
5+
"component": {
6+
"type": "string"
7+
},
8+
"config": {
9+
"type": "object",
10+
"additionalProperties": true
11+
},
12+
"slots": {
13+
"type": "object",
14+
"additionalProperties": {
15+
"type": "array",
16+
"items": {
17+
"$ref": "#/components/schemas/UIComponent"
18+
}
19+
}
20+
}
21+
}
22+
}

bundles/org.openhab.ui/web/build/generate-rest-client.mjs

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,28 @@ if (url) {
3535
fs.writeFileSync(file, JSON.stringify(openApi, null, 2))
3636
process.stdout.write('DONE\n')
3737

38+
try {
39+
// temporary fix for UIComponent schema in OpenAPI spec - see https://github.com/openhab/openhab-core/issues/5686
40+
process.stdout.write(`Updating UIComponent in ${file} ... `)
41+
execSync(`jq '.components.schemas.UIComponent = input' ${file} ./build/UIComponent.json > tmp.json && mv tmp.json ${file}`, {
42+
stdio: 'ignore'
43+
})
44+
process.stdout.write('DONE\n')
45+
} catch (updateError) {
46+
process.stderr.write('ERROR updating UIComponent:', updateError)
47+
}
48+
49+
try {
50+
// temporary fix for RootUIComponent schema in OpenAPI spec - see https://github.com/openhab/openhab-core/issues/5686
51+
process.stdout.write(`Updating RootUIComponent in ${file} ... `)
52+
execSync(`jq '.components.schemas.RootUIComponent = input' ${file} ./build/RootUIComponent.json > tmp.json && mv tmp.json ${file}`, {
53+
stdio: 'ignore'
54+
})
55+
process.stdout.write('DONE\n')
56+
} catch (updateError) {
57+
process.stderr.write('ERROR updating RootUIComponent:', updateError)
58+
}
59+
3860
try {
3961
process.stdout.write(`Applying oxfmt to ${file} ... `)
4062
execSync(`oxfmt ${file}`, { stdio: 'ignore' })
@@ -44,17 +66,15 @@ if (url) {
4466
}
4567
}
4668

47-
if (file && !openApi) {
48-
process.stdout.write(`Reading OpenAPI spec from file ${file} ... `)
49-
try {
50-
const data = fs.readFileSync(file, 'utf8')
51-
openApi = JSON.parse(data)
52-
} catch (error) {
53-
process.stderr.write('ERROR reading OpenAPI spec from file:', error)
54-
process.exit(1)
55-
}
56-
process.stdout.write('DONE\n')
69+
process.stdout.write(`Reading OpenAPI spec from file ${file} ... `)
70+
try {
71+
const data = fs.readFileSync(file, 'utf8')
72+
openApi = JSON.parse(data)
73+
} catch (error) {
74+
process.stderr.write('ERROR reading OpenAPI spec from file:', error)
75+
process.exit(1)
5776
}
77+
process.stdout.write('DONE\n')
5878

5979
try {
6080
await createClient({

0 commit comments

Comments
 (0)