Skip to content

Preserve empty JSON schema metadata#1488

Merged
romanlutz merged 2 commits intomicrosoft:mainfrom
biefan:preserve-empty-json-schema-metadata
Mar 18, 2026
Merged

Preserve empty JSON schema metadata#1488
romanlutz merged 2 commits intomicrosoft:mainfrom
biefan:preserve-empty-json-schema-metadata

Conversation

@biefan
Copy link
Copy Markdown
Contributor

@biefan biefan commented Mar 17, 2026

Summary

  • preserve explicitly provided empty JSON schema objects in _JsonResponseConfig.from_metadata()
  • add a regression test covering json_schema={} metadata

Problem

_JsonResponseConfig.from_metadata() currently treats json_schema={} as falsy and falls through to the same branch as “no schema provided”. That means these two inputs behave differently even though they both represent an explicit empty schema:

  • json_schema="{}" -> preserved as {}
  • json_schema={} -> silently converted to None

This is an inconsistent metadata parsing bug rather than a validation decision, because the string and dict forms should not diverge like this.

Testing

  • .venv/bin/pytest tests/unit/models/test_json_response_config.py -q

@hannahwestra25 hannahwestra25 self-assigned this Mar 17, 2026
@romanlutz romanlutz merged commit 5811b8a into microsoft:main Mar 18, 2026
37 checks passed
riyosha pushed a commit to riyosha/PyRIT that referenced this pull request Mar 24, 2026
jbolor21 pushed a commit to jbolor21/jbolor-PyRIT that referenced this pull request Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants