Add schema selection values and ownership
This commit is contained in:
@@ -36,6 +36,26 @@ func newOutputContractTestRunner() (*Runner, outputContractTestCollaborators) {
|
||||
), collaborators
|
||||
}
|
||||
|
||||
func TestResolveInlineSchemaOwnsRuntimeValue(t *testing.T) {
|
||||
value := map[string]any{"properties": map[string]any{"name": map[string]any{"type": "string"}}}
|
||||
override := domain.OutputContract{Format: domain.FormatJSON, ValidationMode: domain.ValidationJSONSchema, Schema: value}
|
||||
contract, err := resolveOutputContract(context.Background(), &domain.PromptDefinition{}, &override)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
value["properties"].(map[string]any)["name"] = false
|
||||
if _, ok := contract.Schema.(map[string]any)["properties"].(map[string]any)["name"].(map[string]any); !ok {
|
||||
t.Fatal("schema shares caller storage")
|
||||
}
|
||||
var null map[string]any
|
||||
override.Schema = null
|
||||
override.SchemaPath = "schema.json"
|
||||
contract, err = resolveOutputContract(context.Background(), &domain.PromptDefinition{}, &override)
|
||||
if err != nil || contract.Schema != nil {
|
||||
t.Fatalf("typed null selection: %#v, %v", contract.Schema, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunnerPreparationNormalizesOutputContractConsistently(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user