use of io.apicurio.datamodels.asyncapi.models.AaiExternalDocumentation in project apicurio-data-models by Apicurio.
the class AaiDataModelReader method readMessageBase.
public void readMessageBase(Object json, AaiMessageBase node) {
// headers
Object jsonHeaders = JsonCompat.consumeProperty(json, Constants.PROP_HEADERS);
if (jsonHeaders != null) {
AaiHeaderItem headerModel = nodeFactory.createHeaderItem(node);
this.readHeaderItem(jsonHeaders, headerModel);
node.headers = headerModel;
}
// correlationId
Object jsonCI = JsonCompat.consumeProperty(json, Constants.PROP_CORRELATION_ID);
if (jsonCI != null) {
AaiCorrelationId value = nodeFactory.createCorrelationId(node, null);
this.readCorrelationId(jsonCI, value);
node.correlationId = value;
}
// String properties
node.schemaFormat = JsonCompat.consumePropertyString(json, Constants.PROP_SCHEMA_FORMAT);
node.contentType = JsonCompat.consumePropertyString(json, Constants.PROP_CONTENT_TYPE);
node.name = JsonCompat.consumePropertyString(json, Constants.PROP_NAME);
node.title = JsonCompat.consumePropertyString(json, Constants.PROP_TITLE);
node.summary = JsonCompat.consumePropertyString(json, Constants.PROP_SUMMARY);
node.description = JsonCompat.consumePropertyString(json, Constants.PROP_DESCRIPTION);
node.$ref = JsonCompat.consumePropertyString(json, Constants.PROP_$REF);
// tags
List<Object> jsonTags = JsonCompat.consumePropertyArray(json, Constants.PROP_TAGS);
if (jsonTags != null) {
jsonTags.forEach(j -> {
AaiTag tag = nodeFactory.createTag(node);
this.readTag(j, tag);
node.addTag(tag);
});
}
// external docs
Object jsonED = JsonCompat.consumeProperty(json, Constants.PROP_EXTERNAL_DOCS);
if (jsonED != null) {
AaiExternalDocumentation value = nodeFactory.createExternalDocumentation(node);
this.readExternalDocumentation(jsonED, value);
node.externalDocs = value;
}
// bindings
Object bindings = JsonCompat.consumeProperty(json, Constants.PROP_BINDINGS);
if (bindings != null) {
AaiMessageBindings bindingsModel = nodeFactory.createMessageBindings(node);
this.readMessageBindings(bindings, bindingsModel);
node.bindings = bindingsModel;
}
// examples
List<Object> examples = JsonCompat.consumePropertyArray(json, Constants.PROP_EXAMPLES);
if (examples != null) {
List<Map<String, Object>> examplesList = new ArrayList<>();
this.readMessageExamples(examples, examplesList);
node.examples = examplesList;
}
this.readExtensions(json, node);
this.readExtraProperties(json, node);
}
Aggregations