Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration guide url to buf plugin config #2511

Merged
merged 4 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ func createCuratedPluginRequest(
SpdxLicenseId: pluginConfig.SPDXLicenseID,
LicenseUrl: pluginConfig.LicenseURL,
Visibility: visibility,
IntegrationGuideUrl: pluginConfig.IntegrationGuideURL,
}, nil
}

Expand Down
24 changes: 14 additions & 10 deletions private/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ type Config struct {
SPDXLicenseID string
// LicenseURL specifies where the plugin's license can be found.
LicenseURL string
// IntegrationGuideURL is an optional attribute used to specify where
// the the plugin integration guide can be found.
IntegrationGuideURL string
}

// RegistryConfig is the configuration for the registry of a plugin.
Expand Down Expand Up @@ -330,16 +333,17 @@ func OptionsSliceToPluginOptions(options []string) map[string]string {
// ExternalConfig represents the on-disk representation
// of the plugin configuration at version v1.
type ExternalConfig struct {
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
PluginVersion string `json:"plugin_version,omitempty" yaml:"plugin_version,omitempty"`
SourceURL string `json:"source_url,omitempty" yaml:"source_url,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Deps []ExternalDependency `json:"deps,omitempty" yaml:"deps,omitempty"`
OutputLanguages []string `json:"output_languages,omitempty" yaml:"output_languages,omitempty"`
Registry ExternalRegistryConfig `json:"registry,omitempty" yaml:"registry,omitempty"`
SPDXLicenseID string `json:"spdx_license_id,omitempty" yaml:"spdx_license_id,omitempty"`
LicenseURL string `json:"license_url,omitempty" yaml:"license_url,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
Name string `json:"name,omitempty" yaml:"name,omitempty"`
PluginVersion string `json:"plugin_version,omitempty" yaml:"plugin_version,omitempty"`
SourceURL string `json:"source_url,omitempty" yaml:"source_url,omitempty"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Deps []ExternalDependency `json:"deps,omitempty" yaml:"deps,omitempty"`
OutputLanguages []string `json:"output_languages,omitempty" yaml:"output_languages,omitempty"`
Registry ExternalRegistryConfig `json:"registry,omitempty" yaml:"registry,omitempty"`
SPDXLicenseID string `json:"spdx_license_id,omitempty" yaml:"spdx_license_id,omitempty"`
LicenseURL string `json:"license_url,omitempty" yaml:"license_url,omitempty"`
IntegrationGuideURL string `json:"integration_guide_url,omitempty" yaml:"integration_guide_url,omitempty"`
}

// ExternalDependency represents a dependency on another plugin.
Expand Down
10 changes: 6 additions & 4 deletions private/bufpkg/bufplugin/bufpluginconfig/bufpluginconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ func TestGetConfigForBucket(t *testing.T) {
"separate_package": "true",
},
},
SPDXLicenseID: "Apache-2.0",
LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE",
SPDXLicenseID: "Apache-2.0",
LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE",
IntegrationGuideURL: "https://grpc.io/docs/languages/go/quickstart",
},
pluginConfig,
)
Expand Down Expand Up @@ -105,8 +106,9 @@ func TestParsePluginConfigGoYAML(t *testing.T) {
"separate_package": "true",
},
},
SPDXLicenseID: "Apache-2.0",
LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE",
SPDXLicenseID: "Apache-2.0",
LicenseURL: "https://github.com/grpc/grpc-go/blob/master/LICENSE",
IntegrationGuideURL: "https://grpc.io/docs/languages/go/quickstart",
},
pluginConfig,
)
Expand Down
19 changes: 10 additions & 9 deletions private/bufpkg/bufplugin/bufpluginconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ func newConfig(externalConfig ExternalConfig, options []ConfigOption) (*Config,
}
}
return &Config{
Name: pluginIdentity,
PluginVersion: pluginVersion,
Dependencies: dependencies,
Registry: registryConfig,
SourceURL: externalConfig.SourceURL,
Description: externalConfig.Description,
OutputLanguages: externalConfig.OutputLanguages,
SPDXLicenseID: spdxLicenseID,
LicenseURL: externalConfig.LicenseURL,
Name: pluginIdentity,
PluginVersion: pluginVersion,
Dependencies: dependencies,
Registry: registryConfig,
SourceURL: externalConfig.SourceURL,
Description: externalConfig.Description,
OutputLanguages: externalConfig.OutputLanguages,
SPDXLicenseID: spdxLicenseID,
LicenseURL: externalConfig.LicenseURL,
IntegrationGuideURL: externalConfig.IntegrationGuideURL,
}, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ registry:
- separate_package=true
spdx_license_id: Apache-2.0
license_url: https://github.com/grpc/grpc-go/blob/master/LICENSE
integration_guide_url: https://grpc.io/docs/languages/go/quickstart
Loading