Skip to content

Commit

Permalink
Merge pull request #1058 from RoadieHQ/validation-of-thing
Browse files Browse the repository at this point in the history
remove needless field validation
  • Loading branch information
punkle authored Jul 20, 2023
2 parents 9c83219 + 5a8ef34 commit 75d7560
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-cameras-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@roadiehq/plugin-scaffolder-frontend-module-http-request-field': minor
---

Remove field validation for `SelectFieldFromApi`. The validation didn't make sense and was needlessly limiting.
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"dependencies": {
"@backstage/core-components": "^0.13.2",
"@backstage/core-plugin-api": "^1.5.2",
"@backstage/catalog-model": "^1.4.0",
"@backstage/theme": "^0.4.0",
"@backstage/plugin-scaffolder": "^1.14.0",
"@backstage/plugin-scaffolder-react": "^1.5.0",
"@material-ui/core": "^4.12.2",
"@material-ui/icons": "^4.9.1",
"@material-ui/lab": "^4.0.0-alpha.45",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
* limitations under the License.
*/
import React, { useState } from 'react';
import { FieldProps, FieldValidation } from '@rjsf/core';
import { FieldProps } from '@rjsf/core';
import FormControl from '@material-ui/core/FormControl';
import { KubernetesValidatorFunctions } from '@backstage/catalog-model';
import {
discoveryApiRef,
fetchApiRef,
Expand Down Expand Up @@ -108,14 +107,3 @@ export const SelectFieldFromApi = (props: FieldProps<string>) => {
</FormControl>
);
};

export const selectFieldFromApiValidation = (
value: string,
validation: FieldValidation,
) => {
if (!KubernetesValidatorFunctions.isValidObjectName(value)) {
validation.addError(
'must start and end with an alphanumeric character, and contain only alphanumeric characters, hyphens, underscores, and periods. Maximum length is 63 characters.',
);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
scaffolderPlugin,
createScaffolderFieldExtension,
} from '@backstage/plugin-scaffolder';
import {
SelectFieldFromApi,
selectFieldFromApiValidation,
} from './components/SelectFieldFromApi';
import { scaffolderPlugin } from '@backstage/plugin-scaffolder';
import { createScaffolderFieldExtension } from '@backstage/plugin-scaffolder-react';
import { SelectFieldFromApi } from './components/SelectFieldFromApi';

export const SelectFieldFromApiExtension = scaffolderPlugin.provide(
createScaffolderFieldExtension({
name: 'SelectFieldFromApi',
component: SelectFieldFromApi,
validation: selectFieldFromApiValidation,
}),
);

0 comments on commit 75d7560

Please sign in to comment.