Skip to content

Put schemas in their own module for namespacing #121

Closed as not planned
Closed as not planned

Description

@david-crespo

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.

Activity

  1. just-be-dev commented on Jul 13, 2022

    @just-be-dev
    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions