-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Describe Request:
I would like to pass custom definitions (like Kafka topics) to a catalog-info API entity definition but because of hardcoded validator rule it's impossible to do that and pass validation.
Could you please add the possibility to pass definition
options?
Examples:
apiVersion: backstage.io/v1alpha1
kind: API
metadata:
namespace: my-namespace
name: api-name
annotations:
gitlab.com/project-id: '12345678'
spec:
type: api-type
owner: group:owner-group
lifecycle: experimental
definition:
$topic: topic.area.name.1
Validation of this catalog info will fail because of hardcoded tule here:
function modifyPlaceholders(obj) {
for (const k in obj) {
if (typeof obj[k] === 'object') {
try {
if (obj[k].$text || obj[k].$openapi || obj[k].$asyncapi) {
obj[k] = 'DUMMY TEXT';
return;
}
} catch (e) {
throw new Error(
`Placeholder with name '${k}' is empty. Please remove it or populate it.`,
);
}
modifyPlaceholders(obj[k]);
}
}
}
But with the following update, it'll pass:
function modifyPlaceholders(obj, condition) {
for (const k in obj) {
if (typeof obj[k] === 'object') {
try {
for (const c of condition) {
if (obj[k][c]) {
obj[k] = 'DUMMY TEXT';
return;
}
}
} catch (e) {
throw new Error(
`Placeholder with name '${k}' is empty. Please remove it or populate it.`,
);
}
modifyPlaceholders(obj[k], condition);
}
}
}
Where const condition = ['$text', '$openapi', '$asyncapi', '$topic']
Supporting Documentation Links:
Metadata
Metadata
Assignees
Labels
No labels