Repository navigation
Resolve reference links in every emitted string; scrub plain-text fields - #49
Merged
Merged
Conversation
…fields Comments were emitted raw: reference links were only resolved when referenceLinkTarget was set, never failed the build, and annotation text bypassed both resolution and scrubbing. Comment text also kept the leading space of every `// ` line. - Read comments through protoc-utils' cleaned Comment, which dedents them. - Resolve references with protoc-utils-markdown in every description, summary, and title, from comments and annotations alike, against every file in the request. Elements with no anchor in the document render as code instead of failing. - Add resolveReferenceLinksMode (NONE / WARN / FAIL_ON_INVALID, default FAIL_ON_INVALID) and referenceLink=<label>=<URL> overrides, matching protoc-gen-markdown. - Scrub Markdown from plain-text fields: annotation summaries, titles, and OAuth scope descriptions. - Emit SecurityScheme.description, which was dropped. BREAKING CHANGE: unresolved or ambiguous reference links now fail the run by default; set resolveReferenceLinksMode=WARN to keep the previous behavior. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
andrewtburns
approved these changes
Oct 12, 2026
ezweave
approved these changes
Oct 12, 2026
ezweave
left a comment
There was a problem hiding this comment.
praise: I read through it and it looks good, I'd like to see the output against our protos before we go live.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every string the plugin emits is now classified as CommonMark (
description) or plain text (summary,title, OAuth scope descriptions) and handled consistently, whether it comes from a proto comment or anengine.protoc.openapiannotation.Before:
[Widget],[Service.Method]) were only resolved whenreferenceLinkTargetwas set, which is off by default. Unresolved ones only logged a warning, and the defaultlogLevel=ERRORhid it.//line.Changes
Comment(dedented, Markdown preserved) instead of rawleadingComments.compile/Descriptions.kt(onJsonContext) usesprotoc-utils-markdown(Keep Markdown in cleaned comments; add protoc-utils-markdown for shared reference links protoc-utils#14) to resolve references in every description, summary, and title against every file in the request.referenceLinkTarget.components/schemas, and any schema under Swagger UI.resolveReferenceLinksMode:NONE/WARN/FAIL_ON_INVALID(default).FAIL_ON_INVALIDsetsCodeGeneratorResponse.errorlisting every bad reference.referenceLink=<label>=<URL>(repeatable). A URL without a scheme getshttps://, because protoc reserves:in--openapi_out."quoted".SecurityScheme.descriptionwas dropped and is now emitted.ReferenceLinkResolver.ktis removed;operationIdForandprimaryTagFormoved toDescriptions.kt.Unresolved or ambiguous reference links now fail the run by default. Set
resolveReferenceLinksMode=WARNto keep the previous behavior. This needs a major version bump.Output changes
Golden diffs fall into three groups:
completenow has the security scheme description.CompleteTestnow honorsUPDATE_GOLDENSlike the other suites.Dependencies
Requires protoc-utils 1.1.0 (engine-public/protoc-utils#14) to be released first.
Test plan
./gradlew checkagainst a locally published protoc-utils: all suites pass, with regenerated goldens reviewedreferenceLinkResolutionsuite covers:FAIL_ON_INVALIDaggregate error, with one unresolved and one ambiguous referenceWARNwith REDOC and SWAGGER_UINONE[text][label]withreferenceLinkpublishToMavenLocal[Name]references, no leading-space continuations, no Markdown in plain-text fields, and no dangling anchors.🤖 Generated with Claude Code