Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing compilation for RPC using struct #2511

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions wire-golden-files/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,27 @@ plugins {
id("com.squareup.wire")
}

dependencies {
implementation(projects.wireGrpcClient)
}

wire {
kotlin {
includes = listOf("squareup.wire.service.*")
out = "src/main/kotlin"
exclusive = false
rpcRole = "client"
rpcCallStyle = "suspending"
}

kotlin {
includes = listOf("squareup.wire.service.*")
out = "src/main/kotlin"
exclusive = true
rpcRole = "server"
rpcCallStyle = "blocking"
}

kotlin {
includes = listOf("squareup.wire.buildersonly.*")
out = "src/main/kotlin"
Expand All @@ -22,3 +42,8 @@ wire {
out = "src/main/kotlin"
}
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: squareup.wire.service.MyService in squareup/wire/service.proto
package squareup.wire.service

import com.squareup.wire.GrpcCall
import com.squareup.wire.GrpcClient
import com.squareup.wire.GrpcMethod
import com.squareup.wire.ProtoAdapter
import kotlin.String
import kotlin.collections.Map

public class GrpcMyServiceClient(
private val client: GrpcClient,
) : MyServiceClient {
override fun CreateOrder(): GrpcCall<Map<String, *>?, Map<String, *>?> =
client.newCall(GrpcMethod(
path = "/squareup.wire.service.MyService/CreateOrder",
requestAdapter = ProtoAdapter.STRUCT_MAP,
responseAdapter = ProtoAdapter.STRUCT_MAP
))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: squareup.wire.service.MyService in squareup/wire/service.proto
package squareup.wire.service

import com.squareup.wire.Service
import com.squareup.wire.WireRpc
import kotlin.String
import kotlin.collections.Map

public interface MyServiceBlockingServer : Service {
@WireRpc(
path = "/squareup.wire.service.MyService/CreateOrder",
requestAdapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP",
responseAdapter = "com.squareup.wire.ProtoAdapter#STRUCT_MAP",
sourceFile = "squareup/wire/service.proto",
)
public fun CreateOrder(request: Map<String, *>?): Map<String, *>?
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Code generated by Wire protocol buffer compiler, do not edit.
// Source: squareup.wire.service.MyService in squareup/wire/service.proto
package squareup.wire.service

import com.squareup.wire.GrpcCall
import com.squareup.wire.Service
import kotlin.String
import kotlin.collections.Map

public interface MyServiceClient : Service {
public fun CreateOrder(): GrpcCall<Map<String, *>?, Map<String, *>?>
}
23 changes: 23 additions & 0 deletions wire-golden-files/src/main/proto/squareup/wire/service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (C) 2023 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
syntax = "proto2";
package squareup.wire.service;

import "google/protobuf/struct.proto";

service MyService {
rpc CreateOrder(google.protobuf.Struct) returns (google.protobuf.Struct);
}