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
- func AppendBundleReleasePolicy(input []byte, policy *language.ReleasePolicy) ([]byte, error)
- func OpenAPIContractExplanation(program *language.Program, metadata WireMetadata) (string, error)
- func ReleaseComparisonBundle(input []byte) ([]byte, *language.ReleasePolicy, error)
- func SchemaEntrypoints(root string, metadata WireMetadata) []string
- type Annotation
- type AuthorOpenAPIOptions
- type AvroDefaultCheck
- type AvroPayloadLimits
- type CheckedExample
- type Discriminator
- type Document
- func Parse(format Format, input []byte, options Options) (*Document, error)
- func ParseAvro(input []byte, options Options) (*Document, error)
- func ParseJSONSchema(input []byte, options Options) (document *Document, failure error)
- func ParseOpenAPI(input []byte, options Options) (document *Document, failure error)
- func (d *Document) Annotations() []Annotation
- func (d *Document) AuditSource(source string) ([]provenance.Finding, error)
- func (d *Document) ConstraintSource() string
- func (d *Document) Constraints() []provenance.Constraint
- func (d *Document) ExportOriginal() []byte
- func (d *Document) Format() Format
- func (d *Document) Original() string
- func (d *Document) RecoverNative(name, source string) (string, error)
- func (d *Document) Version() string
- type EncodingKind
- type Enforcement
- type Error
- type ExampleCase
- type ExampleCatalog
- type ExampleExpectation
- type Export
- type ExportMode
- type ExtraFieldMode
- type Format
- type Loss
- type LowerOptions
- type NativeExampleExpectation
- type OpenAPIDerivationOptions
- type OpenAPIDirection
- type OpenAPIHeaderJSON
- type OpenAPILimits
- type OpenAPIMediaJSON
- type OpenAPIOperation
- type OpenAPIOperationCatalog
- type OpenAPIOperationIngestOptions
- type OpenAPIParameterJSON
- type OpenAPIRequestJSON
- type OpenAPIResponseJSON
- type OpenAPIResponseOperation
- type OpenAPISchemaTarget
- type OpenAPIValidationView
- type Options
- type Project
- func AuthorOpenAPIProject(program *language.Program, options AuthorOpenAPIOptions) (*Project, error)
- func IngestOpenAPIOperationResources(resources []Resource, options OpenAPIOperationIngestOptions) (*Project, error)
- func IngestOpenAPIOperations(input []byte, options OpenAPIOperationIngestOptions) (*Project, error)
- func IngestProject(format Format, input []byte, options ProjectOptions) (*Project, error)
- func IngestProjectResources(format Format, resources []Resource, options ProjectOptions) (*Project, error)
- func ParseBundle(input []byte) (*Project, error)
- func (p *Project) AuditResourceSource(resource, source string) ([]provenance.Finding, error)
- func (p *Project) AvroDefaultChecks() []AvroDefaultCheck
- func (p *Project) Bundle() ([]byte, error)
- func (p *Project) CanonicalJSONResources() ([]Resource, error)
- func (p *Project) DecodeAndValidateAvro(input []byte, payloadLimits AvroPayloadLimits, ...) (value.Data, validation.Report, error)
- func (p *Project) DecodeAndValidateAvroJSON(input []byte, payloadLimits AvroPayloadLimits, ...) (value.Data, validation.Report, error)
- func (p *Project) DecodeAndValidateJSON(input []byte, limits validation.Limits) (value.Data, validation.Report, error)
- func (p *Project) DecodeAndValidateOpenAPIRequest(operationID string, input OpenAPIRequestJSON, limits OpenAPILimits, ...) (*ValidatedOpenAPIRequest, validation.Report, error)
- func (p *Project) DecodeAndValidateOpenAPIResponse(operationID string, input OpenAPIResponseJSON, ...) (value.Data, validation.Report, error)
- func (p *Project) EditableSource() string
- func (p *Project) EffectiveResources() ([]Resource, error)
- func (p *Project) EntryResource() string
- func (p *Project) Export(options LowerOptions) (*ProjectExport, error)
- func (p *Project) Format() Format
- func (p *Project) GeneratedEnforcement() Enforcement
- func (p *Project) HasOpenAPINativeBindings() bool
- func (p *Project) HasPayloadRoot() bool
- func (p *Project) JSONSchemaKeywordLocations(keywords ...string) ([]string, error)
- func (p *Project) JSONSchemaResourceAliases() ([]Resource, error)
- func (p *Project) Kind() ProjectKind
- func (p *Project) LanguageEntry() string
- func (p *Project) LanguageFiles() []language.SourceFile
- func (p *Project) Metadata() WireMetadata
- func (p *Project) NativeConstraintSources() []Resource
- func (p *Project) NativeConstraints() []ResourceConstraint
- func (p *Project) NativeDocument() *Document
- func (p *Project) OpenAPIOperationIndex() (OpenAPIOperationCatalog, error)
- func (p *Project) OpenAPIValidationResources(direction OpenAPIDirection) ([]Resource, error)
- func (p *Project) PayloadType() (*language.PayloadType, error)
- func (p *Project) RecoverResourceNative(resource, name, source string) (string, error)
- func (p *Project) ReleasePolicy() *language.ReleasePolicy
- func (p *Project) ResourceConstraintSource(resource string) string
- func (p *Project) Resources() []Resource
- func (p *Project) Root() ResourceSelector
- func (p *Project) SchemaChecks() analysis.SchemaReport
- func (p *Project) Summary() string
- func (p *Project) Target() ProjectTarget
- func (p *Project) ValidateAvroBinary(input []byte, limits AvroPayloadLimits) error
- func (p *Project) ValidateAvroJSON(input []byte, limits AvroPayloadLimits) error
- func (p *Project) ValidateJSON(input []byte) (failure error)
- func (p *Project) Version() string
- func (p *Project) WithDerivedOpenAPIOperations(options OpenAPIDerivationOptions) (*Project, error)
- func (p *Project) WithEditedNativeConstraintSource(resource, source string) (*Project, error)
- func (p *Project) WithEditedSource(source string) (*Project, error)
- func (p *Project) WithEditedSourceAndNativeConstraintSources(source string, edits []Resource) (*Project, error)
- func (p *Project) WithEditedSources(entry string, sources map[string]string) (*Project, error)
- func (p *Project) WithMetadata(metadata WireMetadata) (*Project, error)
- type ProjectExport
- func (e *ProjectExport) CompanionMarkdown() string
- func (e *ProjectExport) EntryResource() string
- func (e *ProjectExport) Format() Format
- func (e *ProjectExport) Losses() []Loss
- func (e *ProjectExport) Metadata() WireMetadata
- func (e *ProjectExport) NativeConstraintSources() []Resource
- func (e *ProjectExport) Resources() []Resource
- func (e *ProjectExport) Root() ResourceSelector
- func (e *ProjectExport) Target() ProjectTarget
- func (e *ProjectExport) Version() string
- type ProjectKind
- type ProjectOptions
- type ProjectTarget
- type Resource
- type ResourceConstraint
- type ResourceSelector
- type ScalarEncoding
- type ValidatedOpenAPIRequest
- type WireMetadata
Constants ¶
const DefaultLowerGenericSpecializations = 512
const DefaultNumericExpansion = 65536
const DefaultOpenAPIBytes = 1024 * 1024
const DefaultOpenAPIDepth = 128
const DefaultOpenAPINodes = 100000
const DefaultOpenAPIParts = 1024
const ExampleCatalogVersion = "refine.examples/v1"
const MaxEmbeddedExampleBytes = 64 << 10
const MaxEmbeddedExamples = 64
const MaxEmbeddedExamplesBytes = 1 << 20
const MaxNumericExpansion = 1000000
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 ¶
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 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 ParseJSONSchema ¶
func ParseOpenAPI ¶
func (*Document) Annotations ¶
func (d *Document) Annotations() []Annotation
func (*Document) AuditSource ¶
func (d *Document) AuditSource(source string) ([]provenance.Finding, error)
func (*Document) ConstraintSource ¶
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 (*Document) RecoverNative ¶
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 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) CompanionMarkdown ¶
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 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 OpenAPIMediaJSON ¶
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 ¶
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 ¶
func (v *OpenAPIValidationView) Selector(original ResourceSelector) (ResourceSelector, error)
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 (*Project) AuditResourceSource ¶
func (p *Project) AuditResourceSource(resource, source string) ([]provenance.Finding, error)
func (*Project) AvroDefaultChecks ¶
func (p *Project) AvroDefaultChecks() []AvroDefaultCheck
func (*Project) Bundle ¶
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 ¶
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 (*Project) EffectiveResources ¶
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 (*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) 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 (*Project) HasPayloadRoot ¶
func (*Project) JSONSchemaKeywordLocations ¶
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 ¶
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 (*Project) LanguageFiles ¶
func (p *Project) LanguageFiles() []language.SourceFile
func (*Project) Metadata ¶
func (p *Project) Metadata() WireMetadata
func (*Project) NativeConstraintSources ¶
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 (*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 (*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 (*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) 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 ¶
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) 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 ¶
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 ¶
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 ¶
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 ResourceConstraint ¶
type ResourceConstraint struct {
Resource string
Constraint provenance.Constraint
}
type ResourceSelector ¶
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 (r *ValidatedOpenAPIRequest) Data() value.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
Source Files
¶
- annotations_gp.go
- avro_defaults_gp.go
- avro_json_gp.go
- avro_parse_gp.go
- avro_payload_gp.go
- avro_provenance_gp.go
- avro_refined_gp.go
- avro_refinement_defaults_gp.go
- bundle_gp.go
- constraint_origin_gp.go
- document_gp.go
- effective_gp.go
- examples_gp.go
- extra_fields_gp.go
- json_offline_gp.go
- json_projection_context_gp.go
- json_projection_resolver_gp.go
- json_refined_gp.go
- json_value_gp.go
- lower_cardinality_gp.go
- lower_dependent_required_gp.go
- lower_generics_gp.go
- lower_gp.go
- lower_numbers_gp.go
- lower_string_length_gp.go
- lower_unique_items_gp.go
- map_order_gp.go
- metadata_gp.go
- openapi_annotations_gp.go
- openapi_authoring_gp.go
- openapi_catalog_annotations_gp.go
- openapi_catalog_locations_gp.go
- openapi_catalog_projection_gp.go
- openapi_direction_gp.go
- openapi_explanation_gp.go
- openapi_kin_oracle_view_gp.go
- openapi_metadata_gp.go
- openapi_operation_boundary_gp.go
- openapi_operation_derivation_gp.go
- openapi_operation_index_gp.go
- openapi_operations_export_gp.go
- openapi_operations_project_gp.go
- openapi_oracle_view_gp.go
- openapi_payload_gp.go
- openapi_projection_catalog_gp.go
- openapi_provenance_gp.go
- openapi_validation_view_gp.go
- project_annotations_gp.go
- project_export_gp.go
- project_gp.go
- project_openapi_addition_gp.go
- project_ordinary_gp.go
- project_schema_gp.go
- project_target_gp.go
- projection_gp.go
- projection_json_gp.go
- provenance_gp.go
- regex_gp.go
- release_policy_gp.go
- resources_gp.go
- schema_locations_gp.go
- schema_locations_json_gp.go
- source_composition_gp.go