-
Notifications
You must be signed in to change notification settings - Fork 63
[codegen] graphql config - multiple extension outputs from a project #49
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
Comments
Alternative solution projects:
Workspaces:
schemaPath: src/graphql/Workspaces/schema.json
includes:
- src/graphql/Workspaces/**/*.ts
excludes:
- ./amplify/**
extensions:
amplify:
codeGenTarget: typescript
generatedFiles:
- src/utils/API.ts
- amplify/backend/API.ts
docsFilePaths:
- src/graphql/Workspaces
- amplify/backend/Workspaces
maxDepth: 2
extensions:
amplify:
version: 3 An argument made this though could be that you're restricted to one language output at this point. Your frontend is javascript, but your lambda function is python.. it's not going to like the typescript output. |
Hi @uncodable Thank you for taking time and requesting this feature. We are working on making the codegen configuration more flexible and customizable. Please look out for an RFC on this. |
Thanks for the update @phani-srikar it's a blocker at the moment on my current project 👍🏻 |
@uncodable just wanted to let you know that we've publish an RFC to address this and other code generation issues. Would love to have your feedback! aws-amplify/amplify-cli#6898 |
Any news when it will be ready? Some years already passed. |
@hackmajoris as a workaround i found this to be working perfectly fine (working only if you agree to generate all possible queries and types for some reason when you add/re-add projects:
functionsonsteroids:
schemaPath: amplify/backend/api/functionsonsteroids/build/schema.graphql
includes:
- src/graphql/**/*.graphql
excludes:
- ./amplify/**
extensions:
amplify:
codeGenTarget: angular
generatedFileName: src/app/API.service.ts
docsFilePath: src/graphql
region: eu-central-1
apiId: null
maxDepth: 2
lambdaShared:
schemaPath: amplify/backend/api/functionsonsteroids/build/schema.graphql
includes:
- projects/lambda-shared/src/lib/**/*.ts
excludes:
- ./amplify/**
extensions:
amplify:
codeGenTarget: typescript
generatedFileName: projects/lambda-shared/src/lib/generated/app-sync.models.ts
docsFilePath: projects/lambda-shared/src/lib/generated/
region: eu-central-1
apiId: null
maxDepth: 2
extensions:
amplify:
version: 3 |
Thank you. I have implemented the exact same approach and can confirm that it works fine. |
What is the easiest way to get |
Is your feature request related to a problem? Please describe.
I want to output typescript types to lambda functions as well as my frontend application also.
Describe the solution you'd like
The ability to have many extensions with the same key as
amplify
within the same project:Describe alternatives you've considered
Having a folder in the root directory to allow types to be read from there, however it's not easy and requires extra permissions and npm won't let you read outside the main dir it's being ran from. So this will be an issue for lambda functions.
The text was updated successfully, but these errors were encountered: