Skip to content

Commit

Permalink
Add integration guide url to buf plugin config (#2511)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfridman committed Oct 24, 2023
1 parent 90d79c5 commit c29e78d
Show file tree
Hide file tree
Showing 7 changed files with 345 additions and 308 deletions.
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

0 comments on commit c29e78d

Please sign in to comment.