Open harshit9715 opened 5 months ago
I can see the documentation allows all 3 types of IDs.
currently it uses uuid as default and there is no override option.
we can provide a global config or translation behaviour option to provide an option to select an enum from one of uuid / ksuid and ulid?
I was able to override it for my specific use case.
const graphApi = new AmplifyGraphqlApi(stack, "GraphqlApi", { definition: AmplifyGraphqlDefinition.fromFiles( "stacks/amplify-schema.graphql" ), apiName: "GraphqlApi", translationBehavior: {}, transformerPlugins: [], functionSlots: [ "createQuestionTags", "createQuestion", "createTag", "createUser", "createAnswer", ].map((fieldName) => ({ fieldName: fieldName, function: { requestMappingTemplate: MappingTemplate.fromString(`## [Start] Request mapping template. ## get the "fieldName" from ctx.stash and add it as a prefix to id.. make sure to replace 'create' word with '' $util.qr($ctx.stash.defaultValues.put("id", "$util.autoUlid()")) ## [End] Initialization default values. ** {}`), }, slotIndex: 0, slotName: "init", typeName: "Mutation", })), authorizationModes: { apiKeyConfig: { expires: Duration.days(365), description: "API Key for GraphQL API - " + stack.stage, }, defaultAuthorizationMode: "OPENID_CONNECT", oidcConfig: { oidcIssuerUrl: process.env.CLERK_ISSUER_BASE_URL!, oidcProviderName: "Clerk", tokenExpiryFromAuth: Duration.millis(0), tokenExpiryFromIssue: Duration.millis(0), }, }, });
it does require a management overhead. to keep that array of models updated.
No response
Hey @harshit9715, Thank you for requesting this. We are marking this as a feature request for the team to evaluate further.
Describe the feature you'd like to request
I can see the documentation allows all 3 types of IDs.
currently it uses uuid as default and there is no override option.
Describe the solution you'd like
we can provide a global config or translation behaviour option to provide an option to select an enum from one of uuid / ksuid and ulid?
Describe alternatives you've considered
I was able to override it for my specific use case.
it does require a management overhead. to keep that array of models updated.
Additional context
No response
Is this something that you'd be interested in working on?
Would this feature include a breaking change?