Open at0mat opened 5 years ago
As of writing the input document(s) are expected to be a full schema. It would be possible to allow referencing generated types but this would need time for design and implementation. In the meantime, copying the type definitions into your own schema is likely the best solution. Marking this as a feature request.
I have been trying to solve this problem myself. Copying the generated schema over is constantly causing me problems. Has this since been resolved in any way?
Any better solution yet?
I ran into this today too creating a custom mutation that wants to reference a generated input type to be used as a nested field as I want to create a composite action that does two actions in one operation.
Copying generated input types is really not a good solution (even if the only workaround currently) as they can very easily get out of sync, plus it's not DRY obviously.
Also this issue is tagged with graphql-transformer-v1
but we're using the v2 transformer, and the issue is also present there for us.
Which Category is your question related to? API
What AWS Services are you utilizing? AppSync, DynamoDB, Elastic Search, Cognito
Provide additional details e.g. code snippets In schema.graphql :
input SearchableAddressSortInput, type ModelAddressConnection along with enums SearchableSortDirection, SearchableAddressSortableFields have been manually copied from the codegen created build directory copy of the schema as a workaround.
If I don't copy the type definitions, when running amplify push I receive:
Type "SearchableAddressSortableFields" not found in document.
Is there a way to make custom query resources without having to duplicate these auto generated input, type, enum statements?