Skip to content

Conversation

@jasonblanchard
Copy link
Owner

@jasonblanchard jasonblanchard commented Nov 1, 2025

Fixes #71

@jasonblanchard jasonblanchard changed the title Fix parameter schema. Fixes #71 Fix parameter schema when schema is a ref Nov 1, 2025
@jasonblanchard jasonblanchard changed the title Fix parameter schema when schema is a ref Fix parameter schema when schema is a $ref Nov 1, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances parameter schema validation to support recursive schema references (like $ref and enums) and adds a new endpoint demonstrating enum validation in path parameters.

  • Updated the OpenAPISpec schema to allow full recursive schema definitions for parameters
  • Added a new /pets/{size} endpoint with enum validation to the kitchensink example
  • Added test coverage for enum validation including invalid values

Reviewed Changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/openapi-typescript-server-runtime/src/schema.ts Replaced inline parameter schema object with recursive Schema type to support $ref and enum validation
examples/kitchensink/openapi.yaml Added new PetSize enum schema and /pets/{size} endpoint demonstrating enum path parameter
examples/kitchensink/gen/server.ts Generated server types for the new listPetsBySize operation
examples/kitchensink/gen/schema.d.ts Generated TypeScript types for the new endpoint and PetSize enum
examples/kitchensink/app.test.ts Added test coverage for new endpoint including enum validation
examples/kitchensink/api.ts Added unimplemented handler stub for new endpoint
schema: z.object({
type: z.string(),
}),
schema: Schema,
Copy link
Owner Author

Choose a reason for hiding this comment

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

This was the bug. It's not always a string, it can be any Schema.

@jasonblanchard jasonblanchard merged commit 0ee494d into main Nov 1, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants