[NETCONF-976] The required fields are created, but they are not populate in the Swagger API Created: 15/Mar/23 Updated: 14/Jul/23 Resolved: 14/Jul/23 |
|
| Status: | Resolved |
| Project: | netconf |
| Component/s: | restconf-openapi |
| Affects Version/s: | 5.0.0, 4.0.3 |
| Fix Version/s: | 6.0.0, 5.0.7, 4.0.9 |
| Type: | Bug | Priority: | Medium |
| Reporter: | Peter Suna | Assignee: | Peter Suna |
| Resolution: | Done | Votes: | 0 |
| Labels: | pt, regression | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
During the processing of container nodes in the DefinitionGenerator, required fields are not being populated. While an array for required fields is created in this method, it is not being passed to the processChildNode method.
final ArrayNode required = JsonNodeFactory.instance.arrayNode(); for (final DataSchemaNode node : nodes) { if (!isConfig || node.isConfiguration()) { processChildNode(node, parentName, definitions, definitionNames, isConfig, stack, properties, oaversion); } } parentNode.set(PROPERTIES_KEY, properties); setRequiredIfNotEmpty(parentNode, required);
Instead of using the `ArrayNode required` inside the `processChildNode` method, a new ArrayNode is being used to populate the required fields, which is then never stored.
if (node instanceof LeafSchemaNode leaf) { processLeafNode(leaf, name, properties, JsonNodeFactory.instance.arrayNode(), stack, definitions, definitionNames, oaversion); } else if (node instanceof AnyxmlSchemaNode anyxml) { processAnyXMLNode(anyxml, name, properties, JsonNodeFactory.instance.arrayNode()); } else if (node instanceof AnydataSchemaNode anydata) { processAnydataNode(anydata, name, properties, JsonNodeFactory.instance.arrayNode()); }
|
| Comments |
| Comment by Ivan Hrasko [ 15/Mar/23 ] |
|
https://www.rfc-editor.org/rfc/rfc7950#page-14 says that mandatory attribute can be used with: leaf, choice, anydata, anyxml, list (under some conditions), leaf-list (under some conditions) and container (under some conditions). |
| Comment by Ivan Hrasko [ 15/Mar/23 ] |
|
The mandatory attribute is no more written since fix of |
| Comment by Ivan Hrasko [ 15/Mar/23 ] |
|
In addition, we are missing implementation of logic for lists, leaf-lists and containers. |
| Comment by Ivan Hrasko [ 27/Jun/23 ] |
|
Unfortunately, branches 4.0.x and 5.0.x don't contain https://git.opendaylight.org/gerrit/c/netconf/+/105042. Thus we have to add mandatory logic into _xml and _post schemas to make fix complete on those branches. |