servicecatalog

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package servicecatalog defines Forge's browse-only, declared RPC/code inventory. It contains no endpoint values, credentials, invocation handles or runtime health.

Index

Constants

View Source
const (
	Schema        = "forge.dev/service-catalog/v1"
	GeneratedPath = "gen/forge_service_catalog.json"
	BundlePath    = "forge/service-catalog.json"
)

Variables

This section is empty.

Functions

func MethodID

func MethodID(scope, owner, method string) string

MethodID is a stable low-cardinality symbol identity. Signature, source line, build, instance and arguments deliberately do not enter the identity.

func MethodIdentity

func MethodIdentity(scope, owner, namespace, method string) (id, legacyName string)

MethodIdentity is the join metadata shared by the catalog and generated decorators. Owner is the exposed interface/receiver whose method set is being decorated, NOT the receiver declaring an inherited/embedded method. Namespace is the actual instrumentation namespace (normally the Go package clause), not an import-path basename. Neither signature nor declaration location enters ID.

func NewClient

func NewClient[T any](binding ClientBinding, constructor func(connect.HTTPClient, string, ...connect.ClientOption) T, httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) T

NewClient calls the original generated Connect constructor without changing its HTTPClient, resolved baseURL or option order. T remains its generated client interface. Declare this call directly in a composition provider so forge generate can inventory it. Dynamic metadata is explicitly unresolved.

Types

type Binding

type Binding struct {
	Consumer   string       `json:"consumer"`
	Field      string       `json:"field"`
	Interface  string       `json:"interface"`
	Methods    []CodeMethod `json:"methods"`
	Candidates []string     `json:"candidates"` // assignable producers, NOT selected bindings
	Providers  []string     `json:"providers"`  // accessors in this field's composition expression
	Resolution string       `json:"resolution"` // composition_expression or unresolved
}

type Catalog

type Catalog struct {
	Schema      string       `json:"schema"`
	Module      string       `json:"module"`
	Processes   []Process    `json:"processes"`
	Services    []Service    `json:"services"`
	Components  []Component  `json:"components"`
	Bindings    []Binding    `json:"bindings"`
	Clients     []Client     `json:"clients"`
	Diagnostics []Diagnostic `json:"diagnostics"`
}

Catalog is generated from the same typed composition model and wire descriptor as the application. Missing evidence is explicit; none of these edges proves a call.

func Decode

func Decode(raw []byte) (Catalog, error)

Decode validates catalog bytes before a browser/hosted ingest consumes them. It has no size bound of its own: a catalog grows with the project it describes, and the bytes are already in memory, so the bound belongs to the reader that fetched them (a bundle layer's total, a registry blob read). It authenticates no provenance: callers must verify the containing OCI bundle digest and apply their existing project/environment authorization.

type Client

type Client struct {
	ID          string `json:"id"`
	Provider    string `json:"provider"`
	Service     string `json:"service"`
	ConfigField string `json:"config_field"` // existing fully-qualified proto config field, NOT its value
	Constructor string `json:"constructor"`
	Source      Source `json:"source"`
	Resolution  string `json:"resolution"` // declared; no target URL inference
}

type ClientBinding

type ClientBinding struct {
	Service     string
	ConfigField string
}

ClientBinding describes the existing endpoint's config FIELD, not its value. Service is a fully-qualified protobuf service (use the generated service name constant); ConfigField is e.g. "shop.config.v1.API.orders_url". This metadata grants no authority and changes no HTTP, auth, tracing or retry behavior.

type CodeMethod

type CodeMethod struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Signature  string `json:"signature"`   // Go types qualified by import path
	Scope      string `json:"scope"`       // legacy instrumentation scope
	LegacyName string `json:"legacy_name"` // legacy pkg.Method span name
	Source     Source `json:"source"`
}

type Component

type Component struct {
	ID      string       `json:"id"`
	Name    string       `json:"name"`
	Kind    string       `json:"kind"`
	Type    string       `json:"type"`
	Source  Source       `json:"source"`
	Methods []CodeMethod `json:"methods"`
	// ImplementationCandidates are assignable concrete types in the component's
	// package. They are not proof of which implementation a constructor returns.
	ImplementationCandidates []Implementation `json:"implementation_candidates"`
}

type Diagnostic

type Diagnostic struct {
	Code      string `json:"code"`
	Component string `json:"component,omitempty"`
	Source    Source `json:"source"`
}

type Implementation

type Implementation struct {
	Type    string       `json:"type"`
	Source  Source       `json:"source"`
	Methods []CodeMethod `json:"methods"`
}

type Method

type Method struct {
	ID              string `json:"id"` // full proto service + "/" + method
	Name            string `json:"name"`
	Input           string `json:"input"`
	Output          string `json:"output"`
	ClientStreaming bool   `json:"client_streaming"`
	ServerStreaming bool   `json:"server_streaming"`
	Idempotency     string `json:"idempotency"` // UNKNOWN, IDEMPOTENT, NO_SIDE_EFFECTS
	AuthRequired    bool   `json:"auth_required"`
}

type Process

type Process struct {
	ID         string   `json:"id"`
	Root       string   `json:"root"`
	Command    []string `json:"command"`
	Components []string `json:"components"`
	Serves     []Serve  `json:"serves"`
	Clients    []string `json:"clients"` // registrations reachable by this root: can-call only
	Source     Source   `json:"source"`
}

type Serve

type Serve struct {
	Component  string `json:"component"` // handler component; method names join to Component.Methods
	Service    string `json:"service"`   // fully-qualified protobuf service
	RouteSet   string `json:"route_set"`
	Audience   string `json:"audience"`
	Resolution string `json:"resolution"` // declared_route_set; not runtime observation
}

type Service

type Service struct {
	Name      string   `json:"name"`
	ProtoFile string   `json:"proto_file"`
	Methods   []Method `json:"methods"`
	// Descriptor is the existing forge_descriptor.json ServiceDef, unchanged:
	// Schemas, SchemaFiles, Enums and field validate/validate_options are the
	// authoritative schema graph. Do not invent a second validation dialect.
	Descriptor json.RawMessage `json:"descriptor"`
}

type Source

type Source struct {
	Path string `json:"path"` // module-relative, never absolute
	Line int    `json:"line"`
}

Jump to

Keyboard shortcuts

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