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:
@@ -16,7 +16,6 @@ package provider
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
@@ -37,13 +36,6 @@ func githubRegistration() *Registration {
|
||||
ExtraSettings: []ExtraSetting{
|
||||
{Key: "organization", Label: "Organization", Required: true},
|
||||
},
|
||||
MarshalSettings: func(in *SettingsInput) (json.RawMessage, error) {
|
||||
if in == nil || in.GitHubOrganization == nil || *in.GitHubOrganization == "" {
|
||||
return nil, fmt.Errorf("cannot create github connector: githubOrganization is required")
|
||||
}
|
||||
|
||||
return json.Marshal(&coredata.GitHubConnectorSettings{Organization: *in.GitHubOrganization})
|
||||
},
|
||||
NewDriver: func(_ context.Context, c *http.Client, conn *coredata.Connector, logger *log.Logger) (drivers.Driver, error) {
|
||||
s, err := coredata.ConnectorSettings[coredata.GitHubConnectorSettings](conn)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user