Is this feature request related to a new or existing Amplify category?
No response
Is this related to another service?
No response
Describe the feature you'd like to request
In Gen1, customers can override the built-in api resources by running amplify override api. This creates an overrides.ts file where customers can override resource properties using the CDK. For example
import { AmplifyApiGraphQlResourceStackTemplate, AmplifyProjectInfo } from '@aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyApiGraphQlResourceStackTemplate, amplifyProjectInfo: AmplifyProjectInfo) {
resources.api.GraphQLAPI.queryDepthLimit = 5;
}
Our code-generation should take this override.ts file into account and produce the equivalent Gen2 code.
Describe the solution you'd like
Ideally, we would transform the override.ts to look like this:
export function override(backend: Backend<any>, amplifyProjectInfo: { envName: string, projectName: string }) {
(backend.data.resources.graphqlApi.node.defaultChild as CfnGraphQLApi).queryDepthLimit = 5;
}
And then invoke this function from backend.ts:
import { override as overrideApi } from './api/override.ts`
const branchName = process.env.AWS_BRANCH ?? 'sandbox';
const backend = defineBackend({
...,
data,
});
overrideApi(backend, { envName: branchName, projectName: '<hard-code-project-name>' });
Describe alternatives you've considered
None
Additional context
|
export interface AmplifyApiGraphQlResourceStackTemplate { |
|
// directives stack |
|
api?: Partial<AppsyncApiStack>; |
|
models?: Partial<Record<string, ModelDirectiveStack>>; |
|
opensearch?: Partial<OpenSearchDirectiveStack & AppsyncStackCommon>; |
|
predictions?: Partial<PredictionsDirectiveStack & AppsyncStackCommon>; |
|
} |
Note that its also possible to override REST APIs:
|
export type AmplifyApiRestResourceStackTemplate = { |
|
restApi: apigwCdk.CfnRestApi; |
|
deploymentResource: apigwCdk.CfnDeployment; |
|
policies?: { |
|
[pathName: string]: ApigwPathPolicy; |
|
}; |
|
} & AmplifyCDKL1; |
Is this something that you'd be interested in working on?
Would this feature include a breaking change?
Is this feature request related to a new or existing Amplify category?
No response
Is this related to another service?
No response
Describe the feature you'd like to request
In Gen1, customers can override the built-in api resources by running
amplify override api. This creates anoverrides.tsfile where customers can override resource properties using the CDK. For exampleOur code-generation should take this
override.tsfile into account and produce the equivalent Gen2 code.Describe the solution you'd like
Ideally, we would transform the
override.tsto look like this:And then invoke this function from
backend.ts:Describe alternatives you've considered
None
Additional context
amplify-cli/packages/amplify-cli-extensibility-helper/src/types/api/amplify-api-resource-stack-types.ts
Lines 16 to 22 in 664dabc
Note that its also possible to override REST APIs:
amplify-cli/packages/amplify-cli-extensibility-helper/src/types/api/types.ts
Lines 20 to 26 in 664dabc
Is this something that you'd be interested in working on?
Would this feature include a breaking change?