client

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package client resolves schemas over HTTP, for the case a service meets an identifier it does not hold.

That case is the rare one by design. A service embeds its schemas and validates without a network call; this is the fallback, and a schema.Guard in front of it fails open when it cannot reach the registry. A service that must reach the registry to validate has taken a runtime dependency on it, which is what a registry should most avoid being.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client resolves schemas from a registry over HTTP. It implements schema.Resolver.

func New

func New(base string, opts ...Option) (*Client, error)

New returns a client against a registry's read surface.

func (*Client) Resolve

func (c *Client) Resolve(ctx context.Context, id urn.Schema) (schema.Schema, error)

Resolve fetches a schema by identifier.

A 404 becomes schema.ErrNotFound so that a caller can tell "the registry says no such schema" from "the registry did not answer" — the first is a fact, the second is an outage, and a guard counts them the same way but an operator should not.

func (*Client) Timeout

func (c *Client) Timeout() time.Duration

Timeout reports the deadline this client applies to a resolution.

Exported so the bound can be asserted. A test that only checks "an unreachable host returns an error" passes with a two-second timeout, a two-hour one, or none at all, which makes the documented bound unasserted exactly where it matters.

type Option

type Option func(*Client)

Option configures a Client.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient supplies the HTTP client to use, for a caller that needs its own transport, TLS configuration or instrumentation.

Jump to

Keyboard shortcuts

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