Output a JSON schema from the .well-known metadata endpoint
Signed-off-by: Harry Hogg <hhogg@spotify.com>
This commit is contained in:
@@ -530,12 +530,42 @@ describe('createPermissionIntegrationRouter', () => {
|
||||
name: testRule1.name,
|
||||
description: testRule1.description,
|
||||
resourceType: testRule1.resourceType,
|
||||
schema: {
|
||||
$schema: 'http://json-schema.org/draft-07/schema#',
|
||||
items: [
|
||||
{
|
||||
description: 'firstParam',
|
||||
type: 'string',
|
||||
},
|
||||
{
|
||||
description: 'secondParam',
|
||||
type: 'number',
|
||||
},
|
||||
],
|
||||
maxItems: 2,
|
||||
minItems: 2,
|
||||
type: 'array',
|
||||
},
|
||||
parameters: { count: 2 },
|
||||
},
|
||||
{
|
||||
name: testRule2.name,
|
||||
description: testRule2.description,
|
||||
resourceType: testRule2.resourceType,
|
||||
schema: {
|
||||
$schema: 'http://json-schema.org/draft-07/schema#',
|
||||
items: [
|
||||
{
|
||||
additionalProperties: false,
|
||||
description: 'firstParam',
|
||||
properties: {},
|
||||
type: 'object',
|
||||
},
|
||||
],
|
||||
maxItems: 1,
|
||||
minItems: 1,
|
||||
type: 'array',
|
||||
},
|
||||
parameters: { count: 1 },
|
||||
},
|
||||
],
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import express, { Response } from 'express';
|
||||
import Router from 'express-promise-router';
|
||||
import { z } from 'zod';
|
||||
import zodToJsonSchema from 'zod-to-json-schema';
|
||||
import { InputError } from '@backstage/errors';
|
||||
import { errorHandler } from '@backstage/backend-common';
|
||||
import {
|
||||
@@ -201,6 +202,7 @@ export const createPermissionIntegrationRouter = <
|
||||
name: rule.name,
|
||||
description: rule.description,
|
||||
resourceType: rule.resourceType,
|
||||
schema: zodToJsonSchema(rule.schema),
|
||||
parameters: {
|
||||
count: rule.toQuery.length,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user