Skip to content

Experimental output incompatibility with openapi 3.0 #9601

@amalshaji-plivo

Description

@amalshaji-plivo

Description

I have the following schema in the experimental output zod schema

z.record(z.string(), z.string())

This generated propertyNames which is incompatible with openapi3.0

 responseBody: "{\n  \"error\": {\n    \"message\": \"Invalid schema for response_format 'response': In context=('properties', 'variables'), 'propertyNames' is not permitted.\",\n    \"type\": \"invalid_request_error\",\n    \"param\": \"response_format\",\n    \"code\": null\n  }\n}",

zod has a fix for this by passing the target when converting to jsonSchema colinhacks/zod#4841

For now, a fallback is to use jsonSchema

schema: jsonSchema(
	z.toJSONSchema(MessageResponseSchema as any, {
		target: "openapi-3.0",
	}),
),

AI SDK Version

  • ai: 5.0.60
  • ai-sdk/azure: 2.0.30

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions