[
https://issues.jboss.org/browse/WFCORE-2317?page=com.atlassian.jira.plugi...
]
Brian Stansberry edited comment on WFCORE-2317 at 2/22/17 3:31 PM:
-------------------------------------------------------------------
ValidateModelStepHandler can deal with this while looping through the attributes by
checking whether the AttributeDefinition is of type ObjectTypeAttributeDefinition,
ObjectListAttributeDefinition or ObjectMapAttributeDefinition. For the latter two use the
getValueType() method (needs to be public) to get the underlying
ObjectTypeAttributeDefinition. Get to the "object type" ModelNode (either the
attribute value itself, or elements in its list in the ObjectListAttributeDefinition case,
or values in its map in the ObjectMapAttributeDefinition case) and perform the
requires/alternatives validation on it using the ObjectTypeAttributeDefinition. The
requires validation can be easier than is done with the root attribute, as there is no
need for the "attemptReadMissingAttributeValueFromHandler" stuff, since the
entire attribute value has already been read.
The logic should recurse, to handle cases where complex attributes have other complex
types as fields.
Failure messages will be a bit more complex as the message should use the . and [0]
formatted path to the offending field, rather than simply using the attribute name.
Not
WFCORExxx: attributename is invalid in combination with [b, c]
But rather
WFCORExxx: attributename[].a is invalid in combination with [b, c]
I believe the existing ControllerLogger methods to create the exceptions would still be
usable; the only difference is the parameter values passed in.
was (Author: brian.stansberry):
ValidateModelStepHandler can deal with this while looping through the attributes by
checking whether the AttributeDefinition is of type ObjectTypeAttributeDefinition,
ObjectListAttributeDefinition or ObjectMapAttributeDefinition. For the latter two use the
getValueType() method (needs to be public) to get the underlying
ObjectTypeAttributeDefinition. Get to the "object type" ModelNode (either the
attribute value itself, or elements in its list in the ObjectListAttributeDefinition case,
or values in its map in the ObjectMapAttributeDefinition case) and perform the
requires/alternatives validation on it using the ObjectTypeAttributeDefinition. The
requires validation can be easier than is done with the root attribute, as there is no
need for the "attemptReadMissingAttributeValueFromHandler" stuff, since the
entire attribute value has already been read.
The logic should recurse, to handle cases where complex attributes have other complex
types as fields.
Failure messages will be a bit more complex as the message should use the . and [0]
formatted path to the offending field, rather than simply using the attribute name.
Not
WFCORExxx: attributename is invalid in combination with [b, c]
But rather
WFCORExxx: attributename[].a is invalid in combination with [b, c]
Nested attributes are not validated
-----------------------------------
Key: WFCORE-2317
URL:
https://issues.jboss.org/browse/WFCORE-2317
Project: WildFly Core
Issue Type: Bug
Components: Domain Management
Affects Versions: 3.0.0.Alpha25
Reporter: Michal Petrov
Assignee: Brian Stansberry
Attributes of type Object do not have their inner attributes validated for e.g.
"requires" and "alternatives".
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)