-
Notifications
You must be signed in to change notification settings - Fork 68
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
Support Namespaces #43
Comments
Hi @FlorianWendelborn, thanks to pointing this, indeed I’m not using Indeed prefixing seams to be the simplest for this, let’s do this! |
The output with my PR #44 // Generated by ts-to-zod
import { z } from "zod";
export const bulkDownloadPartsPathParametersSchema = z.object({
service_id: z.number(),
});
export const bulkDownloadPartsRequestBodySchema = z.object({
lineType: z
.union([
z.literal("OrderLine"),
z.literal("QuoteLine"),
z.literal("RequestForQuoteLine"),
])
.optional(),
partIds: z.array(z.number()),
});
export const bulkDownloadPartsResponseSchema = z.object({
jwt: z.string(),
url: z.string(),
}); |
Included in |
Thanks @fabien0102 |
|
Hi @Amorites, I didn’t get your last comment; this library is supported namespaces, don’t worry; you can see how this is processed inside the unit tests -> https://github.com/fabien0102/ts-to-zod/pull/44/files |
Thank you @fabien0102 I saw there is some content in this issue like:
Just a reminder that And I have created an issue #102 about the current implementation. |
Feature description
We currently auto-generate TypeScript interfaces from openapi specs. The result of this looks something like this:
Input
Output
1. Via
namespace
Would probably ease implementation, but is deprecated (we only use namespaces to group types, not really for actual runtime code)
2. Via Prefixing
3. Via
object
sPersonally, I’d prefer the prefixing approach as it doesn’t use the quasi-deprecated
namespace
feature and as the object-based approach is proabably nearly impossible to tree-shake and thus would drastically increase bundle sizes for big APIs. The one in question defines 1584 interfaces with most of them being a lot more complex than this example, so it would make a noticeable difference...The text was updated successfully, but these errors were encountered: