Align support for multiple operation-files and multiple schema-files (#137)

Multiple schema-files are now supported as of #134, but the support was
a bit different from how we did multiple operation-files.  Before anyone
starts to depend on the ways the syntaxes differ, let's just make them
the same.  Since it's easy, I also added support for having just a
single operations-file.

I also realized while writing this that the type-change is technically
breaking (if you call from Go), so documented it as such. I think
this is unlikely to affect many people.

Test plan: make check
This commit is contained in:
Ben Kraft
2021-10-05 12:52:48 -07:00
committed by GitHub
parent a52e55632f
commit 22019287da
8 changed files with 49 additions and 103 deletions
+3 -1
View File
@@ -22,10 +22,12 @@ When releasing a new version:
### Breaking changes:
- The `Config` fields `Schema` and `Operations` are now both of type `StringList`. This does not affect configuration via `genqlient.yaml`, only via the Go API.
### New features:
- genqlient now generates getter methods for all fields, even those which do not implement a genqlient-generated interface; this can be useful for callers who wish to define their own interface and have several unrelated genqlient types which have the same fields implement it.
- genqlient config now accepts either a single or multiple schema files for the `schema` field.
- genqlient config now accepts either a single or multiple files for the `schema` and `operations` fields (previously it accepted only one `schema`, and required a list of `operations` files).
- The `typename` option can now be used on basic types (string, int, etc) as well as structs; this can be useful to have genqlient define new types like `type Language string` and use that type for specified fields.
### Bug fixes:
+4 -2
View File
@@ -8,15 +8,17 @@
# schema:
# - user.graphql
# - ./schema/*.graphql
# - ./another_directory/**/*.graphqls
# - ./another_directory/*/*.graphql
schema: schema.graphql
# Filenames or globs with the operations for which to generate code, relative
# Filename(s) or globs with the operations for which to generate code, relative
# to genqlient.yaml.
#
# These may be .graphql files, containing the queries in SDL format, or
# Go files, in which case any string-literal starting with (optional
# whitespace and) the string "# @genqlient" will be extracted as a query.
#
# Like schema, this may be a single file or a list.
operations:
- genqlient.graphql
- "pkg/*.go"