@Test public void list_checksThatSubobjectUnionDiscriminatorAttributeExists() throws Exception { Exception e = assertThrows(InvalidSchemaException.class, () -> schema(field("name", string()), field("config", union("type")) )); assertEquals("Discriminator attribute 'type' not present.", e.getMessage()); }
private Schema(Builder builder) { this.fieldNames = builder.fields.stream().map(Field::name).collect(toList()); this.fields = ImmutableList.copyOf(builder.fields); this.optionalFields = ImmutableSet.copyOf(builder.optionalFields); this.constraints = ImmutableList.copyOf(builder.constraints); this.ignore = builder.pass; this.name = builder.name.length() > 0 ? builder.name : String.join(", ", this.fieldNames); }
Schema { private Schema(Builder builder) { this.fieldNames = builder.fields.stream().map(Field::name).collect(toList()); this.fields = ImmutableList.copyOf(builder.fields); this.optionalFields = ImmutableSet.copyOf(builder.optionalFields); this.constraints = ImmutableList.copyOf(builder.constraints); this.ignore = builder.pass; this.name = builder.name.length() > 0 ? builder.name : String.join(", ", this.fieldNames); } }
Schema { private Schema(Builder builder) { this.fieldNames = builder.fields.stream().map(Field::name).collect(toList()); this.fields = ImmutableList.copyOf(builder.fields); this.optionalFields = ImmutableSet.copyOf(builder.optionalFields); this.constraints = ImmutableList.copyOf(builder.constraints); this.ignore = builder.pass; this.name = builder.name.length() > 0 ? builder.name : String.join(", ", this.fieldNames); } private  Schema(Builder builder); }
Schema { private Schema(Builder builder) { this.fieldNames = builder.fields.stream().map(Field::name).collect(toList()); this.fields = ImmutableList.copyOf(builder.fields); this.optionalFields = ImmutableSet.copyOf(builder.optionalFields); this.constraints = ImmutableList.copyOf(builder.constraints); this.ignore = builder.pass; this.name = builder.name.length() > 0 ? builder.name : String.join(", ", this.fieldNames); } private  Schema(Builder builder); Set<String> optionalFields(); List<String> fieldNames(); List<Field> fields(); List<Constraint> constraints(); String name(); boolean ignore(); Builder newBuilder(); }
Schema { private Schema(Builder builder) { this.fieldNames = builder.fields.stream().map(Field::name).collect(toList()); this.fields = ImmutableList.copyOf(builder.fields); this.optionalFields = ImmutableSet.copyOf(builder.optionalFields); this.constraints = ImmutableList.copyOf(builder.constraints); this.ignore = builder.pass; this.name = builder.name.length() > 0 ? builder.name : String.join(", ", this.fieldNames); } private  Schema(Builder builder); Set<String> optionalFields(); List<String> fieldNames(); List<Field> fields(); List<Constraint> constraints(); String name(); boolean ignore(); Builder newBuilder();  }