Objective
Add comprehensive test to ensure generated schemas can validate actual output data (round-trip validation).
Context
Current tests verify schema generation but don't validate that schemas can actually validate real output data. This ensures schemas are not just structurally correct but functionally useful.
Implementation
Add new test function TestGeneratedSchemasValidateRealOutput in pkg/cli/mcp_schema_test.go:
func TestGeneratedSchemasValidateRealOutput(t *testing.T) {
// Test LogsData
schema, err := GenerateOutputSchema[LogsData]()
require.NoError(t, err)
resolved, err := schema.Resolve(&jsonschema.ResolveOptions{})
require.NoError(t, err)
data := LogsData{
Summary: "Test summary",
Runs: []RunData{{WorkflowName: "test-workflow"}},
}
jsonBytes, _ := json.Marshal(data)
var jsonValue map[string]any
json.Unmarshal(jsonBytes, &jsonValue)
err = resolved.Validate(jsonValue)
require.NoError(t, err, "Schema should validate real LogsData output")
// Add similar tests for AuditData and WorkflowStatus
}
Files to Modify
pkg/cli/mcp_schema_test.go - Add new test function
Acceptance Criteria
AI generated by Plan Command for discussion #6818
Objective
Add comprehensive test to ensure generated schemas can validate actual output data (round-trip validation).
Context
Current tests verify schema generation but don't validate that schemas can actually validate real output data. This ensures schemas are not just structurally correct but functionally useful.
Implementation
Add new test function
TestGeneratedSchemasValidateRealOutputinpkg/cli/mcp_schema_test.go:Files to Modify
pkg/cli/mcp_schema_test.go- Add new test functionAcceptance Criteria
Related to [plan] Upgrade and enhance google/jsonschema-go integration #6830