Documentation
¶
Index ¶
- func ActionableValidationErrorViolations(err error, wantContains ...string) []string
- func AnnotationPushItemTargetJSON(annotation AssociationAnnotationIngressAnnotation) map[string]any
- func RequireActionableValidationError(t *testing.T, err error, wantContains ...string)
- func RequireValidationErrorContains(t *testing.T, err error, want string)
- func StripActionableValidationDimension(msg string, d ActionableValidationErrorDimension) (string, error)
- type ActionableValidationErrorDimension
- type ActionableValidationErrorParts
- type AnnotationEntryTargetFixture
- type AnnotationRequestShape
- type AssociationAnnotationIngressAnnotation
- type AssociationAnnotationIngressExpected
- type AssociationAnnotationIngressFixtures
- type AssociationAnnotationIngressHashComparison
- type AssociationAnnotationIngressInput
- type PublishedAssociationFixture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AnnotationPushItemTargetJSON ¶
func AnnotationPushItemTargetJSON(annotation AssociationAnnotationIngressAnnotation) map[string]any
AnnotationPushItemTargetJSON returns the fixture's exact target fields for a real AnnotationPushItem JSON body, retaining explicit null target values.
func StripActionableValidationDimension ¶
func StripActionableValidationDimension(msg string, d ActionableValidationErrorDimension) (string, error)
Types ¶
type ActionableValidationErrorDimension ¶
type ActionableValidationErrorDimension string
const ( ActionableValidationErrorWhat ActionableValidationErrorDimension = "what" ActionableValidationErrorWhy ActionableValidationErrorDimension = "why" ActionableValidationErrorWhere ActionableValidationErrorDimension = "where" ActionableValidationErrorWhen ActionableValidationErrorDimension = "when" ActionableValidationErrorMeaning ActionableValidationErrorDimension = "meaning" ActionableValidationErrorRemediation ActionableValidationErrorDimension = "remediation" )
type ActionableValidationErrorParts ¶
type ActionableValidationErrorParts struct {
What string
Why string
Where string
When string
Meaning string
Remediation string
}
func ParseActionableValidationError ¶
func ParseActionableValidationError(msg string) (ActionableValidationErrorParts, error)
func (ActionableValidationErrorParts) Fragment ¶
func (p ActionableValidationErrorParts) Fragment(d ActionableValidationErrorDimension) string
func (ActionableValidationErrorParts) Fragments ¶
func (p ActionableValidationErrorParts) Fragments() []string
type AnnotationEntryTargetFixture ¶
type AnnotationEntryTargetFixture struct {
SessionID string `yaml:"sessionId"`
EntryIndex int `yaml:"entryIndex"`
EndIndex int `yaml:"endIndex"`
}
AnnotationEntryTargetFixture is the fixture-shaped entry target before tests convert it to the public AnnotationEntryTarget wire type.
type AnnotationRequestShape ¶
type AnnotationRequestShape struct {
Annotations []any `yaml:"annotations"`
}
AnnotationRequestShape is the nullability arm of the shared ingress corpus. A nil slice represents YAML null; an allocated empty slice represents [].
type AssociationAnnotationIngressAnnotation ¶
type AssociationAnnotationIngressAnnotation struct {
TargetKind string `yaml:"targetKind"`
TargetAssociationID *string `yaml:"targetAssociationId,omitempty"`
SessionID *string `yaml:"sessionId,omitempty"`
EntryTarget *AnnotationEntryTargetFixture `yaml:"entryTarget,omitempty"`
AnnotationID *string `yaml:"annotationId,omitempty"`
ProjectHash *string `yaml:"projectHash,omitempty"`
// contains filtered or unexported fields
}
AssociationAnnotationIngressAnnotation is the fixture-shaped form of an AnnotationPushItem. It keeps YAML field names explicit without importing the root contract package into this shared test helper.
func (AssociationAnnotationIngressAnnotation) HasExplicitNullTargetField ¶
func (a AssociationAnnotationIngressAnnotation) HasExplicitNullTargetField(name string) bool
HasExplicitNullTargetField reports whether the fixture explicitly contained a JSON-null value for the named target property.
func (*AssociationAnnotationIngressAnnotation) UnmarshalYAML ¶
func (a *AssociationAnnotationIngressAnnotation) UnmarshalYAML(node *yaml.Node) error
UnmarshalYAML preserves whether a nullable target was explicitly supplied as null. The typed Go validator receives the same nil pointer either way, while the JSON-backed OpenAPI test must retain explicit null to verify parity with the served schema.
type AssociationAnnotationIngressExpected ¶
type AssociationAnnotationIngressExpected struct {
PublishRequestValid bool `yaml:"publishRequestValid"`
AnnotationRequestValid bool `yaml:"annotationRequestValid"`
AnnotationOperationSchemaValid *bool `yaml:"annotationOperationSchemaValid,omitempty"`
AnnotationEntryTargetValid *bool `yaml:"annotationEntryTargetValid,omitempty"`
}
AssociationAnnotationIngressExpected records the independent request boundary verdicts that one shared ingress row must exercise.
func (AssociationAnnotationIngressExpected) OperationSchemaValid ¶
func (e AssociationAnnotationIngressExpected) OperationSchemaValid() bool
OperationSchemaValid returns the expected result from the generated Village operation schema. Most rows match the typed request verdict; rows that prove a relational rule JSON Schema cannot express declare an explicit override.
type AssociationAnnotationIngressFixtures ¶
type AssociationAnnotationIngressFixtures struct {
Cases []testcase.Case[AssociationAnnotationIngressInput, AssociationAnnotationIngressExpected] `yaml:"cases"`
AnnotationRequestShapes testcase.Corpus[AnnotationRequestShape, bool] `yaml:"annotation_request_shapes"`
StrictDecoding testcase.Corpus[string, bool] `yaml:"strict_decoding"`
}
AssociationAnnotationIngressFixtures is the typed form of the shared YAML corpus for association publication and annotation ingress validation.
func DecodeAssociationAnnotationIngressFixtures ¶
func DecodeAssociationAnnotationIngressFixtures(data []byte) (*AssociationAnnotationIngressFixtures, error)
DecodeAssociationAnnotationIngressFixtures validates a raw corpus source. It lets strict-decoding cases exercise the same loader that reads the committed corpus.
func (*AssociationAnnotationIngressFixtures) CaseCorpus ¶
func (f *AssociationAnnotationIngressFixtures) CaseCorpus() testcase.Corpus[AssociationAnnotationIngressInput, AssociationAnnotationIngressExpected]
CaseCorpus returns the typed main validation arm in the same canonical form as the nested strict-decoding arm. The YAML keeps its main cases at the top-level so TypeScript can consume the one cross-language corpus directly.
type AssociationAnnotationIngressHashComparison ¶
type AssociationAnnotationIngressHashComparison struct {
AlternateTargetAssociationID string `yaml:"alternateTargetAssociationId"`
Distinct bool `yaml:"distinct"`
}
AssociationAnnotationIngressHashComparison declares a target-ID mutation whose production content hash must have the expected equality relationship.
type AssociationAnnotationIngressInput ¶
type AssociationAnnotationIngressInput struct {
Associations []PublishedAssociationFixture `yaml:"associations"`
Annotation AssociationAnnotationIngressAnnotation `yaml:"annotation"`
HashComparison *AssociationAnnotationIngressHashComparison `yaml:"hashComparison,omitempty"`
}
AssociationAnnotationIngressInput is one producer request fragment and one annotation item validated against it. Its field strings deliberately model raw YAML; callers convert them to production wire types before validation.
type PublishedAssociationFixture ¶
type PublishedAssociationFixture struct {
ID string `yaml:"id"`
ObservedCommitHash string `yaml:"observedCommitHash"`
}
PublishedAssociationFixture preserves the fixture's exact wire names before the root contract test converts it to schema.PublishedAssociation.