ts-spec / tspec

Type-driven API Documentation library. Auto-generating REST API document based on TypeScript types.
https://ts-spec.github.io/tspec/
MIT License
108 stars 5 forks source link

Tspec.NoContent is not handled correctly #50

Closed egor0829 closed 1 month ago

egor0829 commented 1 month ago

Hi! I have the next specification:

type HotelsApiSpec = Tspec.DefineApiSpec<{
    security: 'jwt';
    paths: {
        '/orders/{order_id}/status': {
            put: {
                summary: 'Change order status';
                path: {order_id: string};
                body: ChangeOrderStatusParams;
                responses: {
                    200: Tspec.NoContent;
                };
            };
        };
    };
}>;

But it is converted to enum in handleConst So this condition not working properly And at the end I get

"responses": {
  "200": {
    "description": "Empty Response Body",
    "content": {
      "application/json": {
        "schema": {
          "description": "Empty Response Body",
          "type": "string",
          "enum": [
            ""
          ]
        }
      }
    }
  }
}
hyeonss0417 commented 1 month ago

Hello, egor0829

Thank you very much for taking the time to report the bug and for your interest in our project. We have reviewed the issue you reported regarding Tspec.NoContent, and we have implemented a fix. To resolve this issue on your end, please update tspec version to latest(=v0.1.113).

Once again, thank you for your valuable feedback. Your contributions help us improve the project significantly.

Best regards, Hyeonsoneg Jeon.