I am creating a custom template for creating a GitHub repository, I have added a regex which should accept a specific kind of string input. But when the validation fails, I get a different error. How do I get the error message working?
template.yaml
<code>apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
# some metadata about the template itself
metadata:
name: misc-config-Template
title: Misc Config Repo Template
description: This template will be used for creating misc-config repos
annotations:
github.com/project-slug: backstage/backstage
spec:
owner: xyz
type: GitHub
# these are the steps which are rendered in the frontend with the form input
# these are the steps which are rendered in the frontend with the form input
parameters:
- title: Name of the catalog component
required:
- name
properties:
name:
title: Name
type: string
description: Unique name of the component
pattern: '^[a-z]{3}-deployment-config$'
ui:autofocus: true
ui:options:
rows: 5
owner:
title: Name of the owner/organisation
type: string
description: Unique name of the component
placeholder: "Name of the owner/organisation"
ui:options:
enum:
- 'abc-def'
errorMessage:
properties:
name: 'Input should be <xyz>-deployment-config'
owner: 'Input should be firstName-lastName'
</code>
<code>apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
# some metadata about the template itself
metadata:
name: misc-config-Template
title: Misc Config Repo Template
description: This template will be used for creating misc-config repos
annotations:
github.com/project-slug: backstage/backstage
spec:
owner: xyz
type: GitHub
# these are the steps which are rendered in the frontend with the form input
# these are the steps which are rendered in the frontend with the form input
parameters:
- title: Name of the catalog component
required:
- name
properties:
name:
title: Name
type: string
description: Unique name of the component
pattern: '^[a-z]{3}-deployment-config$'
ui:autofocus: true
ui:options:
rows: 5
owner:
title: Name of the owner/organisation
type: string
description: Unique name of the component
placeholder: "Name of the owner/organisation"
ui:options:
enum:
- 'abc-def'
errorMessage:
properties:
name: 'Input should be <xyz>-deployment-config'
owner: 'Input should be firstName-lastName'
</code>
apiVersion: scaffolder.backstage.io/v1beta3
kind: Template
# some metadata about the template itself
metadata:
name: misc-config-Template
title: Misc Config Repo Template
description: This template will be used for creating misc-config repos
annotations:
github.com/project-slug: backstage/backstage
spec:
owner: xyz
type: GitHub
# these are the steps which are rendered in the frontend with the form input
# these are the steps which are rendered in the frontend with the form input
parameters:
- title: Name of the catalog component
required:
- name
properties:
name:
title: Name
type: string
description: Unique name of the component
pattern: '^[a-z]{3}-deployment-config$'
ui:autofocus: true
ui:options:
rows: 5
owner:
title: Name of the owner/organisation
type: string
description: Unique name of the component
placeholder: "Name of the owner/organisation"
ui:options:
enum:
- 'abc-def'
errorMessage:
properties:
name: 'Input should be <xyz>-deployment-config'
owner: 'Input should be firstName-lastName'
Output Displayed:
<code>must match pattern '^[a-z]{3}-deployment-config$'
</code>
<code>must match pattern '^[a-z]{3}-deployment-config$'
</code>
must match pattern '^[a-z]{3}-deployment-config$'
Expected Output :
<code>Input should be <xyz>-deployment-config
</code>
<code>Input should be <xyz>-deployment-config
</code>
Input should be <xyz>-deployment-config