Github user ahgittin commented on a diff in the pull request:
https://github.com/apache/brooklyn-ui/pull/72#discussion_r219854401
--- Diff:
ui-modules/blueprint-composer/app/components/providers/blueprint-service.provider.js
---
@@ -287,8 +297,28 @@ function BlueprintService($log, $q, $sce, paletteApi,
iconGenerator, dslService)
}
break;
case 'regex':
- if (!entity.config.has(config.name) ||
!angular.isDefined(entity.config.get(config.name)) || !(new
RegExp(constraint).test(entity.config.get(config.name)))) {
- message =
`<samp>${config.name}</samp> does not match the required format:
<samp>${config.constraints.regex}</samp>`;
+ if (entity.config.has(config.name) &&
angular.isDefined(entity.config.get(config.name)) && !(new
RegExp(args).test(entity.config.get(config.name)))) {
--- End diff --
i think the meaning of `regex` should be "_if_ a value is set it must match
the regex". that is strictly more usablel (else we cannot express that). can
always combine with `required` if you want to make it required _and_ having to
match the regex.
---