fix: ui schema storage (#188)
* fix: test * chore: root schema x-index * fix: getJsonSchema & getProperties empty response
This commit is contained in:
parent
2e2b5cd938
commit
8a791f37aa
@ -86,6 +86,22 @@ describe('action test', () => {
|
||||
expect(data.properties.b.properties.c['x-uid']).toEqual('n3');
|
||||
});
|
||||
|
||||
test('getJsonSchema when uid not exists', async () => {
|
||||
const response = await app.agent().resource('ui_schemas').getJsonSchema({
|
||||
resourceIndex: 'not-exists',
|
||||
});
|
||||
|
||||
expect(response.statusCode).toEqual(200);
|
||||
});
|
||||
|
||||
test('get properties when uid not exists', async () => {
|
||||
const response = await app.agent().resource('ui_schemas').getProperties({
|
||||
resourceIndex: 'not-exists',
|
||||
});
|
||||
|
||||
expect(response.statusCode).toEqual(200);
|
||||
});
|
||||
|
||||
test('remove', async () => {
|
||||
await app
|
||||
.agent()
|
||||
|
@ -89,6 +89,10 @@ export class UiSchemaRepository extends Repository {
|
||||
},
|
||||
});
|
||||
|
||||
if (nodes[0].length == 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const schema = this.nodesToSchema(nodes[0], uid);
|
||||
return lodash.pick(schema, ['type', 'properties']);
|
||||
}
|
||||
@ -117,6 +121,10 @@ export class UiSchemaRepository extends Repository {
|
||||
transaction: options?.transaction,
|
||||
});
|
||||
|
||||
if (nodes[0].length == 0) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const schema = this.nodesToSchema(nodes[0], uid);
|
||||
return schema;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user