Skip to content

Add file path to file annotations without source code info#2

Open
sergunya wants to merge 1 commit into
datapoint/codegen/basefrom
datapoint/codegen/solution
Open

Add file path to file annotations without source code info#2
sergunya wants to merge 1 commit into
datapoint/codegen/basefrom
datapoint/codegen/solution

Conversation

@sergunya

Copy link
Copy Markdown
Collaborator

This PR adds a back-up file path to responseWriter.AddProtosourceAnnotation,
so that in cases where bufprotosource.Location is nil (e.g. when the input does
not provide source code info), annotations will fallback and use the file path.

Currently, when no source code info is available, we get the following output:

:1:1:RPC "Echo" has the same type "foo.v1.Message" for the request and response.
:1:1:RPC request type "Message" should be named "EchoRequest" or "EchoServiceEchoRequest".
:1:1:RPC response type "Message" should be named "EchoResponse" or "EchoServiceEchoResponse".

With this change, we will get:

foo/v1/foo.proto:1:1:RPC "Echo" has the same type "foo.v1.Message" for the request and response.
foo/v1/foo.proto:1:1:RPC request type "Message" should be named "EchoRequest" or "EchoServiceEchoRequest".
foo/v1/foo.proto:1:1:RPC response type "Message" should be named "EchoResponse" or "EchoServiceEchoResponse".

This is useful, because it allows us to respect ignore and ignore_only
configurations, since we will be able to filter the file annotations using the
file path.

Fixes bufbuild#3715

@sergunya

Copy link
Copy Markdown
Collaborator Author

@dpaia-validator validate

@dpaia-validator

Copy link
Copy Markdown

✅ Datapoint verification passed.

Instance: bufbuild__buf-3736
Duration: 84s
Criteria: compilation: pass, baseline_tests: pass, patch_applied: pass, tests: pass, fail_to_pass: pass, pass_to_pass: pass, fail_to_fail: skipped
Tests: Total: 184, Passed: 184, Failed: 0, Skipped: 0
FAIL_TO_PASS: pass: all fail_to_pass tests fixed

Details: Workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants