@Test public void shouldBuildJsonSchema() { final String generated = DebeziumMySQLDatashapeStrategy.buildJsonSchema("table", Arrays.asList("\"prop1\":{\"type\":\"string\"}", "\"prop2\":{\"type\":\"string\"}", "\"prop3\":{\"type\":\"string\"}")); final String expected = "{\n" + " \"$schema\":\"http: " \"title\":\"table\",\n" + " \"type\":\"object\",\n" + " \"properties\":{\n" + " \"prop1\":{\n" + " \"type\":\"string\"\n" + " },\n" + " \"prop2\":{\n" + " \"type\":\"string\"\n" + " },\n" + " \"prop3\":{\n" + " \"type\":\"string\"\n" + " }\n" + " }\n" + "}"; assertThatJson(generated).isEqualTo(expected); }
static String buildJsonSchema(final String tableName, final List<String> properties) { final StringBuilder jsonSchemaBuilder = new StringBuilder("{\"$schema\": \"http: .append(tableName) .append("\",\"type\": \"object\",\"properties\": {"); final StringJoiner joiner = new StringJoiner(","); for (final String property : properties) { joiner.add(property); } return jsonSchemaBuilder.append(joiner.toString()) .append("}}") .toString(); }
DebeziumMySQLDatashapeStrategy implements DebeziumDatashapeStrategy { static String buildJsonSchema(final String tableName, final List<String> properties) { final StringBuilder jsonSchemaBuilder = new StringBuilder("{\"$schema\": \"http: .append(tableName) .append("\",\"type\": \"object\",\"properties\": {"); final StringJoiner joiner = new StringJoiner(","); for (final String property : properties) { joiner.add(property); } return jsonSchemaBuilder.append(joiner.toString()) .append("}}") .toString(); } }
DebeziumMySQLDatashapeStrategy implements DebeziumDatashapeStrategy { static String buildJsonSchema(final String tableName, final List<String> properties) { final StringBuilder jsonSchemaBuilder = new StringBuilder("{\"$schema\": \"http: .append(tableName) .append("\",\"type\": \"object\",\"properties\": {"); final StringJoiner joiner = new StringJoiner(","); for (final String property : properties) { joiner.add(property); } return jsonSchemaBuilder.append(joiner.toString()) .append("}}") .toString(); }  }
DebeziumMySQLDatashapeStrategy implements DebeziumDatashapeStrategy { static String buildJsonSchema(final String tableName, final List<String> properties) { final StringBuilder jsonSchemaBuilder = new StringBuilder("{\"$schema\": \"http: .append(tableName) .append("\",\"type\": \"object\",\"properties\": {"); final StringJoiner joiner = new StringJoiner(","); for (final String property : properties) { joiner.add(property); } return jsonSchemaBuilder.append(joiner.toString()) .append("}}") .toString(); }  @Override DataShape getDatashape(Map<String, Object> params); }
DebeziumMySQLDatashapeStrategy implements DebeziumDatashapeStrategy { static String buildJsonSchema(final String tableName, final List<String> properties) { final StringBuilder jsonSchemaBuilder = new StringBuilder("{\"$schema\": \"http: .append(tableName) .append("\",\"type\": \"object\",\"properties\": {"); final StringJoiner joiner = new StringJoiner(","); for (final String property : properties) { joiner.add(property); } return jsonSchemaBuilder.append(joiner.toString()) .append("}}") .toString(); }  @Override DataShape getDatashape(Map<String, Object> params);  }