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

Put schemas in their own module for namespacing #121

Closed
david-crespo opened this issue Jun 29, 2022 · 1 comment
Closed

Put schemas in their own module for namespacing #121

david-crespo opened this issue Jun 29, 2022 · 1 comment

Comments

@david-crespo
Copy link
Collaborator

Several times we've run into situations where our constructed name for a type (e.g., PascalCase(method name) + "Params") conflicts with an actual named type in the API. We have worked around this by renaming things in the API and that continues to be a fine strategy, but we could completely eliminate this problem by putting the real structs from Nexus in one namespace and our made-up ones in another.

TypeScript has explicit namespace concept, but it's considered a bit old-school. The more idiomatic way of namespacing things is putting them in their own module and importing that module. However, this has the downside of turning our very convenient single-file generated client into multiple files. And it seems namespaces are not going away. So the simplest thing is probably to use namespace.

@zephraph
Copy link
Contributor

I'd prefer we not use namespaces. In the eventual future of publishing the SDK to NPM whether it's a single file or multiple files is a bit moot. Better we provide clarity of scope and consistent patterns than use something fairly out of date that folks would likely be unfamiliar with.

@david-crespo david-crespo closed this as not planned Won't fix, can't repro, duplicate, stale Jul 17, 2023
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