Add schema selection values and ownership

This commit is contained in:
2026-11-20 15:20:29 +00:00
parent e775a3c116
commit fbe3d427a2
17 changed files with 186 additions and 9 deletions

View File

@@ -183,6 +183,15 @@ func validateArtifact(ctx context.Context, artifact *domain.Artifact, contract d
}
}
// DecodeInlineSchema converts a caller-supplied value to an owned JSON document.
func DecodeInlineSchema(ctx context.Context, value any) (any, error) {
encoded, err := json.Marshal(value)
if err != nil {
return nil, err
}
return decodeJSONValue(ctx, encoded)
}
func decodeJSONValue(ctx context.Context, body []byte) (any, error) {
if err := ctx.Err(); err != nil {
return nil, err

View File

@@ -6,6 +6,12 @@ import (
"go.maximumdirect.net/promptkit/internal/domain"
)
// Input describes the selected contract and its optional bound schema file.
type Input struct {
Contract domain.OutputContract
File *domain.ResourceBinding
}
// PreparedValidation validates artifacts against one frozen output contract.
// Its cancellation boundary is synchronous: Validate does not detach schema
// execution, and an observed context error prevents publication of a result.