Documentation
¶
Overview ¶
Package schemas compiles and validates the versioned JSON Schemas that are assent's public contract surface (ADR-0017 §7: the serialized schemas are the API, not the internal Go types). This package is contract-tooling, not engine/decision code (D-016) — it neither trips the "no engine code before the Phase-3 gate" rule nor the internal/ coverage gate (D-010).
Index ¶
Constants ¶
const ReplayBundleSchemaID = replayBundleSchemaID
ReplayBundleSchemaID is the `$id` of the ReplayBundle schema. It is exported because it is not only a compiler resource key: per D-121 it is also the hash DOMAIN for `compare.ReplayBundleDigest` (ADR-0017 §9 domain separation), and that domain must be the schema `$id` itself rather than a hand-copied literal.
Variables ¶
var ( // ConfigSchema validates schemas/policy/v1alpha1/config.schema.json instances. ConfigSchema = mustCompile("config.schema.json", configSchemaJSON) // RulesetBindingSchema validates schemas/policy/v1alpha1/ruleset-binding.schema.json instances. RulesetBindingSchema = mustCompile("ruleset-binding.schema.json", rulesetBindingSchemaJSON) // MergePolicySchema validates schemas/policy/v1alpha1/merge-policy.schema.json instances. MergePolicySchema = mustCompile("merge-policy.schema.json", mergePolicySchemaJSON) // PackSchema validates schemas/policy/v1alpha1/pack.schema.json instances // (pack.yaml manifest; phase is a ceiling — P3-E4-S01 / D-017 B2). PackSchema = mustCompile("pack.schema.json", packSchemaJSON) // ProfileSchema validates schemas/policy/v1alpha1/profile.schema.json // instances (named PolicyProfile; required writes boolean — P3-E4-S02). ProfileSchema = mustCompile("profile.schema.json", profileSchemaJSON) // TestExpectationSchema validates schemas/testfixture/v1alpha1/test-expectation.schema.json // instances — the whole frozen adopter test-fixture contract (the expect.yaml // #/$defs/expectation document shape AND the cases.yaml #/$defs/casesFile wrapper // are one oneOf contract, REQ-P3-E1-S05-02). TestExpectationSchema = mustCompile("test-expectation.schema.json", testExpectationSchemaJSON) // ExpectationSchema validates a single expect.yaml against the #/$defs/expectation // FRAGMENT of the frozen contract (E6-S01). The fragment (not the top-level oneOf) // gives a located field-level rejection — additionalProperties '<field>' / enum — // for `assent test`'s strict expect.yaml decode, instead of a muddy // "oneOf matched none of 2" error. Its internal $ref to finding/score resolves // within the same compiled document. ExpectationSchema = mustCompileFragment("test-expectation.schema.json", testExpectationSchemaJSON, "#/$defs/expectation") // CasesFileSchema validates an inline cases.yaml against the #/$defs/casesFile // FRAGMENT of the same frozen contract (E6-S06). Like ExpectationSchema, the // fragment (not the top-level oneOf) yields a LOCATED field-level rejection — an // unknown top-level key or a bad `cases[].expect` reports at its own instance // pointer (/cases/N/expect/...) instead of a muddy "oneOf matched none of 2". Its // internal $refs to case/expectation/finding/score resolve within the same // compiled document. No new schema is authored — this reuses the frozen JSON. CasesFileSchema = mustCompileFragment("test-expectation.schema.json", testExpectationSchemaJSON, "#/$defs/casesFile") )
var ( // EvaluationInputSchema validates schemas/decision/v1alpha1/evaluation-input.schema.json instances. EvaluationInputSchema = decisionSchemas[evaluationInputSchemaID] // DecisionRecordSchema validates schemas/decision/v1alpha1/decision-record.schema.json instances. DecisionRecordSchema = decisionSchemas[decisionRecordSchemaID] // ReplayBundleSchema validates schemas/decision/v1alpha1/replay-bundle.schema.json instances. ReplayBundleSchema = decisionSchemas[replayBundleSchemaID] // PresentationModelSchema validates schemas/decision/v1alpha1/presentation-model.schema.json instances. PresentationModelSchema = decisionSchemas[presentationModelSchemaID] // PublicationReceiptSchema validates schemas/decision/v1alpha1/publication-receipt.schema.json instances. PublicationReceiptSchema = decisionSchemas[publicationReceiptSchemaID] // ComparisonRecordSchema validates schemas/comparison/v1alpha1/comparison-record.schema.json instances. ComparisonRecordSchema = comparisonSchemas[comparisonRecordSchemaID] // ComparisonSuiteSchema validates schemas/comparison/v1alpha1/comparison-suite.schema.json instances // (PolicyComparisonSuite — closed promotion-gate table + immutable corpus). ComparisonSuiteSchema = comparisonSchemas[comparisonSuiteSchemaID] )
var ( // ProviderRequestSchema validates schemas/provider/v1alpha1/request.schema.json instances (FactQuery). ProviderRequestSchema = mustCompile("request.schema.json", providerRequestSchemaJSON) // ProviderResponseSchema validates schemas/provider/v1alpha1/response.schema.json instances (FactResponse). ProviderResponseSchema = mustCompile("response.schema.json", providerResponseSchemaJSON) )
var ApprovalEvidenceSchema = mustCompileCrossReferenced(map[string][]byte{
decisionRecordSchemaID: decisionRecordSchemaJSON,
approvalEvidenceSchemaID: approvalEvidenceSchemaJSON,
})[approvalEvidenceSchemaID]
ApprovalEvidenceSchema validates approval-evidence.schema.json instances. Compiled with DecisionRecord in the same compiler so the cross-file pins $ref resolves (roast P1-B — one pins shape only).
Functions ¶
func ValidateApprovalEvidence ¶
ValidateApprovalEvidence checks raw JSON against approval-evidence.schema.json.
func ValidateProviderRequest ¶
ValidateProviderRequest checks raw JSON against the promoted request.schema.json (FactQuery). Exported so hack/spikes/provider's own ValidateRequest can delegate here post-promotion (REQ-P3-E1-S03-01).
func ValidateProviderResponse ¶
ValidateProviderResponse checks raw JSON against the promoted response.schema.json (FactResponse).
Types ¶
This section is empty.