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

Define schemas in a separate package #604

Closed
rrousselGit opened this issue Jul 24, 2024 · 4 comments · Fixed by #606
Closed

Define schemas in a separate package #604

rrousselGit opened this issue Jul 24, 2024 · 4 comments · Fixed by #606
Assignees
Labels
enhancement New feature or request

Comments

@rrousselGit
Copy link

Hello!

For the sake of sharing code between backend and frontend, I'd like to define my schema files outside of the package that uses ferry_generator.

Would it be possible to support in the build.yaml a schema that comes from a different package?

@knaeckeKami knaeckeKami self-assigned this Jul 24, 2024
@knaeckeKami knaeckeKami added the enhancement New feature or request label Jul 24, 2024
@knaeckeKami
Copy link
Collaborator

knaeckeKami commented Jul 24, 2024

Hi!

Just for clarification:

You want to be able to do something like

  • have a separate package that contains the graphql schema
  • a separate fronted and backend package, which both depend on the schema package, but contain their own graphql operations

Is this correct?

I'll look into supporting this, should be quite easy, unless there is an unexpected issue with built_value serialization

@rrousselGit
Copy link
Author

That is correct, yes.

@knaeckeKami
Copy link
Collaborator

knaeckeKami commented Jul 26, 2024

a draft PR is available at #606.

still needs a cleanup and tests, but you can already try it out by using

ferry_generator:
   git:
     url: https://github.com/gql-dart/ferry.git
     path: packages/ferry_generator
     ref: external_schema_import 

replace the reference to the schema in build.yaml from

          schema: <current_package>|lib/schema/schema.graphql

to

          schema: <external_dep_packaage>|lib/schema/schema.graphql

@knaeckeKami
Copy link
Collaborator

this was released in ferry_generator 0.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants