Merge pull request #32845 from backstage/freben/pred-prefix
fix: add in the hasPrefix matcher
This commit is contained in:
@@ -176,6 +176,7 @@ describe('parseFilterPredicate', () => {
|
||||
{ $any: [{ x: { $exists: true } }] },
|
||||
{ $not: { x: { $exists: true } } },
|
||||
{ $not: { $all: [{ x: { $exists: true } }] } },
|
||||
{ kind: { $hasPrefix: 'Com' } },
|
||||
];
|
||||
|
||||
it.each(predicates)(
|
||||
@@ -204,6 +205,7 @@ describe('parseFilterPredicate', () => {
|
||||
{ $not: { x: { $unknown: true } } },
|
||||
{ $not: { $all: [{ x: { $unknown: true } }] } },
|
||||
{ $unknown: 'foo' },
|
||||
{ kind: { $hasPrefix: 1 } },
|
||||
{ 'metadata.tags': ['foo', 'bar'] },
|
||||
];
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ export function createZodV3FilterPredicateSchema(
|
||||
z.object({ $exists: z.boolean() }),
|
||||
z.object({ $in: z.array(primitiveSchema) }),
|
||||
z.object({ $contains: predicateSchema }),
|
||||
z.object({ $hasPrefix: z.string() }),
|
||||
]) as zodV3.ZodType<FilterPredicateValue>;
|
||||
|
||||
return predicateSchema;
|
||||
|
||||
@@ -108,6 +108,18 @@ describe('EntityCardBlueprint', () => {
|
||||
],
|
||||
"type": "object",
|
||||
},
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"$hasPrefix": {
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
"$hasPrefix",
|
||||
],
|
||||
"type": "object",
|
||||
},
|
||||
],
|
||||
},
|
||||
"propertyNames": {
|
||||
|
||||
@@ -110,6 +110,18 @@ describe('EntityContentBlueprint', () => {
|
||||
],
|
||||
"type": "object",
|
||||
},
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"$hasPrefix": {
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
"$hasPrefix",
|
||||
],
|
||||
"type": "object",
|
||||
},
|
||||
],
|
||||
},
|
||||
"propertyNames": {
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('EntityContextMenuItemBlueprint', () => {
|
||||
},
|
||||
];
|
||||
|
||||
it.each(data)('should return an extension with sane defaults', params => {
|
||||
it.each(data)('should return an extension with sane defaults, %#', params => {
|
||||
const extension = EntityContextMenuItemBlueprint.make({
|
||||
name: 'test',
|
||||
params,
|
||||
@@ -121,6 +121,18 @@ describe('EntityContextMenuItemBlueprint', () => {
|
||||
],
|
||||
"type": "object",
|
||||
},
|
||||
{
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"$hasPrefix": {
|
||||
"type": "string",
|
||||
},
|
||||
},
|
||||
"required": [
|
||||
"$hasPrefix",
|
||||
],
|
||||
"type": "object",
|
||||
},
|
||||
],
|
||||
},
|
||||
"propertyNames": {
|
||||
@@ -246,7 +258,7 @@ describe('EntityContextMenuItemBlueprint', () => {
|
||||
it.each([
|
||||
{ filter: { kind: 'Api' } },
|
||||
{ filter: (e: Entity) => e.kind.toLowerCase() === 'api' },
|
||||
])('should return a filter function', async ({ filter }) => {
|
||||
])('should return a filter function, %#', async ({ filter }) => {
|
||||
const extension = EntityContextMenuItemBlueprint.make({
|
||||
name: 'test',
|
||||
params: {
|
||||
|
||||
Reference in New Issue
Block a user