-
Notifications
You must be signed in to change notification settings - Fork 26
Description
TL;DR
The Java client (both v5.5.0 and v6.0.0) does not validate reserved property names like id, _id, or _additional at collection creation time, allowing schemas that may cause unexpected behavior. Should the client add validation like the Python client does?
Question
Should the Java client add validation for reserved property names?
Description
According to Weaviate documentation, the following property names are reserved and cannot be used:
_additionalid_id
However, both Java v5 and v6 clients do not validate these restrictions at the client side. This allows developers to create collection schemas that may cause issues, without any warning or error during schema creation.
Current Behavior
Java v5 (5.5.0)
The Java v5 client successfully creates collections with reserved property names in nested objects:
List<Property.NestedProperty> nestedProps = Arrays.asList(
Property.NestedProperty.builder()
.name("id") // Reserved word - no validation error
.dataType(Arrays.asList("text"))
.build(),
Property.NestedProperty.builder()
.name("_additional") // Reserved word - no validation error
.dataType(Arrays.asList("text"))
.build()
);
Property property = Property.builder()
.name("metadata")
.dataType(Arrays.asList("object"))
.nestedProperties(nestedProps)
.build();Result: Collection created successfully without any client-side validation.
Java v6 (6.0.0)
The Java v6 client (with new functional API) also allows reserved names:
CollectionHandle<Map<String, Object>> collection = client.collections.create(
className,
col -> col.properties(
Property.object("metadata", obj -> obj
.nestedProperties(
Property.text("id"), // Reserved word - no validation error
Property.text("_additional") // Reserved word - no validation error
)
)
)
);Result: Collection created successfully without any client-side validation.
Comparison with Other Clients
| Client | Version | Validates Reserved Words? | Behavior |
|---|---|---|---|
| Python | 4.19.2 | ✅ Yes | Blocks reserved names via Pydantic validation |
| Go v5 | 5.6.0 | ❌ No | Allows all property names |
| Java v5 | 5.5.0 | ❌ No | Allows all property names |
| Java v6 | 6.0.0 | ❌ No | Allows all property names |
Java v6 Test
CollectionHandle<Map<String, Object>> collection = client.collections.create(
"TestNested",
col -> col.properties(
Property.object("metadata", obj -> obj
.nestedProperties(
Property.text("id") // Should this be validated?
)
)
)
);
// No error - collection created successfullyEnvironment
- Java v5 Client: io.weaviate:client:5.5.0
- Java v6 Client: io.weaviate:client6:6.0.0
- Java Version: 17
- Weaviate Server: 1.34.0