Where to put shared GraphQL type definitions

hello,
I have some shared gql types and enums that are used across multiple .sdl.ts files. They don’t really belong to any model but are common definitions like

  input PagingContext {
    skip: Int!
    take: Int!
  }

I tried CLI yarn redwood g sdl common but seems like you can only do so on a model. Is there any recommendation?

Thank you

I think the best is to create a new sdl file manually

Thanks @dthyresson . So any sdl file under api/src/graphql will be automatically picked up and built? There no need to create a backing service file for this type and enum only sdl?

Yep, I do this for things like connections and identity functions in this example.

Any SDL files get scooped up and converted into a single schema, conceptually this is the same with all of the service files - the filenames themselves are largely for your convenience

1 Like