clm:
abstract_spec:
context: "Content type for JSON data."
goal: "Detect and validate JSON-encoded payloads."
success_criteria:
- "Content begins with { or ["
- "Content is parseable as valid JSON"
concrete_impl:
runtime: system
operation: ci_validate_application_json
universe_level: 0
content_type:
mime: "application/json"
extension: "json"
category: "text"
encoding: text
detection_rules:
text_patterns:
- "^\\s*[{\\[]"
schema:
constraints:
type_check: "is_text"
validator: "jq"
description: "Valid JSON document."
inputs:
payload: "blob — raw file bytes"
outputs:
is_valid: "boolean"
mime_type: "string"
process:
type: python
python_version: ">=3.10"
script: |
from clm.layer2.mime import validate
if not extra_args:
sys.exit("Usage: ci_validate_application_json <file>")
if not validate(clm_root, extra_args[0], "application/json"):
sys.exit(1)
precondition:
vcard_pre: gate:payload_nonempty
postcondition:
vcard_post: gate:result_sealed
balanced_exp:
expectation: "JSON validator accepts valid JSON and rejects malformed input."
pending_cases:
- given: {payload: '{"key": "value"}'}
when: "validate"
then: {is_valid: true, mime_type: "application/json"}
_meta:
clm_root_hash: sha256:149c964483b7aa4aa1620be9b4126cf1d3f6b35f19413103db261ef6d689f881
a_hash: sha256:618d56586ac4da2aeb80c983f4e29a3d8e4a2851545bbe06ccb864fc1af29fdc
c_hash: sha256:dd3208d5c9d9494a68558ff43fa65022a2773723e55acaa9270977180b83e204
b_hash: sha256:9db77cf2e201ea9679592ed1d1f2fd132442d5805198c4263676c35407a3cc85
clm_name: ci_validate_application_json
computed_at: "2026-07-13T02:41:38Z"
depends_on: []