private final ObjectMapper mapper = new ObjectMapper();
private final DOMSchemaService schemaService;
- protected BaseYangSwaggerGenerator(Optional<DOMSchemaService> schemaService) {
+ protected BaseYangSwaggerGenerator(final Optional<DOMSchemaService> schemaService) {
this.schemaService = schemaService.orElse(null);
this.mapper.configure(SerializationFeature.INDENT_OUTPUT, true);
}
models = this.jsonConverter.convertToJsonSchema(module, schemaContext);
doc.setModels(models);
if (LOG.isDebugEnabled()) {
- LOG.debug(this.mapper.writeValueAsString(doc));
+ LOG.debug("Document: {}", this.mapper.writeValueAsString(doc));
}
} catch (IOException e) {
LOG.error("Exception occured in ModelGenerator", e);
final List<QName> listKeys = ((ListSchemaNode) schemaNode).getKeyDefinition();
for (final QName listKey : listKeys) {
final ListPathBuilder keyBuilder = newListPathBuilder();
- final DataSchemaNode dataChildByName = ((DataNodeContainer) schemaNode).getDataChildByName(listKey);
final String pathParamIdentifier = keyBuilder.nextParamIdentifier(listKey.getLocalName());
path.append(pathParamIdentifier);
final Parameter pathParam = new Parameter();
pathParam.setName(listKey.getLocalName());
- pathParam.setDescription(dataChildByName.getDescription().orElse(null));
+
+ ((DataNodeContainer) schemaNode).findDataChildByName(listKey).flatMap(DataSchemaNode::getDescription)
+ .ifPresent(pathParam::setDescription);
+
pathParam.setType("string");
pathParam.setParamType("path");