native

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 33 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package native validates and retains ordinary and Refined native schema documents. It is deliberately offline: ingestion never reads a referenced file or URL.

Index

Constants

View Source
const DefaultLowerGenericSpecializations = 512
View Source
const DefaultNumericExpansion = 65536
View Source
const DefaultOpenAPIBytes = 1024 * 1024
View Source
const DefaultOpenAPIDepth = 128
View Source
const DefaultOpenAPINodes = 100000
View Source
const DefaultOpenAPIParts = 1024
View Source
const ExampleCatalogVersion = "refine.examples/v1"
View Source
const MaxEmbeddedExampleBytes = 64 << 10
View Source
const MaxEmbeddedExamples = 64
View Source
const MaxEmbeddedExamplesBytes = 1 << 20
View Source
const MaxNumericExpansion = 1000000
View Source
const MaximumLowerGenericSpecializations = 4096

Variables

This section is empty.

Functions

func AppendBundleReleasePolicy

func AppendBundleReleasePolicy(input []byte, policy *language.ReleasePolicy) ([]byte, error)

AppendBundleReleasePolicy is a pure byte operation. Its comma/member suffix is owned by the carrier, so ReleaseComparisonBundle returns input exactly.

func OpenAPIContractExplanation

func OpenAPIContractExplanation(program *language.Program, metadata WireMetadata) (string, error)

OpenAPIContractExplanation describes explicitly authored operation bindings and every checked declaration they may reference. The native schema does not by itself enforce these cross-request rules.

func ReleaseComparisonBundle

func ReleaseComparisonBundle(input []byte) ([]byte, *language.ReleasePolicy, error)

ReleaseComparisonBundle returns the exact bundle bytes with only the final releasePolicy member and its owned comma removed. Every other byte remains comparison identity. A policy member in any other position is rejected.

func SchemaEntrypoints

func SchemaEntrypoints(root string, metadata WireMetadata) []string

SchemaEntrypoints returns the selected payload root together with every explicitly bound OpenAPI request, response and context type. The result is sorted and duplicate-free so proof scope is independent of metadata order.

Types

type Annotation

type Annotation struct {
	Pointer     string
	Source      string
	Root        string
	Formatted   string
	Metadata    WireMetadata
	HasMetadata bool
}

Annotation is a checked x-refine extension. Source is either a complete language module, or the source member of {source,root}. Root, when present, is checked as a closed payload type in that module.

type AuthorOpenAPIOptions

type AuthorOpenAPIOptions struct {
	EntryResource string
	Metadata      WireMetadata
}

AuthorOpenAPIOptions supplies non-operation wire policy and the stable URI of the generated OpenAPI resource. OpenAPI operation metadata is always derived from the checked source declaration and cannot be supplied twice.

type AvroDefaultCheck

type AvroDefaultCheck struct {
	Resource string `json:"resource"`
	Pointer  string `json:"pointer"`
	State    string `json:"state"`
	Code     string `json:"code"`
	Message  string `json:"message"`
}

AvroDefaultCheck records what compilation established about one reachable reader default after decoding it through the checked language field type. Invalid defaults reject compilation and therefore never appear here. Indeterminate means refinement evaluation exhausted its deterministic budget.

type AvroPayloadLimits

type AvroPayloadLimits struct {
	Bytes       int
	Depth       int
	Values      int
	StringBytes int
}

AvroPayloadLimits bound native Avro binary validation. Zero selects the documented defaults. Values counts schema values, including record fields and collection elements; it is independent of refinement evaluation steps.

type CheckedExample

type CheckedExample struct {
	Name            string
	Target          string
	Value           value.Data
	Expected        ExampleExpectation
	DiagnosticCodes []string
	NativeExpected  NativeExampleExpectation
}

CheckedExample is the structure-checked, immutable adapter-neutral form. NativeExpected remains an authored assertion: only a configured generated native wire adapter can execute it.

func CheckExamples

func CheckExamples(program *language.Program, catalog *ExampleCatalog) ([]CheckedExample, error)

CheckExamples validates bounded canonical typed values and their Refine outcomes. It deliberately does not claim native validity: NativeExpected is retained for a generated JSON/Avro adapter to execute later.

type Discriminator

type Discriminator struct {
	Field  string
	Values map[string]string
	// Arguments gives the ordered JSON member name for each positional
	// constructor argument. Every constructor must have an entry.
	Arguments map[string][]string
}

type Document

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

Document retains the exact caller bytes. Parsed oracle models are not exposed: doing so would make an apparently immutable imported contract mutable.

func Parse

func Parse(format Format, input []byte, options Options) (*Document, error)

func ParseAvro

func ParseAvro(input []byte, options Options) (*Document, error)

func ParseJSONSchema

func ParseJSONSchema(input []byte, options Options) (document *Document, failure error)

func ParseOpenAPI

func ParseOpenAPI(input []byte, options Options) (document *Document, failure error)

func (*Document) Annotations

func (d *Document) Annotations() []Annotation

func (*Document) AuditSource

func (d *Document) AuditSource(source string) ([]provenance.Finding, error)

func (*Document) ConstraintSource

func (d *Document) ConstraintSource() string

func (*Document) Constraints

func (d *Document) Constraints() []provenance.Constraint

Constraints returns the exact per-keyword correspondences discovered by the shared provenance package. Other formats currently return an empty slice, never invented correspondences.

func (*Document) ExportOriginal

func (d *Document) ExportOriginal() []byte

func (*Document) Format

func (d *Document) Format() Format

func (*Document) Original

func (d *Document) Original() string

func (*Document) RecoverNative

func (d *Document) RecoverNative(name, source string) (string, error)

func (*Document) Version

func (d *Document) Version() string

type EncodingKind

type EncodingKind string
const (
	JSONNumber       EncodingKind = "json-number"
	DecimalString    EncodingKind = "decimal-string"
	RationalRecord   EncodingKind = "rational-record"
	AvroBytesDecimal EncodingKind = "avro-bytes-decimal"
	TimestampString  EncodingKind = "timestamp-string"
)

type Enforcement

type Enforcement struct {
	Supported bool
	Reason    string
}

type Error

type Error struct {
	Code    string
	Format  Format
	Pointer string
	Message string
	Cause   error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ExampleCase

type ExampleCase struct {
	Name            string                   `json:"name"`
	Target          string                   `json:"target"`
	Value           string                   `json:"value"`
	Expected        ExampleExpectation       `json:"expected,omitempty"`
	DiagnosticCodes []string                 `json:"diagnosticCodes,omitempty"`
	NativeExpected  NativeExampleExpectation `json:"nativeExpected,omitempty"`
}

type ExampleCatalog

type ExampleCatalog struct {
	Version string        `json:"version"`
	Cases   []ExampleCase `json:"cases"`
}

ExampleCatalog contains canonical Refine values, never untyped native JSON. Omitted expectations normalize to valid. Case order is stable metadata and therefore participates in bundle and release identity.

type ExampleExpectation

type ExampleExpectation string
const (
	ExpectedValid   ExampleExpectation = "valid"
	ExpectedInvalid ExampleExpectation = "invalid"
)

type Export

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

func LowerPayload

func LowerPayload(format Format, payload *language.PayloadType, options LowerOptions) (*Export, error)

LowerPayload lowers one immutable checked payload type. It validates the generated native document through Parse before returning it.

func LowerPayloadWithMetadata

func LowerPayloadWithMetadata(format Format, payload *language.PayloadType, metadata WireMetadata, options LowerOptions) (*Export, error)

LowerPayloadWithMetadata applies checked, explicit wire encodings. Metadata never weakens the source type; codecs must reject values outside the chosen lossless representation.

func (*Export) Bytes

func (e *Export) Bytes() []byte

func (*Export) CompanionMarkdown

func (e *Export) CompanionMarkdown() string

func (*Export) Format

func (e *Export) Format() Format

func (*Export) Losses

func (e *Export) Losses() []Loss

func (*Export) String

func (e *Export) String() string

func (*Export) Version

func (e *Export) Version() string

type ExportMode

type ExportMode string
const (
	Ordinary ExportMode = "ordinary"
	Refined  ExportMode = "refined"
)

type ExtraFieldMode

type ExtraFieldMode string
const (
	DiscardExtraFields  ExtraFieldMode = "discard"
	PreserveExtraFields ExtraFieldMode = "preserve"
	RejectExtraFields   ExtraFieldMode = "reject"
)

type Format

type Format string
const (
	JSONSchema Format = "json-schema"
	Avro       Format = "avro"
	OpenAPI    Format = "openapi"
)

type Loss

type Loss struct {
	Owner       string
	Location    string
	Predicate   string
	Explanation string
}

type LowerOptions

type LowerOptions struct {
	Mode           ExportMode
	OpenAPIVersion string
	// AllowDocumentedLoss is required before an ordinary export may replace a
	// checked rule with embedded and companion English. The returned Losses
	// enumerate every such rule. Wire-unrepresentable base types always error.
	AllowDocumentedLoss bool
	// MaxGenericSpecializations bounds distinct closed generic applications.
	// Zero selects DefaultLowerGenericSpecializations; values above the hard
	// package maximum are rejected before lowering.
	MaxGenericSpecializations int
	// contains filtered or unexported fields
}

type NativeExampleExpectation

type NativeExampleExpectation string
const (
	NativeExpectedValid   NativeExampleExpectation = "valid"
	NativeExpectedInvalid NativeExampleExpectation = "invalid"
)

type OpenAPIDerivationOptions

type OpenAPIDerivationOptions struct{ OperationIDs []string }

OpenAPIDerivationOptions selects operations for automatic checked wrapper derivation. An empty selection means every operation under paths and requires each of them to have an operationId. A nonempty selection is an explicit subset and leaves all other document operations unbound.

type OpenAPIDirection

type OpenAPIDirection string

OpenAPIDirection fixes the operation side for direction-dependent OpenAPI Schema Object semantics. Runtime callers never choose this value: checked operation bindings select it before their validators are compiled.

const OpenAPIRequest OpenAPIDirection = "request"
const OpenAPIResponse OpenAPIDirection = "response"

type OpenAPIHeaderJSON

type OpenAPIHeaderJSON struct {
	Name  string
	Value []byte
}

type OpenAPILimits

type OpenAPILimits struct {
	Bytes int
	Depth int
	Nodes int
	Parts int
}

type OpenAPIMediaJSON

type OpenAPIMediaJSON struct {
	MediaType string
	Value     []byte
}

type OpenAPIOperation

type OpenAPIOperation struct {
	OperationID  string
	Method       string
	Path         string
	RequestType  string
	RequestParts []OpenAPISchemaTarget
	Responses    []OpenAPIResponseOperation
}

type OpenAPIOperationCatalog

type OpenAPIOperationCatalog struct {
	Version    string
	Resources  []Resource
	Operations []OpenAPIOperation
}

type OpenAPIOperationIngestOptions

type OpenAPIOperationIngestOptions struct {
	EntryResource string
	OperationIDs  []string
	Metadata      WireMetadata
}

OpenAPIOperationIngestOptions identifies an OpenAPI entry document and an optional deterministic operation subset. Metadata may provide a complete authoritative native operation binding instead of requesting derivation.

type OpenAPIParameterJSON

type OpenAPIParameterJSON struct {
	In    string
	Name  string
	Value []byte
}

These inputs are semantic JSON values. The caller, not this package, is responsible for parsing HTTP paths, queries, cookies, and header syntax into the named values. Unsupported OpenAPI serialization styles are rejected when the operation catalog is compiled; no HTTP decoding is guessed at runtime.

type OpenAPIRequestJSON

type OpenAPIRequestJSON struct {
	Parameters []OpenAPIParameterJSON
	Headers    []OpenAPIHeaderJSON
	Body       *OpenAPIMediaJSON
}

type OpenAPIResponseJSON

type OpenAPIResponseJSON struct {
	Status  string
	Headers []OpenAPIHeaderJSON
	Body    *OpenAPIMediaJSON
}

type OpenAPIResponseOperation

type OpenAPIResponseOperation struct {
	Status         string
	TypeExpression string
	ContextType    string
	Parts          []OpenAPISchemaTarget
}

type OpenAPISchemaTarget

type OpenAPISchemaTarget struct {
	ID             string
	Resource       string
	Pointer        string
	TypeExpression string
	FieldPath      []string
	Required       bool
	MediaType      string
	In             string
	Name           string
	Status         string
}

OpenAPISchemaTarget is an immutable, compile-time-proven Schema Object location. Runtime callers select stable part IDs; they never supply pointers.

type OpenAPIValidationView

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

OpenAPIValidationView is a read-only, validation-only projection of checked OpenAPI 3.1/3.2 Schema Objects. It is not an OpenAPI document view and must not be used to validate wrapper structure, operations, examples, or other non-schema OpenAPI members.

func NewOpenAPIValidationView

func NewOpenAPIValidationView(canonical []Resource, entry string) (*OpenAPIValidationView, error)

NewOpenAPIValidationView builds the same bounded logical Schema Object catalog and oracle view used by native validation. canonical must be the already checked canonical JSON resource closure, and entry must identify its OpenAPI document. The caller retains ownership of both inputs.

func (*OpenAPIValidationView) Resources

func (v *OpenAPIValidationView) Resources() []Resource

Resources returns defensive copies of the physical validation containers followed by their logical-ID aliases. The combined result is an offline loader inventory; runtimes must not eagerly register aliases in a way that duplicates nested $id resources already present in physical containers.

func (*OpenAPIValidationView) RewriteGeneratedResource

func (v *OpenAPIValidationView) RewriteGeneratedResource(resource Resource) (Resource, error)

RewriteGeneratedResource rewrites static absolute Schema Object references in one trusted generated operation wrapper. It rejects resource collisions, schema-position $id and $dynamicRef, and references outside the checked catalog. Instance-valued members such as examples and defaults remain data.

func (*OpenAPIValidationView) Selector

Selector maps an indexed physical OpenAPI Schema Object selector into the validation view while preserving the caller's checked type name.

type Options

type Options struct{ Limits schemajson.Limits }

Limits bound syntax ingestion. Zero selects schemajson's documented default.

type Project

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

Project couples editable checked language source to an immutable native sidecar. The sidecar remains authoritative for constraints not represented by the language projection.

func AuthorOpenAPIProject

func AuthorOpenAPIProject(program *language.Program, options AuthorOpenAPIOptions) (*Project, error)

AuthorOpenAPIProject lowers a checked standalone OpenAPI declaration into a rootless native project. The generated document contains no synthetic payload root. Its top-level x-refine annotation retains the exact checked source and authoritative operation bindings for subsequent bundle/export and generated-runtime composition.

func IngestOpenAPIOperationResources

func IngestOpenAPIOperationResources(resources []Resource, options OpenAPIOperationIngestOptions) (*Project, error)

IngestOpenAPIOperationResources validates references only against the supplied immutable resource set. EntryResource selects the OpenAPI document; every resource URI and byte string is retained in caller order.

func IngestOpenAPIOperations

func IngestOpenAPIOperations(input []byte, options OpenAPIOperationIngestOptions) (*Project, error)

IngestOpenAPIOperations ingests an operations-only OpenAPI document. It does not add a components object, synthetic Schema Object, or payload root.

func IngestProject

func IngestProject(format Format, input []byte, options ProjectOptions) (*Project, error)

func IngestProjectResources

func IngestProjectResources(format Format, resources []Resource, options ProjectOptions) (*Project, error)

IngestProjectResources validates references using only the explicitly supplied, ordered resource set. It never falls back to filesystem or network.

func ParseBundle

func ParseBundle(input []byte) (*Project, error)

func (*Project) AuditResourceSource

func (p *Project) AuditResourceSource(resource, source string) ([]provenance.Finding, error)

func (*Project) AvroDefaultChecks

func (p *Project) AvroDefaultChecks() []AvroDefaultCheck

func (*Project) Bundle

func (p *Project) Bundle() ([]byte, error)

Bundle returns one self-contained JSON distribution. Native resources remain byte-for-byte strings and retain their URI identities for offline resolution.

func (*Project) CanonicalJSONResources

func (p *Project) CanonicalJSONResources() ([]Resource, error)

CanonicalJSONResources returns an immutable snapshot of the exact JSON resources used by JSON payload validators. OpenAPI YAML is converted without passing numeric values through float64. The method rejects formats and dialects for which exact JSON Schema validation is unavailable.

func (*Project) DecodeAndValidateAvro

func (p *Project) DecodeAndValidateAvro(input []byte, payloadLimits AvroPayloadLimits, refinementLimits validation.Limits) (value.Data, validation.Report, error)

DecodeAndValidateAvro is the complete Go Avro boundary for a native project. It first enforces the exact writer schema and bounded binary framing, decodes the datum into the checked language payload without floating-point rounding, and finally evaluates the editable refinements. Native-only ValidateAvroBinary deliberately continues to accept Avro NaN and infinities; this refined boundary rejects them because value.Data numbers are finite exact rationals.

func (*Project) DecodeAndValidateAvroJSON

func (p *Project) DecodeAndValidateAvroJSON(input []byte, payloadLimits AvroPayloadLimits, refinementLimits validation.Limits) (value.Data, validation.Report, error)

DecodeAndValidateAvroJSON composes strict Avro JSON framing, the native writer schema, exact binary-to-Data decoding, and the selected Refine predicates. Reader-schema resolution is provided by generated Java adapters; this API intentionally takes one writer project and never guesses a reader schema.

func (*Project) DecodeAndValidateJSON

func (p *Project) DecodeAndValidateJSON(input []byte, limits validation.Limits) (value.Data, validation.Report, error)

DecodeAndValidateJSON is the complete Go JSON boundary for a native project. It first enforces the immutable native schema, then decodes the checked wire representation without float64 coercion, and finally evaluates the editable language refinements. Native/wire failures are errors; a language violation or resource exhaustion is represented by the returned three-state Report.

func (*Project) DecodeAndValidateOpenAPIRequest

func (p *Project) DecodeAndValidateOpenAPIRequest(operationID string, input OpenAPIRequestJSON, limits OpenAPILimits, refineLimits validation.Limits) (*ValidatedOpenAPIRequest, validation.Report, error)

DecodeAndValidateOpenAPIRequest enforces every bound native Schema Object, decodes the checked request record, then evaluates its Refine contract.

func (*Project) DecodeAndValidateOpenAPIResponse

func (p *Project) DecodeAndValidateOpenAPIResponse(operationID string, input OpenAPIResponseJSON, original *ValidatedOpenAPIRequest, limits OpenAPILimits, refineLimits validation.Limits) (value.Data, validation.Report, error)

DecodeAndValidateOpenAPIResponse applies exact/class/default selection, native response schemas, and the checked response or context contract. A context-bound response requires the unmodified token returned for this exact project instance and operation.

func (*Project) EditableSource

func (p *Project) EditableSource() string

func (*Project) EffectiveResources

func (p *Project) EffectiveResources() ([]Resource, error)

EffectiveResources returns the immutable, validated resource view consumed by native runtimes, export and generated adapters. Resources() deliberately remains the exact ingested baseline for recovery and bundle identity.

func (*Project) EntryResource

func (p *Project) EntryResource() string

func (*Project) Export

func (p *Project) Export(options LowerOptions) (*ProjectExport, error)

Export emits the project's effective same-format resource set. Refined mode embeds checked source; ordinary mode requires explicit documented-loss permission for rules that the native format cannot enforce. Cross-format conversion remains the separate LowerPayload API and never consumes opaque project constraints.

func (*Project) Format

func (p *Project) Format() Format

func (*Project) GeneratedEnforcement

func (p *Project) GeneratedEnforcement() Enforcement

GeneratedEnforcement is deliberately conservative. Generated language-only validators do not yet execute the opaque native sidecar.

func (*Project) HasOpenAPINativeBindings

func (p *Project) HasOpenAPINativeBindings() bool

func (*Project) HasPayloadRoot

func (p *Project) HasPayloadRoot() bool

func (*Project) JSONSchemaKeywordLocations

func (p *Project) JSONSchemaKeywordLocations(keywords ...string) ([]string, error)

JSONSchemaKeywordLocations returns keyword locations only from actual Schema Objects reachable from the selected root (or complete JSON Schema resources). Object members in examples/defaults are never reinterpreted as keywords.

func (*Project) JSONSchemaResourceAliases

func (p *Project) JSONSchemaResourceAliases() ([]Resource, error)

JSONSchemaResourceAliases returns deterministic, checked in-memory loader entries for canonical $id resource roots that differ from their physical resource URI. Resources() and CanonicalJSONResources() retain their existing physical identities; this additional inventory is only for offline runtimes that must resolve the same logical IDs as the checked project.

func (*Project) Kind

func (p *Project) Kind() ProjectKind

func (*Project) LanguageEntry

func (p *Project) LanguageEntry() string

func (*Project) LanguageFiles

func (p *Project) LanguageFiles() []language.SourceFile

func (*Project) Metadata

func (p *Project) Metadata() WireMetadata

func (*Project) NativeConstraintSources

func (p *Project) NativeConstraintSources() []Resource

NativeConstraintSources returns the independently editable, resource-scoped canonical constraint units. Unlike EditableSource, every resource is represented and colliding generated declaration names never share a module.

func (*Project) NativeConstraints

func (p *Project) NativeConstraints() []ResourceConstraint

func (*Project) NativeDocument

func (p *Project) NativeDocument() *Document

func (*Project) OpenAPIOperationIndex

func (p *Project) OpenAPIOperationIndex() (OpenAPIOperationCatalog, error)

OpenAPIOperationIndex returns the checked operation-to-schema catalog plus the exact canonical, offline resource closure used by native validators.

func (*Project) OpenAPIValidationResources

func (p *Project) OpenAPIValidationResources(direction OpenAPIDirection) ([]Resource, error)

OpenAPIValidationResources returns an immutable canonical resource view for one checked operation direction. OAS 3.0 required lists omit readOnly properties in requests and writeOnly properties in responses. All property schemas remain present, so supplied SHOULD-NOT properties are still accepted and validated. OAS 3.1 and 3.2 use their unchanged canonical resource view.

func (*Project) PayloadType

func (p *Project) PayloadType() (*language.PayloadType, error)

func (*Project) RecoverResourceNative

func (p *Project) RecoverResourceNative(resource, name, source string) (string, error)

func (*Project) ReleasePolicy

func (p *Project) ReleasePolicy() *language.ReleasePolicy

ReleasePolicy is release authority carried by the version-controlled native bundle. It is deliberately separate from wire metadata.

func (*Project) ResourceConstraintSource

func (p *Project) ResourceConstraintSource(resource string) string

func (*Project) Resources

func (p *Project) Resources() []Resource

func (*Project) Root

func (p *Project) Root() ResourceSelector

func (*Project) SchemaChecks

func (p *Project) SchemaChecks() analysis.SchemaReport

SchemaChecks returns the deterministic satisfiability classification for every checked declaration and the explicit entrypoints used as rejection gates. Unknown is retained as unknown and must not be presented as proof.

func (*Project) Summary

func (p *Project) Summary() string

func (*Project) Target

func (p *Project) Target() ProjectTarget

func (*Project) ValidateAvroBinary

func (p *Project) ValidateAvroBinary(input []byte, limits AvroPayloadLimits) error

ValidateAvroBinary validates exactly one datum against the selected writer schema and every explicitly supplied dependency. This is native-only: callers must separately decode to the checked PayloadType and run its refinements.

func (*Project) ValidateAvroJSON

func (p *Project) ValidateAvroJSON(input []byte, limits AvroPayloadLimits) error

ValidateAvroJSON checks exactly one datum using Avro's JSON encoding, not ordinary JSON model encoding. Non-null unions require their native type tag; bytes/fixed use code points 0..255. Defaults never fill missing writer fields. The JSON parser and binary transcode have independent bounded work/storage.

func (*Project) ValidateJSON

func (p *Project) ValidateJSON(input []byte) (failure error)

ValidateJSON performs native-only validation at a JSON Schema or supported OpenAPI Schema Object root. It does not run the editable language refinements.

func (*Project) Version

func (p *Project) Version() string

func (*Project) WithDerivedOpenAPIOperations

func (p *Project) WithDerivedOpenAPIOperations(options OpenAPIDerivationOptions) (*Project, error)

WithDerivedOpenAPIOperations returns a new project containing deterministic checked request/response wrappers and authoritative native operation bindings. Native Schema Objects remain in the immutable resource set and are always enforced before the derived structural types and later refinements. This helper does not infer request/response context predicates.

func (*Project) WithEditedNativeConstraintSource

func (p *Project) WithEditedNativeConstraintSource(resource, source string) (*Project, error)

WithEditedNativeConstraintSource explicitly edits one resource's provenance units. Empty source is an authored removal; a missing call is never inferred as removal. The source is checked and audited before replacing project state.

func (*Project) WithEditedSource

func (p *Project) WithEditedSource(source string) (*Project, error)

WithEditedSource checks an author's refinements while retaining the exact immutable native sidecar, root selector, and wire metadata.

func (*Project) WithEditedSourceAndNativeConstraintSources

func (p *Project) WithEditedSourceAndNativeConstraintSources(source string, edits []Resource) (*Project, error)

WithEditedSourceAndNativeConstraintSources changes the checked source and explicitly selected resource-scoped native units in one atomic validation. This is required when an embedded x-refine source deliberately keeps the canonical native units separate and both sides of an exact correspondence (for example Avro enum constructor order) must change together.

func (*Project) WithEditedSources

func (p *Project) WithEditedSources(entry string, sources map[string]string) (*Project, error)

WithEditedSources resolves imports only from the supplied map through the language package's bounded, immutable source bundle.

func (*Project) WithMetadata

func (p *Project) WithMetadata(metadata WireMetadata) (*Project, error)

type ProjectExport

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

ProjectExport is an immutable same-format SNAPSHOT. Resource URI/order and checked wire metadata remain explicit; Project.Resources remains the exact immutable baseline.

func (*ProjectExport) CompanionMarkdown

func (e *ProjectExport) CompanionMarkdown() string

func (*ProjectExport) EntryResource

func (e *ProjectExport) EntryResource() string

func (*ProjectExport) Format

func (e *ProjectExport) Format() Format

func (*ProjectExport) Losses

func (e *ProjectExport) Losses() []Loss

func (*ProjectExport) Metadata

func (e *ProjectExport) Metadata() WireMetadata

func (*ProjectExport) NativeConstraintSources

func (e *ProjectExport) NativeConstraintSources() []Resource

func (*ProjectExport) Resources

func (e *ProjectExport) Resources() []Resource

func (*ProjectExport) Root

func (e *ProjectExport) Root() ResourceSelector

func (*ProjectExport) Target

func (e *ProjectExport) Target() ProjectTarget

func (*ProjectExport) Version

func (e *ProjectExport) Version() string

type ProjectKind

type ProjectKind string

ProjectKind distinguishes a traditional single-payload schema project from an OpenAPI document whose checked entrypoints are its operations. A project never has both target forms.

const OpenAPIOperationsProject ProjectKind = "openapi-operations"
const PayloadProject ProjectKind = "payload"

type ProjectOptions

type ProjectOptions struct {
	ResourceID string
	Root       ResourceSelector
	Metadata   WireMetadata
}

type ProjectTarget

type ProjectTarget struct {
	Kind     ProjectKind      `json:"kind"`
	Resource string           `json:"resource,omitempty"`
	Root     ResourceSelector `json:"root,omitzero"`
}

ProjectTarget is a value snapshot of the immutable native selection. Payload projects have a nonzero Root and Resource == Root.Resource. Operation projects have an absolute OpenAPI entry Resource and a zero Root.

type Resource

type Resource struct {
	URI    string
	Source string
}

type ResourceConstraint

type ResourceConstraint struct {
	Resource   string
	Constraint provenance.Constraint
}

type ResourceSelector

type ResourceSelector struct {
	Resource string
	Pointer  string
	TypeName string
}

type ScalarEncoding

type ScalarEncoding struct {
	Kind      EncodingKind
	Precision int
	Scale     int
}

type ValidatedOpenAPIRequest

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

func (*ValidatedOpenAPIRequest) Data

func (*ValidatedOpenAPIRequest) Fingerprint

func (r *ValidatedOpenAPIRequest) Fingerprint() string

func (*ValidatedOpenAPIRequest) OperationID

func (r *ValidatedOpenAPIRequest) OperationID() string

type WireMetadata

type WireMetadata struct {
	ExtraFields          map[string]ExtraFieldMode
	Scalars              map[string]ScalarEncoding
	Discriminators       map[string]Discriminator
	PublicationNamespace string
	// NumericExpansion is the aggregate decimal expansion budget for one JSON
	// payload. Zero selects DefaultNumericExpansion; explicit values are
	// bounded so metadata cannot disable resource protection accidentally.
	NumericExpansion int
	// OpenAPI binds explicitly authored request/response context types to
	// native operation identifiers. No binding is inferred from paths.
	OpenAPI *refineopenapi.Schema `json:"openapi,omitempty"`
	// Examples are canonical typed Refine values with executable expectations.
	Examples *ExampleCatalog `json:"examples,omitempty"`
}

func (WireMetadata) NumericExpansionLimit

func (m WireMetadata) NumericExpansionLimit() int

Jump to

Keyboard shortcuts

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