-
Notifications
You must be signed in to change notification settings - Fork 5k
[Improvement-17960][API]Add null/empty/duplicate validation logic for globalParams when creating or updating a workflow #17961
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
base: dev
Are you sure you want to change the base?
Conversation
| try { | ||
| validateGlobalParams(globalParams); | ||
| } catch (ServiceException ex) { | ||
| log.warn("Invalid globalParams: {}", ex.getMessage()); | ||
| putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, ex.getMessage()); | ||
| return result; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| try { | |
| validateGlobalParams(globalParams); | |
| } catch (ServiceException ex) { | |
| log.warn("Invalid globalParams: {}", ex.getMessage()); | |
| putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, ex.getMessage()); | |
| return result; | |
| } | |
| validateGlobalParams(globalParams); |
Directly throw ServiceException at validateGlobalParams, please don't use a lot of try catch here.
| if (Direct.IN.equals(p.getDirect()) && StringUtils.isEmpty(p.getValue())) { | ||
| throw new ServiceException("IN param value required for key: " + key); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should support the value to be null.
| /** | ||
| * Validates global parameters: non-empty keys, no duplicates, and required values for IN-type params. | ||
| */ | ||
| private void validateGlobalParams(String globalParams) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't be writing this kind of glue code everywhere. Why not use a GlobalParamValidator to handle this task?
Purpose of the pull request
close #17960
Brief change log
Add null/empty/duplicate validation logic for globalParams when creating or updating a workflow
Verify this pull request
This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(or)
Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md