Skip to content

Support structure model output#10

Open
zhongkaifu wants to merge 3 commits intomainfrom
feature/support_structure_model_output
Open

Support structure model output#10
zhongkaifu wants to merge 3 commits intomainfrom
feature/support_structure_model_output

Conversation

@zhongkaifu
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18dfac6ebf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +698 to +702
if (types.Count == 0)
{
if (value.ValueKind == JsonValueKind.Null)
return true;
normalized = JsonNode.Parse(value.GetRawText());
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Enforce combinator constraints before generic primitive fallback

When a schema node has no type/properties/items, this branch treats it as unconstrained and accepts any JSON value. Because TryNormalizeValue only handles $ref and anyOf, schemas that use other combinators (for example oneOf) can pass validation but then be normalized as valid regardless of the combinator rules. A property like { "oneOf": [{"type":"string"},{"type":"integer"}] } will incorrectly accept objects/arrays, so structured-output responses can violate the declared schema without error.

Useful? React with 👍 / 👎.

Comment on lines +756 to +757
if (normalized == null && allowNullFallback)
return true;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply enum/const checks even when normalized value is null

This early return skips enum and const enforcement whenever the normalized value is null. As a result, schemas like { "type": ["string", "null"], "enum": ["ok"] } incorrectly accept null, and missing nullable fields auto-filled as null can bypass enum/const constraints too. That allows invalid model outputs to be returned as schema-valid.

Useful? React with 👍 / 👎.

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.

1 participant