/** * Test for [JACKSON-415] * * @since 1.7 */ public void testWithJaxb() throws Exception { ObjectMapper mapper = getJaxbMapper(); JsonSchema jsonSchema = mapper.generateJsonSchema(Address.class); ObjectNode root = jsonSchema.getSchemaNode(); // should find two properties ("city", "state"), not just one... JsonNode itemsNode = root.findValue("properties"); assertNotNull("Missing 'state' field", itemsNode.get("state")); assertNotNull("Missing 'city' field", itemsNode.get("city")); assertEquals(2, itemsNode.size()); }
@Override public JsonSchema customize(JsonSchema originalSchema) { JsonSchema jsonSchema = super.customize(originalSchema); String defaultServerUrl = System.getenv(OPENSHIFT_BROKER_HOST); if (defaultServerUrl == null || defaultServerUrl.trim().equals("")) { defaultServerUrl = "openshift.redhat.com"; } // // jsonSchema.asObjectSchema().getProperties().get("serverUrl").asStringSchema().setDefault(defaultServerUrl); ((ObjectNode) jsonSchema.getSchemaNode().get("properties").get("serverUrl")) .set("default", new TextNode(defaultServerUrl)); return jsonSchema; }