Skip to content

OpenAPIv3Generator does not remove multiline linter comments from generated yaml. #462

@flowchartsman

Description

@flowchartsman

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions