Coder Social home page Coder Social logo

Globally extend connections? about pothos HOT 7 CLOSED

hayes avatar hayes commented on July 17, 2024
Globally extend connections?

from pothos.

Comments (7)

hayes avatar hayes commented on July 17, 2024 1

I'll try to find some time to work on this next week

from pothos.

hayes avatar hayes commented on July 17, 2024 1

Building a schema requires all types to be defined using the same builder instance, but you can split that actual definitions into multiple files.

There are some tips on ways you can structure your app in https://giraphql.com/guide/app-layout

For concrete examples there are example apps in the test directory for each package you could look at (only a few of these split things I to many files). Eg https://github.com/hayes/giraphql/tree/main/packages/core/tests/examples/giraffes

For questions, I don't currently have a discord, for now I would recommend https://github.com/hayes/giraphql/discussions

from pothos.

hayes avatar hayes commented on July 17, 2024

Unfortunately there isn't a great way to do this right now. It should be pretty easy to add though. I think to support this I would need to add 2 things: a way to add fields to all connection objects, and a way to extend the type for connections so that a connection resolver can be expected to return objects with additional properties.

from pothos.

litewarp avatar litewarp commented on July 17, 2024

Thanks! I appreciate the quick response.

On a somewhat related topic (I can open a separate PR if you wish), is there an example or documentation of splitting up the builder across multiple files. I can only get the schema to load when all my builder calls come from an instance initialized in the same file. Or a discord where I could ask questions?

from pothos.

litewarp avatar litewarp commented on July 17, 2024

Thanks! The example helped. The difference was importing the entirety of the file instead of just exports -- ie,

import "./person"

NOT import * from './person'

from pothos.

hayes avatar hayes commented on July 17, 2024

PR: https://github.com/hayes/giraphql/pull/68/files

from pothos.

hayes avatar hayes commented on July 17, 2024

published as

  • @giraphql/deno => 2.3.0
  • @giraphql/plugin-dataloader => 2.2.3
  • @giraphql/plugin-relay => 2.3.0

docs: https://giraphql.com/plugins/relay#extending-all-connections

from pothos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.