-
Notifications
You must be signed in to change notification settings - Fork 36
feat(ADDON-87180): introduce dedicated index_name validator type
#2042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b9e4210
c7a926b
26be177
e43094e
18bd710
172af4f
797adfe
101c931
3ebd28f
423f56e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1217,6 +1217,9 @@ | |
| }, | ||
| { | ||
| "$ref": "#/definitions/DateValidator" | ||
| }, | ||
| { | ||
| "$ref": "#/definitions/IndexNameValidator" | ||
| } | ||
| ] | ||
| } | ||
|
|
@@ -3331,6 +3334,24 @@ | |
| ], | ||
| "additionalProperties": false | ||
| }, | ||
| "IndexNameValidator": { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds |
||
| "type": "object", | ||
| "description": "Validates that the field value is a valid Splunk index name.", | ||
| "properties": { | ||
| "errorMsg": { | ||
| "$ref": "#/definitions/errorMsg" | ||
| }, | ||
| "type": { | ||
| "const": "index_name", | ||
| "type": "string", | ||
| "description": "Exactly: index_name" | ||
| } | ||
| }, | ||
| "required": [ | ||
| "type" | ||
| ], | ||
| "additionalProperties": false | ||
| }, | ||
| "AnyValidator": { | ||
| "type": "array", | ||
| "description": "It is used to validate the values of fields using various validators.", | ||
|
|
@@ -3356,6 +3377,9 @@ | |
| }, | ||
| { | ||
| "$ref": "#/definitions/DateValidator" | ||
| }, | ||
| { | ||
| "$ref": "#/definitions/IndexNameValidator" | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| validator.IndexName() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,19 +112,6 @@ export const migrateIndexTypeEntity = ( | |
| denyList: '^_.*$', | ||
| createSearchChoice: true, | ||
| }, | ||
| validators: [ | ||
| { | ||
| type: 'regex', | ||
| pattern: '^[a-zA-Z0-9][a-zA-Z0-9\\_\\-]*$', | ||
| errorMsg: | ||
| 'Index names must begin with a letter or a number and must contain only letters, numbers, underscores or hyphens.', | ||
| }, | ||
| { | ||
| type: 'string', | ||
| minLength: 1, | ||
| maxLength: 80, | ||
| errorMsg: 'Length of index name should be between 1 and 80.', | ||
| }, | ||
| ], | ||
| validators: [{ type: 'index_name' }], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Blocking: the UI runtime validator does not handle
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No UI left intentionally, this means no validation will be done during field edit. However when user tries to save the form backend validation is triggered not letting to close from with save operation.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, backend-only validation on save is acceptable for this flow. No need to add a frontend |
||
| }; | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.