use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class FragmentResolverTest method attemptToUsePropertyNameOnArrayNodeThrowsIllegalArgumentException.
@Test(expected = IllegalArgumentException.class)
public void attemptToUsePropertyNameOnArrayNodeThrowsIllegalArgumentException() {
ObjectNode root = new ObjectMapper().createObjectNode();
ArrayNode a = root.arrayNode();
root.set("a", a);
resolver.resolve(root, "#/a/b", "#/.");
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.
the class FragmentResolverTest method missingPathThrowsIllegalArgumentException.
@Test(expected = IllegalArgumentException.class)
public void missingPathThrowsIllegalArgumentException() {
ObjectNode root = new ObjectMapper().createObjectNode();
resolver.resolve(root, "#/a/b/c", "#/.");
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project OpenAM by OpenRock.
the class SubjectTypesResource method jsonify.
/**
* Transforms a subclass of {@link EntitlementSubject} in to a JsonSchema representation.
* This schema is then combined with the Subject's name (taken as the resourceId) and all this is
* compiled together into a new {@link JsonValue} object until "title" and "config" fields respectively.
*
* @param subjectClass The class whose schema to produce.
* @param resourceId The ID of the resource to return
* @return A JsonValue containing the schema of the EntitlementSubject
*/
private JsonValue jsonify(Class<? extends EntitlementSubject> subjectClass, String resourceId, boolean logical) {
try {
final JsonSchema schema = mapper.generateJsonSchema(subjectClass);
//this will remove the 'subjectName' attribute from those subjects which incorporate it unnecessarily
final JsonNode node = schema.getSchemaNode().get("properties");
if (node instanceof ObjectNode) {
final ObjectNode alter = (ObjectNode) node;
alter.remove("subjectName");
}
return JsonValue.json(JsonValue.object(JsonValue.field(JSON_OBJ_TITLE, resourceId), JsonValue.field(JSON_OBJ_LOGICAL, logical), JsonValue.field(JSON_OBJ_CONFIG, schema)));
} catch (JsonMappingException e) {
if (debug.errorEnabled()) {
debug.error("SubjectTypesResource :: JSONIFY - Error applying " + "jsonification to the Subject class representation.", e);
}
return null;
}
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project KaiZen-OpenAPI-Editor by RepreZen.
the class SwaggerSchema method allowJsonRefInSecurityDefinitionsObject.
protected void allowJsonRefInSecurityDefinitionsObject(boolean allow) {
ObjectNode definition = (ObjectNode) jsonRefContexts.get(SwaggerPreferenceConstants.VALIDATION_REF_SECURITY_DEFINITIONS_OBJECT);
if (allow) {
ObjectNode propertiesNode = definition.putObject("properties");
propertiesNode.putObject("$ref").put("type", "string");
} else {
definition.remove("properties");
}
}
use of com.fasterxml.jackson.databind.node.ObjectNode in project azure-sdk-for-java by Azure.
the class DeployUsingARMTemplateWithTags method validateAndAddFieldValue.
private static void validateAndAddFieldValue(String type, String fieldValue, String fieldName, String errorMessage, JsonNode tmp) throws IllegalAccessException {
// Add count variable for loop....
final ObjectMapper mapper = new ObjectMapper();
final ObjectNode parameter = mapper.createObjectNode();
parameter.put("type", type);
if (type == "int") {
parameter.put("defaultValue", Integer.parseInt(fieldValue));
} else {
parameter.put("defaultValue", fieldValue);
}
ObjectNode.class.cast(tmp.get("parameters")).replace(fieldName, parameter);
}
Aggregations