LOG.debug("Is Configuration node [{}] [{}]", node.isConfiguration(), node.getQName().getLocalName());
final String localName = module.getName() + ":" + node.getQName().getLocalName();
- ArrayNode pathParams = JsonNodeFactory.instance.arrayNode();
- String resourcePath;
-
- if (node.isConfiguration()) { // This node's config statement is
- // true.
- resourcePath = getResourcePath("config", context);
+ final String resourcePath = getResourcePath("data", context);
+ if (node.isConfiguration()) {
+ final ArrayNode pathParams = JsonNodeFactory.instance.arrayNode();
/*
* When there are two or more top container or list nodes
* whose config statement is true in module, make sure that
final String resolvedPath = resourcePath + "/" + createPath(node, pathParams, localName);
addPaths(node, deviceName, moduleName, paths, pathParams, schemaContext, true, module.getName(),
definitionNames, resolvedPath);
- }
- pathParams = JsonNodeFactory.instance.arrayNode();
- resourcePath = getResourcePath("operational", context);
-
- if (!node.isConfiguration()) {
+ } else {
+ final ArrayNode pathParams = JsonNodeFactory.instance.arrayNode();
final String resolvedPath = resourcePath + "/" + createPath(node, pathParams, localName);
addPaths(node, deviceName, moduleName, paths, pathParams, schemaContext, false, moduleName,
definitionNames, resolvedPath);
public abstract String getResourcePath(String resourceType, String context);
- public abstract String getResourcePathPart(String resourceType);
-
private void addPaths(final DataSchemaNode node, final Optional<String> deviceName, final String moduleName,
final ObjectNode paths, final ArrayNode parentPathParams, final EffectiveModelContext schemaContext,
final boolean isConfig, final String parentName, final DefinitionNames definitionNames,
@Override
public String getResourcePath(final String resourceType, final String context) {
- if (isData(resourceType)) {
+ if ("data".equals(resourceType)) {
return "/" + basePath + "/data" + context;
}
return "/" + basePath + "/operations" + context;
}
- @Override
- public String getResourcePathPart(final String resourceType) {
- if (isData(resourceType)) {
- return "data";
- }
- return "operations";
- }
-
- private static boolean isData(final String dataStore) {
- return "config".contains(dataStore) || "operational".contains(dataStore);
- }
-
@Override
protected ListPathBuilder newListPathBuilder() {
return new ListPathBuilder() {
context);
final ObjectNode pathsObject = JsonNodeFactory.instance.objectNode();
- createGetPathItem("config", "Queries the config (startup) datastore on the mounted hosted.",
- context, deviceName, pathsObject);
- createGetPathItem("operational", "Queries the operational (running) datastore on the mounted hosted.",
+ createGetPathItem("data", "Queries the config (startup) datastore on the mounted hosted.",
context, deviceName, pathsObject);
createGetPathItem("operations", "Queries the available operations (RPC calls) on the mounted hosted.",
context, deviceName, pathsObject);
pathItem.set("get", operationObject);
operationObject.put(DESCRIPTION_KEY, description);
operationObject.put(SUMMARY_KEY, HttpMethod.GET + SUMMARY_SEPARATOR + deviceName + SUMMARY_SEPARATOR
- + swaggerGenerator.getResourcePathPart(resourceType));
+ + resourceType);
operationObject.set(TAGS_KEY, buildTagsValue(Optional.of(deviceName), "GET root"));
final ObjectNode okResponse = JsonNodeFactory.instance.objectNode();
okResponse.put(DESCRIPTION_KEY, Response.Status.OK.getReasonPhrase());