Fix input schema validation issue for gitlab actions.

Using zod intersections results in an invalid JsonSchema.
The issue has been reported at https://github.com/StefanTerdell/zod-to-json-schema/issues/64.

The following actions has been fixed:

- gitlab:group:ensureExists
- gitlab:projectAccessToken:create
- gitlab:projectDeployToken:create
- gitlab:projectVariable:create

resolves #17721

Signed-off-by: Andreas Berger <andreas@berger-ecommerce.com>
This commit is contained in:
Andreas Berger
2023-05-11 12:24:08 +02:00
parent 667c490cc1
commit f1496d4ab6
6 changed files with 20 additions and 14 deletions
+10
View File
@@ -0,0 +1,10 @@
---
'@backstage/plugin-scaffolder-backend-module-gitlab': patch
---
Fix input schema validation issue for gitlab actions:
- gitlab:group:ensureExists
- gitlab:projectAccessToken:create
- gitlab:projectDeployToken:create
- gitlab:projectVariable:create
@@ -12,10 +12,9 @@ export const createGitlabGroupEnsureExistsAction: (options: {
integrations: ScmIntegrationRegistry;
}) => TemplateAction<
{
path: string[];
repoUrl: string;
token?: string | undefined;
} & {
path: string[];
},
{
groupId?: number | undefined;
@@ -27,10 +26,9 @@ export const createGitlabProjectAccessTokenAction: (options: {
integrations: ScmIntegrationRegistry;
}) => TemplateAction<
{
projectId: string | number;
repoUrl: string;
token?: string | undefined;
} & {
projectId: string | number;
name?: string | undefined;
accessLevel?: number | undefined;
scopes?: string[] | undefined;
@@ -45,11 +43,10 @@ export const createGitlabProjectDeployTokenAction: (options: {
integrations: ScmIntegrationRegistry;
}) => TemplateAction<
{
repoUrl: string;
token?: string | undefined;
} & {
name: string;
projectId: string | number;
repoUrl: string;
token?: string | undefined;
username?: string | undefined;
scopes?: string[] | undefined;
},
@@ -64,13 +61,12 @@ export const createGitlabProjectVariableAction: (options: {
integrations: ScmIntegrationRegistry;
}) => TemplateAction<
{
repoUrl: string;
token?: string | undefined;
} & {
key: string;
value: string;
projectId: string | number;
repoUrl: string;
variableType: string;
token?: string | undefined;
variableProtected?: boolean | undefined;
masked?: boolean | undefined;
raw?: boolean | undefined;
@@ -36,7 +36,7 @@ export const createGitlabGroupEnsureExistsAction = (options: {
id: 'gitlab:group:ensureExists',
description: 'Ensures a Gitlab group exists',
schema: {
input: commonGitlabConfig.and(
input: commonGitlabConfig.merge(
z.object({
path: z
.array(z.string(), {
@@ -33,7 +33,7 @@ export const createGitlabProjectAccessTokenAction = (options: {
return createTemplateAction({
id: 'gitlab:projectAccessToken:create',
schema: {
input: commonGitlabConfig.and(
input: commonGitlabConfig.merge(
z.object({
projectId: z.union([z.number(), z.string()], {
description: 'Project ID',
@@ -36,7 +36,7 @@ export const createGitlabProjectDeployTokenAction = (options: {
return createTemplateAction({
id: 'gitlab:projectDeployToken:create',
schema: {
input: commonGitlabConfig.and(
input: commonGitlabConfig.merge(
z.object({
projectId: z.union([z.number(), z.string()], {
description: 'Project ID',
@@ -34,7 +34,7 @@ export const createGitlabProjectVariableAction = (options: {
return createTemplateAction({
id: 'gitlab:projectVariable:create',
schema: {
input: commonGitlabConfig.and(
input: commonGitlabConfig.merge(
z.object({
projectId: z.union([z.number(), z.string()], {
description: 'Project ID',