frontend-app-api: allow extension IDs to contain slashes

Co-authored-by: Camila Belo <camilaibs@gmail.com>
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2023-11-22 13:50:03 +01:00
parent 36c94b8462
commit e3b55e280d
2 changed files with 2 additions and 14 deletions
@@ -105,7 +105,7 @@ describe('readAppExtensionsConfig', () => {
app: {
extensions: [
{
'core.router/routes': {
'': {
extension: 'example-package#MyPage',
config: { foo: 'bar' },
},
@@ -115,7 +115,7 @@ describe('readAppExtensionsConfig', () => {
}),
),
).toThrowErrorMatchingInlineSnapshot(
`"Invalid extension configuration at app.extensions[0], extension ID must not contain slashes; got 'core.router/routes', did you mean 'core.router'?"`,
`"Invalid extension configuration at app.extensions[0], extension ID must not be empty or contain whitespace"`,
);
});
});
@@ -166,9 +166,6 @@ describe('expandShorthandExtensionParameters', () => {
expect(() => run(' a')).toThrowErrorMatchingInlineSnapshot(
`"Invalid extension configuration at app.extensions[1], extension ID must not be empty or contain whitespace"`,
);
expect(() => run('core.router/routes')).toThrowErrorMatchingInlineSnapshot(
`"Invalid extension configuration at app.extensions[1], extension ID must not contain slashes; got 'core.router/routes', did you mean 'core.router'?"`,
);
});
it('supports null value', () => {
@@ -70,15 +70,6 @@ export function expandShorthandExtensionParameters(
errorMsg('extension ID must not be empty or contain whitespace'),
);
}
if (id.includes('/')) {
let message = `extension ID must not contain slashes; got '${id}'`;
const good = id.split('/')[0];
if (good) {
message += `, did you mean '${good}'?`;
}
throw new Error(errorMsg(message));
}
}
// Example YAML: