Skip to content

Commit 384646a

Browse files
author
Tsering Paljor
committed
Merge branch '3849-http-request-node-bug' into 'develop'
Improve schema handling and add support for `anyOf` schema type Closes baserow#3849 See merge request baserow/baserow!3780
2 parents 4e3f507 + 5d626c2 commit 384646a

File tree

5 files changed

+54
-15
lines changed

5 files changed

+54
-15
lines changed

backend/src/baserow/contrib/integrations/core/service_types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,10 @@ def process_webhook_request(
14461446
method isn't allowed for this service.
14471447
"""
14481448

1449+
# When the service is published, the previous published service may
1450+
# be kept (e.g. see `AutomationWorkflowHandler::publish()`). Since the
1451+
# uid is the same between the two, a filter is necessary to fetch only
1452+
# the latest published service.
14491453
service = (
14501454
self.model_class.objects.filter(uid=webhook_uid, is_public=not simulate)
14511455
.order_by("-id")

web-frontend/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"thursday": "Thursday",
2323
"friday": "Friday",
2424
"saturday": "Saturday",
25-
"sunday": "Sunday"
25+
"sunday": "Sunday",
26+
"value": "value"
2627
},
2728
"action": {
2829
"close": "Close",

web-frontend/modules/core/components/dataExplorer/DataExplorerNode.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@
2828
:depth="depth + 1"
2929
:open-nodes="openNodes"
3030
:node-selected="nodeSelected"
31-
:path="`${path}.${subNode.identifier}`"
32-
:search-path="`${searchPath}.${subNode.identifier}`"
31+
:path="subNode.identifier ? `${path}.${subNode.identifier}` : path"
32+
:search-path="
33+
subNode.identifier
34+
? `${searchPath}.${subNode.identifier}`
35+
: searchPath
36+
"
3337
:search="search"
3438
@click="$emit('click', $event)"
3539
@toggle="$emit('toggle', $event)"

web-frontend/modules/core/dataProviderTypes.js

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,45 @@ export class DataProviderType extends Registerable {
186186
}
187187
}
188188

189+
if (schema.anyOf) {
190+
const schemaObject = schema.anyOf.find((s) => s.type === 'object')
191+
192+
return {
193+
name,
194+
identifier,
195+
order,
196+
type: 'union',
197+
icon: this.getIconForNode({ type: 'union' }),
198+
nodes: [
199+
// Always allow direct access to the entire value
200+
{
201+
name: `${name} (${this.app.i18n.t('common.value')})`,
202+
identifier: '',
203+
order: 0,
204+
type: 'unknown',
205+
icon: this.getIconForNode({ type: 'union' }),
206+
},
207+
208+
// If it is an object, show the individual properties
209+
...(schemaObject && schemaObject.properties
210+
? Object.entries(schemaObject.properties).map(([key, subSchema]) =>
211+
this._toNode(applicationContext, [...pathParts, key], subSchema)
212+
)
213+
: []),
214+
],
215+
}
216+
}
217+
189218
if (schema.type === 'array') {
190219
return {
191220
name,
192221
identifier,
193222
icon: this.getIconForNode(schema),
194223
type: 'array',
195-
nodes: this._toNode(
196-
applicationContext,
197-
[...pathParts, null],
198-
schema.items
199-
).nodes,
224+
nodes: schema.items
225+
? this._toNode(applicationContext, [...pathParts, null], schema.items)
226+
.nodes
227+
: [],
200228
}
201229
}
202230

@@ -206,14 +234,15 @@ export class DataProviderType extends Registerable {
206234
identifier,
207235
order,
208236
icon: this.getIconForNode(schema),
209-
nodes: Object.entries(schema.properties).map(
210-
([identifier, subSchema]) =>
211-
this._toNode(
212-
applicationContext,
213-
[...pathParts, identifier],
214-
subSchema
237+
nodes: schema.properties
238+
? Object.entries(schema.properties).map(([identifier, subSchema]) =>
239+
this._toNode(
240+
applicationContext,
241+
[...pathParts, identifier],
242+
subSchema
243+
)
215244
)
216-
),
245+
: [],
217246
}
218247
}
219248

web-frontend/modules/core/enums.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const DATA_TYPE_TO_ICON_MAP = {
3737
datetime: 'iconoir-calendar',
3838
array: 'iconoir-list',
3939
file: 'iconoir-attachment',
40+
union: 'iconoir-union-alt',
4041
}
4142

4243
export const UNKNOWN_DATA_TYPE_ICON = 'iconoir-question-mark'

0 commit comments

Comments
 (0)