// deduplicateParameters finds parameters that are shared across multiple endpoints and replace them with // references to the shared parameters in order to avoid repetition. // // deduplicateParameters does not mutate the source. func deduplicateParameters(sp *spec.Swagger) (*spec.Swagger, error) { … } // collectSharedParameters finds parameters that show up for many endpoints. These // are basically all parameters with the exceptions of those where we know they are // endpoint specific, e.g. because they reference the schema of the kind, or have // the kind or resource name in the description. func collectSharedParameters(sp *spec.Swagger) (namesByJSON map[string]string, ret map[string]spec.Parameter, err error) { … } func operations(path *spec.PathItem) []*spec.Operation { … } func base64Hash(s string) string { … } func replaceSharedParameters(sharedParameterNamesByJSON map[string]string, sp *spec.Swagger) (*spec.Swagger, error) { … }