Skip to content

Conversation

@petewins
Copy link

@petewins petewins commented Nov 17, 2025

Problem

The OpenAPI generator was not processing parameters defined at the path level in OpenAPI specifications. According to the OpenAPI 3.0 specification, parameters can be defined at the path level and are inherited by all operations under that path.

Related Issue

This addresses the upstream type issue documented in Effect-TS/effect#5760, where OpenAPISpecPathItem doesn't include the parameters field that is part of the OpenAPI spec.

Changes

Modified src/OpenApi.ts:

  • Added logic to merge path-level parameters with operation-level parameters
  • Added type casting to work around the missing parameters field in OpenAPISpecPathItem type definition
  • Added comment referencing the upstream issue for future cleanup

Example
For an OpenAPI spec like:

paths:
  /helloWorld:
    parameters:
      - name: uuid
        in: path
        required: true
        schema:
          type: string
      - name: foo
        in: query
        schema:
          type: boolean
      - name: bar
        in: header
        schema:
          type: string
    get:
      operationId: getHelloWorld
      responses:
        '200':
          # ...

Before: The getHelloWorld method would only include the uuid path parameter, ignoring foo and bar.
After: The generated method correctly includes all parameters:

"getHelloWorld": (uuid: string, options?: typeof GerHelloWorld.Encoded) => 
  HttpClientRequest.get(`/helloWorld`).pipe(
    HttpClientRequest.setUrlParams({ "foo": options?.["foo"] as any }),
    HttpClientRequest.setHeaders({ "bar": options?.["bar"] ?? undefined }),
    // ...
  )

@petewins petewins changed the title feat: cast types fix: temporary fix until OpenAPISpecPathItem is updated Nov 17, 2025
@petewins petewins changed the title fix: temporary fix until OpenAPISpecPathItem is updated fix: temporary cast to fix OpenAPISpecPathItem Nov 17, 2025
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