validate

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package validate supplies the amp-yaml-validator library with project-specific data (destinations, provider apps) fetched from the Ampersand API. The library exposes these as dependency-injected "checker" hooks so that the same validation logic can run client-side (here, against the API) or server-side (against the database).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CatalogProvider

type CatalogProvider struct {
	// contains filtered or unexported fields
}

CatalogProvider implements the validator's catalog.CatalogProvider interface using the Ampersand API's live provider catalog (the "dynamic catalog"), which is updated several times a day. Backing validation with this keeps provider, module, and capability checks current instead of relying on the catalog compiled into the connectors library, which goes stale between releases.

It holds a snapshot fetched once so repeated lookups during a single validation run don't re-hit the API. When the fetch fails, callers should fall back to the embedded catalog (catalog.NewDefaultCatalogProvider) so validation still works offline.

func NewCatalogProvider

func NewCatalogProvider(ctx context.Context) (*CatalogProvider, error)

NewCatalogProvider fetches the live provider catalog from the API and returns a provider backed by that snapshot. The catalog endpoint is public, so this works even without a configured project or an active login session.

func (*CatalogProvider) GetModuleInfo

func (c *CatalogProvider) GetModuleInfo(
	ctx context.Context,
	providerName string,
	moduleID string,
) (*providers.ModuleInfo, error)

GetModuleInfo retrieves module information for a given provider and module ID.

func (*CatalogProvider) GetProviderInfo

func (c *CatalogProvider) GetProviderInfo(
	_ context.Context,
	providerName string,
) (*providers.ProviderInfo, error)

GetProviderInfo retrieves provider information from the fetched catalog.

func (*CatalogProvider) GetProviderSupport

func (c *CatalogProvider) GetProviderSupport(
	ctx context.Context,
	providerName string,
) (*providers.Support, error)

GetProviderSupport retrieves the provider's capabilities from the fetched catalog.

func (*CatalogProvider) ListObjects

func (c *CatalogProvider) ListObjects(
	_ context.Context,
	_ string,
	_ string,
) ([]string, error)

ListObjects reports ErrNotSupported: the provider catalog does not expose object schemas, matching the connectors default implementation.

func (*CatalogProvider) Ping

func (c *CatalogProvider) Ping(_ context.Context) error

Ping reports whether the fetched catalog is usable. The validator gates all provider-specific validation (including provider-app checks) on this, so a successfully fetched, non-empty catalog must report healthy.

type DestinationChecker

type DestinationChecker struct {
	// contains filtered or unexported fields
}

DestinationChecker verifies that destinations referenced by a manifest exist in the project. It holds a snapshot of the project's destinations fetched once, so repeated CheckDestination calls during validation don't hit the API again.

func NewDestinationChecker

func NewDestinationChecker(ctx context.Context, client *request.APIClient) (*DestinationChecker, error)

NewDestinationChecker fetches the project's destinations and returns a checker backed by that snapshot.

func (*DestinationChecker) CheckDestination

func (c *DestinationChecker) CheckDestination(_ context.Context, destinationName string) error

CheckDestination reports checker.ErrDestinationNotFound if the named destination is not present in the project, and nil otherwise.

type ProviderAppChecker

type ProviderAppChecker struct {
	// contains filtered or unexported fields
}

ProviderAppChecker verifies that a provider app (OAuth credentials) is configured for the providers referenced by a manifest. Like DestinationChecker it works off a one-time snapshot of the project's provider apps.

func NewProviderAppChecker

func NewProviderAppChecker(ctx context.Context, client *request.APIClient) (*ProviderAppChecker, error)

NewProviderAppChecker fetches the project's provider apps and returns a checker backed by that snapshot.

func (*ProviderAppChecker) CheckProviderApp

func (c *ProviderAppChecker) CheckProviderApp(_ context.Context, providerName string) error

CheckProviderApp reports checker.ErrProviderAppNotFound if no provider app is configured for the given provider, and nil otherwise.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL