Skip to content

[plan] Add schema validation test for round-trip testing #6833

Description

@github-actions

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions