Skip to content
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

Response type missing when using Fetch with empty schema #1826

Open
AllieJonsson opened this issue Jan 16, 2025 · 1 comment · May be fixed by #1827
Open

Response type missing when using Fetch with empty schema #1826

AllieJonsson opened this issue Jan 16, 2025 · 1 comment · May be fixed by #1827
Assignees
Labels
fetch Fetch client related issue
Milestone

Comments

@AllieJonsson
Copy link
Contributor

What are the steps to reproduce this issue?

  1. Use the following schema
openapi: 3.0.1
info:
  title: Test
  version: v1.0
paths:
  /test:
    get:
      description: Test
      operationId: test
      responses:
        200:
          description: Test
          content:
            application/json:
              schema:
                example: {}
  1. Generate with client: fetch

What happens?

export type testResponse = {
  data: ;
  status: number;
  headers: Headers;
}

What were you expecting to happen?

export type testResponse = {
  data: unkown;
  status: number;
  headers: Headers;
}
@AllieJonsson
Copy link
Contributor Author

Also, when using this schema:

openapi: 3.0.1
info:
  title: Test
  version: v1.0
paths:
  /test:
    get:
      description: Test
      operationId: test
      responses:
        200:
          description: Test
          content:
            application/json:
              schema:
                example: {}
        400:
          description: Error
          content:
            application/json:
              schema:
                type: string

this is generated:

export type testResponse = {
  data: string;
  status: number;
  headers: Headers;
};

which is wrong, since data should be unknown, which in turn generates another error:
image

@melloware melloware added this to the 7.4.2 milestone Jan 16, 2025
@melloware melloware added the fetch Fetch client related issue label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetch Fetch client related issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants