-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
anthropic[minor]: fix nested object fixArrayXMLParameters #4778
anthropic[minor]: fix nested object fixArrayXMLParameters #4778
Conversation
When parsing a nested object in fixArrayXMLParameters, the base schema is passed on the recursive call. This causes a mismatch between the xml object (the nested type) and the schema (still the base type) I'm not very happy with type assertion for the schema, not sure what's the correct check to make here though.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@davidfant I think you had this in your PR initially too? |
Thank you! Seems to work for me! |
@@ -100,7 +100,10 @@ export function fixArrayXMLParameters( | |||
typeof xmlParameters[key] === "object" && | |||
xmlParameters[key] !== null | |||
) { | |||
fixedParameters[key] = fixArrayXMLParameters(schema, xmlParameters[key]); | |||
fixedParameters[key] = fixArrayXMLParameters( | |||
schema.properties[key] as JsonSchema7ObjectType, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidfant had:
{
...schema.properties[key],
definitions: schema.definitions,
}
for the first arg - does that make sense here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will break JSON schema definitions. TBH I'm not sure how well this XML situation would even work with JSON schema definitions though, so it might not practically matter, but I'd still prefer adding in definitions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will change it to yours
…fix-antropic-tools
Thank you both! |
When parsing a nested object in fixArrayXMLParameters, the base schema is passed on the recursive call. This causes a mismatch between the xml object (the nested type) and the schema (still the base type)
I'm not very happy with type assertion for the schema, not sure what's the correct check to make here though.