Skip to content

If I use 'combined type' to the request, the requestBody isn't generated. #63

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

Open
antasis9 opened this issue Aug 14, 2024 · 0 comments
Assignees

Comments

@antasis9
Copy link

antasis9 commented Aug 14, 2024

Describe the bug
If I use 'combined type' as the request body, the requestBody isn't generated.

To Reproduce
I used below source code to reproduce this bug.

type BookRequest =
  | {
      type: "poem";
    }
  | {
      key: "novel";
    };

export type BookApiSpec = Tspec.DefineApiSpec<{
...
  paths: {
    "/books": {
      post: {
...
        body: BookRequest;
...
      };
    };
  };
}>;

Steps to reproduce the behavior:
npx tspec generate

Expected behavior
I've been expected 'requestBody' to generated json file.
However, I can't find them at there, please refer to Screenshots section.
When I used 'single type', it's working perfectly.

Screenshots
There is no 'requestBody' section.
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser edge
  • Version N/A

Additional context
Add any other context about the problem here.

@hyeonss0417 hyeonss0417 self-assigned this Aug 21, 2024
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

No branches or pull requests

2 participants