hey-api / openapi-ts

šŸš€ The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more. Support: @mrlubos
https://heyapi.dev
Other
1.4k stars 106 forks source link

experimentalParser does not handle unknown schema #1334

Closed memben closed 48 minutes ago

memben commented 2 hours ago

Description

Hey thanks for the amazing work - I absolutely love this project,

I just saw that the zod schema generation has been dropped - really excited about that! Trying it out for our project already seemed great :) - However, while building the new client, I noticed that types.gen.ts seems to be missing unknown schemas:

Without the experimental parser it generates export type HealthcheckResponse = (unknown);. With the experimental parser, this export is removed, leading to failed imports in services.gen.ts.

Reproducible example or configuration

import { defineConfig } from "@hey-api/openapi-ts";

export default defineConfig({
  client: "@hey-api/client-axios",
  experimentalParser: true,
  input: "http://localhost:8000/openapi.json",
  output: "src/client",
  plugins: [
    "@tanstack/react-query",
    "zod",
    {
      dates: true,
      name: "@hey-api/transformers",
    },
  ],
});

npx openapi-ts with "@hey-api/openapi-ts": "^0.57.0",

OpenAPI specification (optional)

"/healthcheck": {
      "get": {
        "tags": [
          "Monitoring"
        ],
        "summary": "Healthcheck",
        "operationId": "healthcheck",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                }
              }
            }
          }
        }
      }
    },

System information (optional)

No response

mrlubos commented 2 hours ago

Hi Ben, thank you for reporting!

mrlubos commented 48 minutes ago

Hey, I checked this with the latest on main and it seems to be working as expected. I will close this issue but please reopen when you update to the latest once it's released