version: "1.0.0"
tests:
  spec_schema.yaml#:
    valid:
      minimal_valid_spec:
        description: "Minimal valid specification with version and empty tests"
        payload:
          version: "1.0.0"
          tests: {}

      basic_spec_with_tests:
        description: "Basic specification with tests structure"
        payload:
          version: "2.1.0"
          tests:
            user_schema.yaml#/properties/user:
              valid:
                test_case:
                  description: "Basic test case"
                  payload: {"name": "test"}

    invalid:
      missing_version:
        description: "Specification missing required version field"
        payload:
          tests: {}
        message: "Missing required field: version"

      missing_tests:
        description: "Specification missing required tests field"
        payload:
          version: "1.0.0"
        message: "Missing required field: tests"

      invalid_version_type:
        description: "Version as number instead of string"
        payload:
          version: 1.0
          tests: {}
        message: "Version must be a string"

      non_object_tests:
        description: "Tests field as array instead of object"
        payload:
          version: "1.0.0"
          tests: []
        message: "Tests must be an object"

  spec_schema.yaml#/properties/version:
    valid:
      valid_semver_basic:
        description: "Basic SemVer version"
        payload: "1.0.0"

      valid_semver_prerelease:
        description: "SemVer with prerelease"
        payload: "2.1.0-beta.1"

      valid_semver_build:
        description: "SemVer with build metadata"
        payload: "1.0.0+build.123"

      valid_semver_full:
        description: "Complete SemVer with prerelease and build"
        payload: "3.2.1-alpha.1+build.456"

    invalid:
      invalid_version_not_string:
        description: "Version as number"
        payload: 1.0
        message: "Version must be a string"

      invalid_version_format:
        description: "Invalid version format"
        payload: "v1.0.0"
        message: "Version must follow SemVer format"

      invalid_version_empty:
        description: "Empty version string"
        payload: ""
        message: "Version cannot be empty"

  spec_schema.yaml#/properties/tests:
    valid:
      empty_tests:
        description: "Empty tests object"
        payload: {}

      single_schema_test:
        description: "Single schema with test cases"
        payload:
          schema.yaml#/properties/user:
            valid:
              valid_user:
                description: "Valid user"
                payload: {"name": "John", "age": 30}
            invalid:
              invalid_user:
                description: "Invalid user"
                payload: {"name": ""}
                message: "Name cannot be empty"

    invalid:
      tests_as_array:
        description: "Tests as array instead of object"
        payload: []
        message: "Tests must be an object"

      tests_as_string:
        description: "Tests as string"
        payload: "invalid"
        message: "Tests must be an object"

  spec_schema.yaml#/$defs/SchemaToTest:
    valid:
      empty_schema_test:
        description: "Empty schema test object"
        payload: {}

      only_valid_cases:
        description: "Schema test with only valid cases"
        payload:
          valid: {}

      only_invalid_cases:
        description: "Schema test with only invalid cases"
        payload:
          invalid: {}

      both_valid_invalid:
        description: "Schema test with both valid and invalid cases"
        payload:
          valid: {}
          invalid: {}

    invalid:
      additional_properties:
        description: "Schema test with disallowed additional properties"
        payload:
          valid: {}
          extra_field: "not allowed"
        message: "Additional properties not allowed"

  spec_schema.yaml#/$defs/CaseSet:
    valid:
      "null":
        description: "Null case set (allowed)"

      empty_case_set:
        description: "Empty case set object"
        payload: {}

      case_set_with_cases:
        description: "Case set with test cases"
        payload:
          test_case: {}

    invalid:
      case_set_as_string:
        description: "Case set as string instead of object/null"
        payload: "invalid"
        message: "Case set must be object or null"

      case_set_as_array:
        description: "Case set as array instead of object/null"
        payload: ["not", "allowed"]
        message: "Case set must be object or null"

  spec_schema.yaml#/$defs/CaseObject:
    valid:
      "null":
        description: "Null case object (allowed)"

      minimal_case:
        description: "Minimal valid case object"
        payload:
          description: "Test description"
          payload: {"test": "data"}

      complete_case:
        description: "Complete case object with all fields"
        payload:
          description: "Complete test case"
          payload: {"name": "test", "value": 123}
          parse_payload: false
          result: "valid"
          message: "Detailed validation message"
          payload_parsed: {"parsed": "data"}
          from_examples: true
          warnings:
            - "Simple warning"
            - generated: "Format divergence"
              code: "format-divergence"

      string_payload_case:
        description: "Case with string payload and parse_payload true"
        payload:
          description: "Parse payload test"
          payload: '{"json": "string"}'
          parse_payload: true
          payload_parsed: {"json": "string"}

      warnings_only_strings:
        description: "Case with only string warnings"
        payload:
          description: "Test with string warnings"
          payload: {"data": "test"}
          warnings:
            - "Warning one"
            - "Warning two"

    invalid:
      case_object_as_string:
        description: "Case object as string"
        payload: "invalid"
        message: "Case object must be object or null"

      additional_properties:
        description: "Case object with disallowed additional properties"
        payload:
          description: "Valid description"
          payload: {"data": "test"}
          extra_field: "not allowed"
        message: "Additional properties not allowed"

      invalid_description_type:
        description: "Case object with non-string description"
        payload:
          description: 123
          payload: {"test": "data"}
        message: "Description must be string"

      invalid_parse_payload_type:
        description: "Case object with non-boolean parse_payload"
        payload:
          description: "Test case"
          payload: {"data": "test"}
          parse_payload: "true"
        message: "parse_payload must be boolean"

      invalid_warning_missing_code:
        description: "Warning object missing required code field"
        payload:
          description: "Test with invalid warning"
          payload: {"data": "test"}
          warnings:
            - generated: "Warning without code"
        message: "Warning object missing required 'code' field"

      invalid_warning_bad_code:
        description: "Warning object with invalid code value"
        payload:
          description: "Test with bad warning code"
          payload: {"data": "test"}
          warnings:
            - generated: "Warning with bad code"
              code: "invalid-code-value"
        message: "Warning code must be 'format-divergence'"

      parse_payload_string_constraint:
        description: "parse_payload true but payload not string"
        payload:
          description: "Parse payload constraint violation"
          payload: {"object": "not string"}
          parse_payload: true
        message: "When parse_payload is true, payload must be string"
