Refine connector provider registry per review

Three follow-ups from review of the registry consolidation:

- Build Vercel's authorization URL with net/url instead of a
  hand-rolled "{integration_slug}" placeholder resolved by
  strings.ReplaceAll. The slug is escaped via url.PathEscape in a
  per-provider Registration.BuildAuthURL closure, and the unused
  AuthURLParams plumbing on Registration and OAuth2Connector is
  removed (OAuth2Connector now carries a typed IntegrationSlug).

- Drop the SettingsInput union type and the per-provider
  MarshalSettings closures. The create resolvers now build the typed
  coredata.*ConnectorSettings directly from the gqlgen input, the
  same way the OAuth callback path already does, so there is no
  shared catch-all DTO and no stringly-typed boundary.

- Restore ConnectorProviders() to a plain ordered slice literal; the
  intermediate map + slices.Sort added nondeterminism and a sort for
  no benefit.

Signed-off-by: Aurélien Sibiril <81782+aureliensibiril@users.noreply.github.com>
This commit is contained in:
Aurélien Sibiril
2026-05-26 15:15:43 +02:00
parent e18ecdda8b
commit a5259fc978
16 changed files with 220 additions and 226 deletions

View File

@@ -35,11 +35,10 @@ type ConnectorConfig struct {
type ConnectorConfigOAuth2 struct {
ClientID string `json:"client-id"`
ClientSecret string `json:"client-secret"`
// IntegrationSlug is an operator-supplied value substituted into
// providers whose static AuthURL contains a "{integration_slug}"
// placeholder (Vercel-style integrations). It is propagated onto
// OAuth2Connector.AuthURLParams and resolved by
// (*provider.Registry).ApplyOAuth2Defaults.
// IntegrationSlug is an operator-supplied value used by providers
// whose authorization URL embeds it as a path segment (Vercel-style
// integrations). It is propagated onto OAuth2Connector.IntegrationSlug
// and resolved by (*provider.Registry).ApplyOAuth2Defaults.
IntegrationSlug string `json:"integration-slug,omitempty"`
}
@@ -97,11 +96,7 @@ func (c *ConnectorConfig) UnmarshalJSON(data []byte) error {
ClientSecret: config.ClientSecret,
}
if config.IntegrationSlug != "" {
oauth2Connector.AuthURLParams = map[string]string{
"integration_slug": config.IntegrationSlug,
}
}
oauth2Connector.IntegrationSlug = config.IntegrationSlug
c.Config = &oauth2Connector
default: