Closed alperengozeten closed 3 years ago
Hi, thanks for your issue. I would be happy to review an update of #1968 and have it merged into our code. Maybe you could take that branch, rebase it on master
and create a new PR? As long as we can get @misberner to consent to the code being merged it should be okay :).
I tried to rebase the PR in the master but when I run the main_test.go, I get the following output
=== RUN TestParseReqParam
--- PASS: TestParseReqParam (0.00s)
=== RUN TestParseReqParam/Test_0
--- PASS: TestParseReqParam/Test_0 (0.00s)
=== RUN TestParseReqParam/Test_1
--- PASS: TestParseReqParam/Test_1 (0.00s)
=== RUN TestParseReqParam/Test_2
--- PASS: TestParseReqParam/Test_2 (0.00s)
=== RUN TestParseReqParam/Test_3
--- PASS: TestParseReqParam/Test_3 (0.00s)
=== RUN TestParseReqParam/Test_4
--- PASS: TestParseReqParam/Test_4 (0.00s)
=== RUN TestParseReqParam/Test_5
--- PASS: TestParseReqParam/Test_5 (0.00s)
=== RUN TestParseReqParam/Test_6
--- PASS: TestParseReqParam/Test_6 (0.00s)
=== RUN TestParseReqParam/Test_7
--- PASS: TestParseReqParam/Test_7 (0.00s)
=== RUN TestParseReqParam/Test_8
--- PASS: TestParseReqParam/Test_8 (0.00s)
=== RUN TestParseReqParam/Test_9
--- PASS: TestParseReqParam/Test_9 (0.00s)
=== RUN TestParseReqParam/Test_10
--- PASS: TestParseReqParam/Test_10 (0.00s)
=== RUN TestParseReqParam/Test_11
--- PASS: TestParseReqParam/Test_11 (0.00s)
=== RUN TestParseReqParam/Test_12
--- PASS: TestParseReqParam/Test_12 (0.00s)
PASS
panic: unexpected call to os.Exit(0) during test
goroutine 1 [running]:
os.Exit(0x0)
C:/Program Files/Go/src/os/proc.go:68 +0x74
main.main()
_testmain.go:43 +0x153
It seems like it passes all 12 tests, however, it throws panic at the end of the tests. I also tried to paste the changes one by one after forking the grpc-gateway repo, but still the same result. I couldn't really find the possible origin of this error. Do you have any idea about any possible reason for this error? Thank you.
The branch I created (which fails main_test.go) https://github.com/alperengozeten/grpc-gateway/tree/naming-strategy
I got nerd sniped by this, but I think the new main_test was just overly complicated, so I reverted most of it. I tried pushing to your branch but I don't think I have permissions. I also made it a bit easier to read. Here's the patch:
From de56a4224fff90a0fb294c6e67a4f6470aceaa1a Mon Sep 17 00:00:00 2001
From: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Date: Fri, 27 Aug 2021 02:25:40 +0000
Subject: [PATCH] Fix main test
---
protoc-gen-openapiv2/main.go | 2 +-
protoc-gen-openapiv2/main_test.go | 244 ++++++++++++++++++++----------
2 files changed, 166 insertions(+), 80 deletions(-)
diff --git a/protoc-gen-openapiv2/main.go b/protoc-gen-openapiv2/main.go
index 40702a4..deadad3 100644
--- a/protoc-gen-openapiv2/main.go
+++ b/protoc-gen-openapiv2/main.go
@@ -86,7 +86,7 @@ func main() {
reg.SetUseJSONNamesForFields(*useJSONNamesForFields)
reg.SetAllowRepeatedFieldsInBody(*allowRepeatedFieldsInBody)
reg.SetIncludePackageInTags(*includePackageInTags)
-
+ reg.SetUseFQNForOpenAPIName(*useFQNForOpenAPIName)
// Set the naming strategy either directly from the flag, or via the value of the legacy fqn_for_openapi_name
// flag.
namingStrategy := *openAPINamingStrategy
diff --git a/protoc-gen-openapiv2/main_test.go b/protoc-gen-openapiv2/main_test.go
index b86c03b..daf65d1 100644
--- a/protoc-gen-openapiv2/main_test.go
+++ b/protoc-gen-openapiv2/main_test.go
@@ -28,100 +28,170 @@ func TestParseReqParam(t *testing.T) {
// this one must be first - with no leading clearFlags call it
// verifies our expectation of default values as we reset by
// clearFlags
- name: "Test 0",
- expected: map[string]string{},
- request: "",
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false,
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 0",
+ expected: map[string]string{},
+ request: "",
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ fileV: "-",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 1",
- expected: map[string]string{"google/api/annotations.proto": "github.com/googleapis/googleapis/google/api"},
- request: "allow_delete_body,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/googleapis/googleapis/google/api",
- allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, includePackageInTagsV: true,
- fileV: "./foo.pb", importPathV: "/bar/baz", mergeFileNameV: "apidocs",
+ name: "Test 1",
+ expected: map[string]string{"google/api/annotations.proto": "github.com/googleapis/googleapis/google/api"},
+ request: "allow_delete_body,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/googleapis/googleapis/google/api",
+ allowDeleteBodyV: true,
+ allowMergeV: true,
+ allowRepeatedFieldsInBodyV: true,
+ includePackageInTagsV: true,
+ fileV: "./foo.pb",
+ importPathV: "/bar/baz",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 2",
- expected: map[string]string{"google/api/annotations.proto": "github.com/googleapis/googleapis/google/api"},
- request: "allow_delete_body=true,allow_merge=true,allow_repeated_fields_in_body=true,include_package_in_tags=true,merge_file_name=test_name,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/googleapis/googleapis/google/api",
- allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, includePackageInTagsV: true,
- fileV: "./foo.pb", importPathV: "/bar/baz", mergeFileNameV: "test_name",
+ name: "Test 2",
+ expected: map[string]string{"google/api/annotations.proto": "github.com/googleapis/googleapis/google/api"},
+ request: "allow_delete_body=true,allow_merge=true,allow_repeated_fields_in_body=true,include_package_in_tags=true,merge_file_name=test_name,file=./foo.pb,import_prefix=/bar/baz,Mgoogle/api/annotations.proto=github.com/googleapis/googleapis/google/api",
+ allowDeleteBodyV: true,
+ allowMergeV: true,
+ allowRepeatedFieldsInBodyV: true,
+ includePackageInTagsV: true,
+ fileV: "./foo.pb",
+ importPathV: "/bar/baz",
+ mergeFileNameV: "test_name",
},
{
- name: "Test 3",
- expected: map[string]string{"a/b/c.proto": "github.com/x/y/z", "f/g/h.proto": "github.com/1/2/3/"},
- request: "allow_delete_body=false,allow_merge=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/",
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false,
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 3",
+ expected: map[string]string{"a/b/c.proto": "github.com/x/y/z",
+ "f/g/h.proto": "github.com/1/2/3/"},
+ request: "allow_delete_body=false,allow_merge=false,Ma/b/c.proto=github.com/x/y/z,Mf/g/h.proto=github.com/1/2/3/",
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ fileV: "stdin",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 4",
- expected: map[string]string{},
- request: "",
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false,
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 4",
+ expected: map[string]string{},
+ request: "",
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ fileV: "stdin",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 5",
- expected: map[string]string{},
- request: "unknown_param=17",
- expectedError: errors.New("cannot set flag unknown_param=17: no such flag -unknown_param"),
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false,
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 5",
+ expected: map[string]string{},
+ request: "unknown_param=17",
+ expectedError: errors.New("cannot set flag unknown_param=17: no such flag -unknown_param"),
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ fileV: "stdin",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 6",
- expected: map[string]string{},
- request: "Mfoo",
- expectedError: errors.New("cannot set flag Mfoo: no such flag -Mfoo"),
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false,
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 6",
+ expected: map[string]string{},
+ request: "Mfoo",
+ expectedError: errors.New("cannot set flag Mfoo: no such flag -Mfoo"),
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ fileV: "stdin",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 7",
- expected: map[string]string{},
- request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,merge_file_name",
- allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: true, includePackageInTagsV: true,
- fileV: "", importPathV: "", mergeFileNameV: "",
+ name: "Test 7",
+ expected: map[string]string{},
+ request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body,include_package_in_tags,merge_file_name",
+ allowDeleteBodyV: true,
+ allowMergeV: true,
+ allowRepeatedFieldsInBodyV: true,
+ includePackageInTagsV: true,
+ fileV: "",
+ importPathV: "",
+ mergeFileNameV: "",
},
{
- name: "Test 8",
- expected: map[string]string{},
- request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body=3,merge_file_name",
- expectedError: errors.New(`cannot set flag allow_repeated_fields_in_body=3: parse error`),
- allowDeleteBodyV: true, allowMergeV: true, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false,
- fileV: "", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 8",
+ expected: map[string]string{},
+ request: "allow_delete_body,file,import_prefix,allow_merge,allow_repeated_fields_in_body=3,merge_file_name",
+ expectedError: errors.New(`cannot set flag allow_repeated_fields_in_body=3: parse error`),
+ allowDeleteBodyV: true,
+ allowMergeV: true,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ fileV: "",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 9",
- expected: map[string]string{},
- request: "include_package_in_tags=3",
- expectedError: errors.New(`cannot set flag include_package_in_tags=3: parse error`),
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false,
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 9",
+ expected: map[string]string{},
+ request: "include_package_in_tags=3",
+ expectedError: errors.New(`cannot set flag include_package_in_tags=3: parse error`),
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ fileV: "stdin",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 10",
- expected: map[string]string{},
- request: "fqn_for_openapi_name=3",
- expectedError: errors.New(`cannot set flag fqn_for_openapi_name=3: parse error`),
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, useFQNForOpenAPINameV: false,
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 10",
+ expected: map[string]string{},
+ request: "fqn_for_openapi_name=3",
+ expectedError: errors.New(`cannot set flag fqn_for_openapi_name=3: parse error`),
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ useFQNForOpenAPINameV: false,
+ fileV: "stdin",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 11",
- expected: map[string]string{},
- request: "fqn_for_openapi_name=true",
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, useFQNForOpenAPINameV: true,
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 11",
+ expected: map[string]string{},
+ request: "fqn_for_openapi_name=true",
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ useFQNForOpenAPINameV: true,
+ fileV: "stdin",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
{
- name: "Test 12",
- expected: map[string]string{},
- request: "openapi_naming_strategy=simple",
- allowDeleteBodyV: false, allowMergeV: false, allowRepeatedFieldsInBodyV: false, includePackageInTagsV: false, useFQNForOpenAPINameV: false, openAPINamingStrategyV: "simple",
- fileV: "-", importPathV: "", mergeFileNameV: "apidocs",
+ name: "Test 12",
+ expected: map[string]string{},
+ request: "openapi_naming_strategy=simple",
+ allowDeleteBodyV: false,
+ allowMergeV: false,
+ allowRepeatedFieldsInBodyV: false,
+ includePackageInTagsV: false,
+ useFQNForOpenAPINameV: false,
+ openAPINamingStrategyV: "simple",
+ fileV: "stdin",
+ importPathV: "",
+ mergeFileNameV: "apidocs",
},
}
@@ -149,13 +219,25 @@ func TestParseReqParam(t *testing.T) {
}
}
checkFlags(tc.allowDeleteBodyV, tc.allowMergeV, tc.allowRepeatedFieldsInBodyV, tc.includePackageInTagsV, tc.useFQNForOpenAPINameV, tc.openAPINamingStrategyV, tc.fileV, tc.importPathV, tc.mergeFileNameV, tt, i)
-
- clearFlags(tt, f)
+
+ clearFlags()
})
}
}
-func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV, includePackageInTagsV bool, useFQNForOpenAPINameV bool, openAPINamingStrategyV, fileV, importPathV, mergeFileNameV string, t *testing.T, tid int) {
+func checkFlags(
+ allowDeleteV,
+ allowMergeV,
+ allowRepeatedFieldsInBodyV,
+ includePackageInTagsV bool,
+ useFQNForOpenAPINameV bool,
+ openAPINamingStrategyV,
+ fileV,
+ importPathV,
+ mergeFileNameV string,
+ t *testing.T,
+ tid int,
+) {
if *importPrefix != importPathV {
t.Errorf("Test %v: import_prefix misparsed, expected '%v', got '%v'", tid, importPathV, *importPrefix)
}
@@ -185,10 +267,14 @@ func checkFlags(allowDeleteV, allowMergeV, allowRepeatedFieldsInBodyV, includePa
}
}
-func clearFlags(t *testing.T, f *flag.FlagSet) {
- f.Visit(func(flg *flag.Flag) {
- if err := flg.Value.Set(flg.DefValue); err != nil {
- t.Errorf("Error resetting flag %s: %v", flg.Name, err)
- }
- })
+func clearFlags() {
+ *importPrefix = ""
+ *file = "stdin"
+ *allowDeleteBody = false
+ *allowMerge = false
+ *allowRepeatedFieldsInBody = false
+ *includePackageInTags = false
+ *mergeFileName = "apidocs"
+ *useFQNForOpenAPIName = false
+ *openAPINamingStrategy = ""
}
--
2.30.2
You can apply it with
$ git am < file.patch
Thank you so much, that solved my issue with main_test. But when I run the go test ./...
, I get the following error. (Btw I am a newbie in go, these were my first codes actually). I also invited you to my forked repo, you can push directly there as well. Thanks again.
go test ./...
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/abe [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/echo [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/generateunboundmethods [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/responsebody [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/unannotatedecho [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/cmd/example-gateway-server [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/cmd/example-grpc-server [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/gateway [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/helloworld [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/integration 2.143s
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/standalone [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2 [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/server [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator 0.140s
ok github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor 0.152s
? github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/apiconfig [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule 0.168s
ok github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway 0.224s
ok github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/internal/gengateway 0.196s
ok github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 0.181s
--- FAIL: TestUpdateOpenAPIDataFromComments (0.00s)
--- FAIL: TestUpdateOpenAPIDataFromComments/error_with_use_go_template (0.00s)
template_test.go:4472: openapiSwaggerObject was not updated correctly, expected '&{schemaCore:{Type: Format: Ref: XNullable:false Example:[] Items:<nil> Enum:[] Default:} Properties:<nil> AdditionalProperties:<nil> Description:open noneexistingfile.txt: no such file or directory Title:First line ExternalDocs:<nil> ReadOnly:false MultipleOf:0 Maximum:0 ExclusiveMaximum:false Minimum:0 ExclusiveMinimum:false MaxLength:0 MinLength:0 Pattern: MaxItems:0 MinItems:0 UniqueItems:false MaxProperties:0 MinProperties:0 Required:[]}', got '&{schemaCore:{Type: Format: Ref: XNullable:false Example:[] Items:<nil> Enum:[] Default:} Properties:<nil> AdditionalProperties:<nil> Description:open noneexistingfile.txt: The system cannot find the file specified. Title:First line ExternalDocs:<nil> ReadOnly:false MultipleOf:0 Maximum:0 ExclusiveMaximum:false Minimum:0 ExclusiveMinimum:false MaxLength:0 MinLength:0 Pattern: MaxItems:0 MinItems:0 UniqueItems:false MaxProperties:0 MinProperties:0 Required:[]}'
E0827 11:28:03.656684 17316 template.go:1302] no message found: Status
FAIL
FAIL github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopenapi 0.235s
? github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/runtime 0.175s
? github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/utilities 0.078s
FAIL
PS C:\Users\HP\VSCode\clone\grpc-gateway> go test ./...
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/abe [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/echo [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/generateunboundmethods [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/responsebody [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/clients/unannotatedecho [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/cmd/example-gateway-server [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/cmd/example-grpc-server [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/gateway [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/helloworld [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/integration (cached)
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/examplepb [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/pathenum [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/standalone [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/proto/sub2 [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/examples/internal/server [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/internal/casing [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/internal/codegenerator (cached)
ok github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor (cached)
? github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/apiconfig [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor/openapiconfig [no test files]
? github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule (cached)
ok github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway (cached)
ok github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway/internal/gengateway (cached)
ok github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 (cached)
--- FAIL: TestUpdateOpenAPIDataFromComments (0.00s)
--- FAIL: TestUpdateOpenAPIDataFromComments/error_with_use_go_template (0.00s)
template_test.go:4472: openapiSwaggerObject was not updated correctly, expected '&{schemaCore:{Type: Format: Ref: XNullable:false Example:[] Items:<nil> Enum:[] Default:} Properties:<nil> AdditionalProperties:<nil> Description:open noneexistingfile.txt: no such file or directory Title:First line ExternalDocs:<nil> ReadOnly:false MultipleOf:0 Maximum:0 ExclusiveMaximum:false Minimum:0 ExclusiveMinimum:false MaxLength:0 MinLength:0 Pattern: MaxItems:0 MinItems:0 UniqueItems:false MaxProperties:0 MinProperties:0 Required:[]}', got '&{schemaCore:{Type: Format: Ref: XNullable:false Example:[] Items:<nil> Enum:[] Default:} Properties:<nil> AdditionalProperties:<nil> Description:open noneexistingfile.txt: The system cannot find the file specified. Title:First line ExternalDocs:<nil> ReadOnly:false MultipleOf:0 Maximum:0 ExclusiveMaximum:false Minimum:0 ExclusiveMinimum:false MaxLength:0 MinLength:0 Pattern: MaxItems:0 MinItems:0 UniqueItems:false MaxProperties:0 MinProperties:0 Required:[]}'
E0827 11:28:25.357934 29480 template.go:1302] no message found: Status
E0827 11:28:25.360664 29480 template.go:1302] no message found: Status
FAIL
FAIL github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopenapi 0.197s
? github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/runtime (cached)
? github.com/grpc-ecosystem/grpc-gateway/v2/runtime/internal/examplepb [no test files]
ok github.com/grpc-ecosystem/grpc-gateway/v2/utilities (cached)
FAIL
Curiously, the tests run just fine on my machine. I wonder if this is perhaps a windows thing 🤷🏻? I'm happy to hear that your interest in the project is leading you to learn about Go 🤗. Anyway, would you like to open this branch as a PR and we can take it from there?
Thank you, that was the issue, I'm running on a Windows machine. I just opened a PR, #2310. Thanks again.
🚀 Feature
Hi,
PR #1968 was a solution to the problem mentioned in #877. As I see this PR is not merged since February, so I assume it is forgotten. I'm currently trying to generate server stubs and models from the OpenAPI, so the names of the models matter to me. It would be great if we have the option of more concise names for models instead of prefixing the last part of the package name. Thanks.