use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode in project KaiZen-OpenAPI-Editor by RepreZen.
the class ObjectTypeDefinition method initProperties.
protected void initProperties(String container, Map<String, TypeDefinition> properties) {
if (content.has(container) && content.get(container).isObject()) {
JsonNode node = content.get(container);
if (JsonReference.isReference(node)) {
node = schema.resolve(JsonReference.getPointer(node));
}
for (Iterator<Entry<String, JsonNode>> it = node.fields(); it.hasNext(); ) {
Entry<String, JsonNode> e = it.next();
String property = e.getKey().replaceAll("/", "~1");
TypeDefinition type = schema.createType(this, container + "/" + property, e.getValue());
if (type != null) {
properties.put(e.getKey(), type);
}
}
}
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode in project KaiZen-OpenAPI-Editor by RepreZen.
the class ErrorProcessor method createMultiple.
private SwaggerError createMultiple(JsonNode error, int indent) {
final MultipleSwaggerErrorBuilder schemaErrorBuilder = new MultipleSwaggerErrorBuilder().locatedOn(getLine(error, document)).withSeverity(getLevel(error)).indented(indent).basedOnSchema(jsonSchema);
final JsonNode reports = error.get("reports");
for (Iterator<Entry<String, JsonNode>> it = reports.fields(); it.hasNext(); ) {
Entry<String, JsonNode> next = it.next();
schemaErrorBuilder.withErrorsOnPath(next.getKey(), fromNode(next.getValue(), indent + 1));
}
return schemaErrorBuilder.build();
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode in project KaiZen-OpenAPI-Editor by RepreZen.
the class ErrorProcessor method rewriteEnumError.
protected String rewriteEnumError(JsonNode error) {
final JsonNode value = error.get("value");
final JsonNode enums = error.get("enum");
final String enumString = Joiner.on(", ").join(enums);
return String.format(Messages.error_notInEnum, value.asText(), enumString);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode in project EnrichmentMapApp by BaderLab.
the class ColorJsonDeserializer method deserialize.
@Override
public Color deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException {
final ObjectCodec oc = jp.getCodec();
final JsonNode node = oc.readTree(jp);
return node.isTextual() ? ColorUtil.parseColor(node.asText()) : null;
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode in project EnrichmentMapApp by BaderLab.
the class PropertiesJsonDeserializer method deserialize.
@Override
public Map<String, Object> deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException, JsonProcessingException {
final Map<String, Object> props = new LinkedHashMap<>();
final ObjectMapper mapper = (ObjectMapper) jp.getCodec();
final JsonNode rootNode = mapper.readTree(jp);
if (rootNode.isObject()) {
final Iterator<String> fieldNames = rootNode.fieldNames();
while (fieldNames.hasNext()) {
final String key = fieldNames.next();
final JsonNode jn = rootNode.get(key);
final Object value = readValue(key, jn.toString(), mapper, chart);
props.put(key, value);
}
}
return props;
}
Aggregations