Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-603 Simplify working with complex attributes
  3. WFCORE-835

Investigate appearance of 'allowed' in ObjectListAttributeDefinition

    XMLWordPrintable

Details

    • Sub-task
    • Resolution: Done
    • Major
    • 2.0.0.Alpha11
    • 2.0.0.Alpha10
    • Management
    • None

    Description

      When doing the work for https://github.com/wildfly/wildfly/pull/7757 / https://issues.jboss.org/browse/WFLY-4880, which contains an ObjectListTypeAttributeDefinition, Brian picked up on that there is an

                  "allowed" => [
                           "class",
                          "name",
                          "actions",
                          "module"
                  ],
      

      in the resource description. The output is shown in the PR description, and can also be found in other places using ObjectListTypeAttributeDefinition. Digging in a bit, the issue appears to happen at https://github.com/wildfly/wildfly-core/blob/master/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L933, or if this class changes, it is here:

         protected void addAllowedValuesToDescription(ModelNode result, ParameterValidator validator) {
              if (allowedValues != null) {
                  for (ModelNode allowedValue : allowedValues) {
                      result.get(ModelDescriptionConstants.ALLOWED).add(allowedValue);
                  }
              } else if (validator instanceof AllowedValuesValidator) {
                  //IT ENTERS THIS
                  AllowedValuesValidator avv = (AllowedValuesValidator) validator;
                  List<ModelNode> allowed = avv.getAllowedValues();
                  if (allowed != null) {
                      for (ModelNode ok : allowed) {
                          result.get(ModelDescriptionConstants.ALLOWED).add(ok);
                      }
                  }
              }
          }
      

      The ParameterValidator is an instance of NillableOrExpressionParameterValidator, which implements AllowedValuesValidator, so it enters the ‘else if’ block, and adds the ‘allowed’ part. Looking a bit at the history of AttributeDefinition and NillableOrExpressionParameterValidator, it appears that this would have worked this way for a while.

      So this Jira is mainly to jot this down, so we can decide if ‘allowed’ should be removed or not. Please rename the Jira if we should remove it.

      Attachments

        Activity

          People

            tomazcerar Tomaž Cerar (Inactive)
            kkhan1@redhat.com Kabir Khan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: