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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user