Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/v0.36.2/no-external-links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/solo-projects/issues/6768
resolvesIssue: false
description: >-
Update protobuf processing to no longer render links to locally hosted external API docs, as they are being removed.
9 changes: 8 additions & 1 deletion pkg/code-generator/docgen/funcs/template_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,15 @@ func linkForField(project *model.Project, docsOptions *options.DocsOptions) func
linkedFile = filepath.Base(file.GetName())
//return "", errors.Errorf("failed to get generated file path for proto %v in list %v", file.GetName(), project.Request.FileToGenerate)
}
linkedFile = relativeFilename(forFile.GetName(), linkedFile)

// Skip links for packages that are configured to be skipped
for _, pkg := range docsOptions.RenderOptions.GetSkipLinksForPackages() {
if strings.HasPrefix(linkedFile, pkg) {
return typeName, nil
}
}

linkedFile = relativeFilename(forFile.GetName(), linkedFile)
if docsOptions.Output == options.Restructured {
linkText = ":ref:`message." + strings.TrimPrefix(field.GetTypeName(), ".") + "`"
} else {
Expand Down
17 changes: 15 additions & 2 deletions pkg/code-generator/docgen/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,21 @@ type HugoOptions struct {
}

type DocsOptions struct {
Output DocsOutput
HugoOptions *HugoOptions
Output DocsOutput
HugoOptions *HugoOptions
RenderOptions *RenderOptions
}

// RenderOptions provides options for rendering documentation
type RenderOptions struct {
SkipLinksForPackages []string // when rendering markdown, do not attempt to link to these packages or their subpackages
}

func (o *RenderOptions) GetSkipLinksForPackages() []string {
if o == nil {
return nil
}
return o.SkipLinksForPackages
}

const (
Expand Down