Problem
json_schema_to_model() ignores the schema required array and passes Field(...) for every property. As a result, properties that JSON Schema allows callers to omit are rejected by the generated Pydantic model.
Reproduction
Using a schema with required_name in required and optional_note omitted from required:
Model = json_schema_to_model({
"type": "object",
"properties": {
"required_name": {"type": "string"},
"optional_note": {"type": "string"},
},
"required": ["required_name"],
})
Model(required_name="ok")
Current result:
ValidationError: optional_note - Field required
Both generated fields report is_required() == True.
Expected behavior
Only fields named in the JSON Schema required array should be mandatory. Optional fields should remain omittable, while explicit null should still be rejected unless the property schema permits null. The field-schema helper used for skill outputs can continue marking all of its supplied fields as required for backward compatibility.
Problem
json_schema_to_model() ignores the schema required array and passes Field(...) for every property. As a result, properties that JSON Schema allows callers to omit are rejected by the generated Pydantic model.
Reproduction
Using a schema with required_name in required and optional_note omitted from required:
Current result:
Both generated fields report is_required() == True.
Expected behavior
Only fields named in the JSON Schema required array should be mandatory. Optional fields should remain omittable, while explicit null should still be rejected unless the property schema permits null. The field-schema helper used for skill outputs can continue marking all of its supplied fields as required for backward compatibility.