Skip to content

protoc-gen-openapi,protoc-gen-jsonschema: strip multiline linter comments#474

Open
alliasgher wants to merge 1 commit intogoogle:mainfrom
alliasgher:fix-multiline-linter-comment
Open

protoc-gen-openapi,protoc-gen-jsonschema: strip multiline linter comments#474
alliasgher wants to merge 1 commit intogoogle:mainfrom
alliasgher:fix-multiline-linter-comment

Conversation

@alliasgher
Copy link
Copy Markdown

Fixes #462. The regex \(-- .* --\) used for stripping AIP-200 linter comments didn't match across newlines. Added (?s) flag to both generators so multiline comments like (-- ... --) spanning several lines are correctly removed.

…ents

The regex `\(-- .* --\)` used to remove proto linter comments
(delimited by `(--` and `--)`) did not match comments that span
multiple lines because `.` does not match newlines by default.
Multiline comments required by AIP-200 were therefore leaked into
the generated OpenAPI/JSON Schema output.

Add the `(?s)` flag so `.` matches any character including newlines.

Fixes google#462

Signed-off-by: alliasgher <alliasgher123@gmail.com>
@alliasgher alliasgher requested a review from a team as a code owner April 14, 2026 09:23
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.

OpenAPIv3Generator does not remove multiline linter comments from generated yaml.

1 participant