I am using java client to set a schema
I am getting the below error
java.lang.RuntimeException: The alter encountered an execution exception:
Caused by: java.util.concurrent.ExecutionException: io.grpc.StatusRuntimeException: UNKNOWN: line 2 column 24: Expected new line after field declaration. Got @
code
ManagedChannel channel =
ManagedChannelBuilder.forAddress("localhost", 9080).usePlaintext().build();
DgraphGrpc.DgraphStub stub = DgraphGrpc.newStub(channel);
DgraphClient client = new DgraphClient(stub);
client.checkVersion();
DgraphProto.Operation operation = DgraphProto.Operation
.newBuilder()
.setSchema("""
type Account {
accountNumber: string @index(exact)
}
""")
.build();
client.alter(operation);
channel.shutdownNow().awaitTermination(30, TimeUnit.SECONDS);
dependencies
implementation 'io.dgraph:dgraph4j:21.12.0'
implementation 'io.netty:netty-tcnative-boringssl-static:2.0.31.Final'
implementation 'io.grpc:grpc-netty:1.34.1'
implementation 'com.google.code.gson:gson:2.11.0'
// implementation 'io.grpc:grpc-protobuf:1.34.1'
// implementation 'io.grpc:grpc-stub:1.34.1'
// implementation 'io.grpc:grpc-netty:1.34.1'
implementation 'com.google.protobuf:protobuf-java:3.5.1'
Dgraph version - 24.0.1
server logs doesn’t show any error
31 server.go:383] Received ALTER op: schema:"type Account {\n accountNumber: string @index(exact)\n}\n"
2024-08-05 16:00:09 I0805 10:30:09.845840 31 server.go:1887] Got Alter request from: "192.168.65.1:30985"
2024-08-05 16:00:09 I0805 10:30:09.848505 31 server.go:529] ALTER op: schema:"type Account {\n accountNumber: string @index(exact)\n}\n" done