Reputation: 5661
I am having some issues working out the best strategy for managing generated graphql files. The problem that I am having is we have a dev ops pipeline that uses docker to build two containers, with one container building the schema based on the first.
The two containers are a Hasura database and an express server (in Typescript).
The express server uses the hasura database to generate a schema and using this type check the queries/mutations.
To manage the generated schema I have tried the following solutions.
My instinct is that solution 1 is correct. My docker knowledge is very limited, so is there a correct way to implement this using docker? Or are one of the other solutions a better fit? For now the team has implemented solution 3.
Any tips of help is greatly appreciated!
Upvotes: 0
Views: 192
Reputation: 2892
I would go with option #3. Committing generated code into a source repository is not always discouraged, and is sometimes the proper course of action. Consider dependency lockfiles (package-lock.json
, yarn.lock
), for instance.
The generated schema represents a snapshot at the time of development which is the contract that your application expects. I would not want this to be generated at CI time, because it must be known when developing your application client code that depends on the schema anyway. Updating the schema ought to be a conscious decision made while developing your application, and not left to happenstance during your CI/CD pipeline.
Upvotes: 1