-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
THRIFT-3037: Support Struct Typedefs in Go Codegen
Client: Go
- Loading branch information
1 parent
8a6bcc7
commit 5084784
Showing
5 changed files
with
123 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you 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. | ||
# | ||
|
||
# We are only testing that generated code compiles, no correctness checking is done | ||
|
||
struct ExampleRequest { | ||
1: required string example_field | ||
} | ||
|
||
struct ExampleResponse { | ||
1: required string example_field | ||
} | ||
|
||
struct ExampleOptionalRequest { | ||
1: optional string example_field | ||
} | ||
|
||
struct ExampleOptionalResponse { | ||
1: optional string example_field | ||
} | ||
|
||
struct ExampleNested { | ||
1: required string example_field | ||
} | ||
|
||
struct ExampleOptionalNestedRequest { | ||
1: optional ExampleNested example_field | ||
} | ||
|
||
struct ExampleOptionalNestedResponse { | ||
1: optional ExampleNested example_field | ||
} | ||
|
||
typedef ExampleRequest TypedefExampleRequest | ||
typedef ExampleResponse TypedefExampleResponse | ||
|
||
typedef string PrimativeTypedefExampleRequest | ||
typedef string PrimativeTypedefExampleResponse | ||
|
||
service TypeDefService { | ||
ExampleResponse exampleMethod(1: ExampleRequest request) | ||
TypedefExampleResponse typedefExampleMethod(1: TypedefExampleRequest request) | ||
string primativeExampleMethod(1: string request) | ||
PrimativeTypedefExampleResponse primativeTypedefExampleMethod(1: PrimativeTypedefExampleRequest request) | ||
ExampleOptionalResponse exampleOptionalMethod(1: ExampleOptionalRequest request) | ||
ExampleOptionalNestedResponse exampleOptionalNestedMethod(1: ExampleOptionalNestedRequest request) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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. | ||
*/ | ||
|
||
package tests | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/apache/thrift/lib/go/test/gopath/src/typedefservicetest" | ||
) | ||
|
||
func TestTypedefService(t *testing.T) { | ||
// We need to import the generated code to ensure it compiles | ||
_ = &typedefservicetest.TypedefExampleRequest{} | ||
} |