Skip to content

Nodejs Projects: support for code-first schemas #3295

Closed

Description

@sipsma

Same as Go but now in TS.

It's worth looking to see if any existing framework can be leveraged (similar to Python+Strawberry) rather than a custom thing like what was needed in Go.

Also need to think about plain JS. Since it lacks types it's less clear what form this could/should take (maybe it just isn't supported for now, schema.graphql can remain a fallback for these cases, or perhaps schema strings could be embedded in code rather than a separate file, etc.).

Activity

  1. sipsma commented on Oct 13, 2022

    @sipsma
    ContributorAuthor

    I did some very preliminary experimentation with this the other day (not functional at all, just half-written playing around code): sipsma@5ba6adc

    A few notes for whenever we come back to this:

    1. Use of the compiler API seemed like the best bet for achieving something with the same level of magic as the go code first schemas, example here: https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#using-the-type-checker
    2. Closest existing thing I could find (not exhaustive search) was this: https://github.com/cevek/ts2graphql
      • Didn't want to totally re-use, but useful to get an idea

    Take above with grain of salt.

    Also, that foray made me realize that another option for JS would be to use @decorators and only save the real low-boilerplate magic for typescript.

  2. added
    area/engine
    and removed on Dec 5, 2022
  3. added and removed
    area/engine
    on Dec 6, 2022
  4. dolanor commented on Dec 13, 2022

    @dolanor
    Contributor

    It has been done with Go codegen package.

  5. changed the title [-]Typescript: support for code-first schemas[/-] [+]Nodejs Extensions: support for code-first schemas[/+] on Dec 13, 2022
  6. sipsma commented on Dec 13, 2022

    @sipsma
    ContributorAuthor

    It has been done with Go codegen package.

    This issue is meant for extensions, specifically the ability to take source code and derive a schema from it. Clarified the title now, reopening

  7. reopened this on Dec 13, 2022
  8. changed the title [-]Nodejs Extensions: support for code-first schemas[/-] [+]Nodejs Projects: support for code-first schemas[/+] on May 17, 2023
  9. sipsma commented on Apr 2, 2024

    @sipsma
    ContributorAuthor

    Modules implementation has support for typescript

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