Co-authored-by: Jason Kuhrt <jasonkuhrt@me.com>
COMPLETES INITIAL DEVELOPMENT
BREAKING CHANGE:
You will now need to install Nexus Schema from the npm package `nexus` instead of `@nexus/schema`.
BREAKING CHANGES:
- `contextType` is no longer nested in `typegenAutoConfig`
- `contextType` can no longer references `sources` registered in `typegenAutoConfig`
- `contextType` API was refactored to use `module` instead of `path` and `export` instead of `name`
- `rootTyping` API was refactored to use `module` instead of `path` and `export` instead of `name`
- Renames `EnumTypeConfig` -> `NexusEnumTypeConfig` for consistency
- Adds `.asArg` on `enumType`, since these are often defined inline for one-off field args
- Fixes types so `default` type is properly inferred, eases types elsewhere so valid types which haven't been added to the manifest do not show as type errors
- Fixes SDL conversion
- Defer wrapping until types are built
- Supports GraphQL types anywhere that a type can be used, wrapped, etc.
- Split out the wrapping, w/ `finalizeWrapping` helper which adds in the `NonNull` to the list as needed
- Make `nonNull(nonNull(T))` & `nullable(nullable(T))` no-op for simplicity
- Change: `nullable(nonNull(T))` will undo the `nonNull`
- Properly type-check's `subscriptionType` by passing `Event` generic properly
- Adds `declarativeWrappingPlugin` for previous `nullable` / `list` behavior
Co-authored-by: Flavian DESVERNE <flavian.desverne@epitech.eu>
Adds `t.modify` API for modifying inherited types.
Use cases:
- If you have an `interface` type, but want to override the resolver or description for the field per-`objectType`
- If an inherited field's value is abstract, and you want to narrow it to a subtype which conforms to the inherited type
- If you want to add additional optional arguments for an inherited field, as is permitted by the spec
The types should validate that only fields inherited from interfaces can be modified, and the `type` can only be
changed if the result of that field is an abstract type which implements the existing inherited return type.
This PR removes the `nullable: boolean` and `list: boolean | boolean[]` API and replaces it with top-level type wrappers named: `list()`, `nonNull()` and `nullable()`
BREAKING CHANGES:
- `isTypeOf` is now the _default_ strategy to discriminate members of an abstract type. To keep using `resolveType` as you might have been before, enable the following config in `makeSchema`:
```ts
makeSchema({
features: {
abstractTypeStrategies: {
resolveType: true
}
}
})
```
closes#582
As discussed. In most cases resolver shorthands are not a serious use of the API.
BREAKING CHANGE:
Resolver shorthand API is now removed. The following will now not typecheck:
```ts
t.string('foo', () => ... )
```
Instead use:
```ts
t.string('foo', { resolve: () => ... })
```
Runtime support is still intact but will result in a logged warning. Runtime support will be removed in the next Nexus release.
fixes#402fixes#450
Fixes:
- Global connection field extensions were never executed
- Typings of global connection field extension (root, args and the resolver return type was wrong)
- Typings of local connection field extension (everything was any)
closes#410
BREAKING CHANGE:
The graphql peer dep requirement has been bumped to v15.
No graphql v15 exclusive features have been shipped yet. But this update
sets us up to begin that work.
Support for graphql v14 and lower has been dropped. It may technically work
still (the test suite did not show any major reasons why it won't, for
now/currently) but there is no guarantee about that remaining so in the
future. Internally we are only testing against v15. Certain new grpahqljs
v15 features like interfaces being able to implement other interfaces will
be released in the future.
If you absolutely cannot upgrade from graphql v14 right now then stay with
@nexus/schema v15. But if you also really need a new @nexus/schema feature
on v16+ (future) then you can try your luck with it an older version of
graphqljs.
* Update CI config to test examples
* Fix star wars example
* Update yarn.lock of nexus-prisma example
* Fix kitchen-sink example
* Update nexus to beta9 in star wars example
* Upgrade nexus in ts-ast-reader example
* Fix ghost example
* Fix githunt-api example
* Make githunt-api test pass
* Fix nexus-prisma example
* Fix typing in ts-ast-reader
* Use yarn link when nexus deps is already 0.12.0-beta.9
* Remove yarn link from example_ghost
* Make sure generated files are up to date