OpenAPIv3Generator does not remove multiline linter comments from generated yaml.

Open Beginner friendly
#462 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
tooling

Research direction

Start with OpenAPIv3Generator.linterRulePattern and reproduce the multiline proto comment shown in the issue. Check the generated YAML for the example and confirm that the complete multiline linter comment is removed while other linter patterns remain handled.

Written by the indexing model from the issue text.

Description

Multiline linter comments in the proto (those delimited with (-- and --)) are not correctly removed from generated yaml.

As a canonical example of why this is necessary, consider AIP-200, which states:

If an API violates the AIP standards for any reason, there must be an internal comment linking to (aip.dev/not-precedent) to ensure others do not copy the violations or cite the errors as precedent of a "previously approved API".
The comment should also include an explanation of what violates standards and why it is necessary.

The example given of how to format this comment is:

message DailyMaintenanceWindow {
  // Time within the maintenance window to start the maintenance operations.
  // It must use the format "HH MM", where HH : [00-23] and MM : [00-59] GMT.
  // (-- aip.dev/not-precedent: This was designed for consistency with crontab,
  //     and preceded the AIP standards.
  //     Ordinarily, this type should be `google.type.TimeOfDay`. --)

Which can be combined with other linter patterns.

Note that this comment is split over multiple lines.

Since these comments are required to follow AIP standards, OpenAPIv3Generator should support removing them as well, but it cannot since OpenAPIv3Generator.linterRulePattern is set to \(-- .* --\), which will not account for newlines.

Dominant language
Go
Stars
2.3k
Forks
279
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/gnostic

All issues in google/gnostic

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.