Fix discrimiantor mapping property of AI schemas #190
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces enhancements to schema composition and validation logic, focusing on improving the handling of
discriminator
properties in JSON schemas. The changes ensure better support for mapping values and add comprehensive validation checks for schema integrity.Schema Composition Enhancements:
discriminator
handling inChatGptSchemaComposer
: Added support for mapping values in thediscriminator
property, ensuring mappings are transformed into appropriate schema references (#/components/schemas/...
).discriminator
logic inLlmSchemaV3_1Composer
: Extended thediscriminator
handling to include validation of mappings and filtering of schema references, ensuring compatibility with theunion
structure. [1] [2]Validation Logic Improvements:
test_chatgpt_schema_discriminator
: Added checks for the presence and correctness ofdiscriminator.mapping
, verifying that all mapping values start with#/$defs/
or#/components/schemas/
. [1] [2]validate_llm_schema_discriminator
: Introduced new tests for additional vendors (claude
,deepseek
, and3.1
) and enhanced validation ofdiscriminator.mapping
for schema integrity. [1] [2] [3]