tspec icon indicating copy to clipboard operation
tspec copied to clipboard

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

Open antasis9 opened this issue 2 years ago • 0 comments

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.

antasis9 avatar Aug 14 '24 01:08 antasis9