openmessaging/openconnect

The SchemaBuilder method conflicts with the Schema method

Oliverwqcwrw opened this issue · 0 comments

In io.openmessaging.connector.api.data.SchemaBuilder#build

     return new Schema(name, type, isOptional(), defaultValue, version, doc,
                fields == null ? null : Collections.unmodifiableList(new ArrayList<>(fields.values())), keySchema, valueSchema, 
  parameters);

In io.openmessaging.connector.api.data.Schema#addField

 public void addField(Field field) {
    this.fields.add(field);
    this.fieldsByName.put(field.getName(), field);
}

It creates an unmodifiable collection but Schema provides methods to add field,

Throws java.lang.UnsupportedOperationException: null if we call the add Field method

I wonder if we should not create unmodifiable collections