Skip to content
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

Nested default value are not supported #454

Open
ubiqart opened this issue Dec 19, 2023 · 5 comments
Open

Nested default value are not supported #454

ubiqart opened this issue Dec 19, 2023 · 5 comments
Labels

Comments

@ubiqart
Copy link

ubiqart commented Dec 19, 2023

Environment information

System:
    OS: macOS 13.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 229.59 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: Not Found
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: Not Found
    bun: Not Found
    Watchman: Not Found
  npmPackages:
    @aws-amplify/backend: ^0.6.0 => 0.6.0 
    @aws-amplify/backend-cli: ^0.9.1 => 0.9.1 
    aws-amplify: ^6.0.5 => 6.0.5 
    aws-cdk: Not Found
    aws-cdk-lib: ^2.110.1 => 2.110.1 
    typescript: ^5.3.2 => 5.3.2

Description

Nested Enum types are not supported

const schema = a.schema({
Prompt: a.customType({
text: a.string().required(),
weight: a.integer().required()
}),
Configuration: a.customType({
cfg_scale: a.integer().default(7),
...

error TS2322: Type 'ModelField<Nullable, "default", undefined>' is not assignable to type 'ModelField<ModelFieldTypeParamOuter, CustomTypeAllowedModifiers, any>'.
Property 'default' is missing in type 'Omit<{ required(): ModelField<number, "required" | "default", undefined>; array(): ModelField<Nullable[] | null, "array" | "default", undefined>; default(value: ModelFieldTypeParamOuter): ModelField<...>; authorization<AuthRuleType extends Authorization<...>>(rules: AuthRuleType[]): ModelField<...>; }, "defa...' but required in type 'Omit<{ required(): ModelField<string | number | boolean | object | any[] | Date | ModelFieldTypeParamInner[], CustomTypeAllowedModifiers, undefined>; array(): ModelField<...>; default(value: ModelFieldTypeParamOuter): ModelField<...>; authorization<AuthRuleType extends Authorization<...>>(rules: AuthRuleType[]): Mod...'.

@edwardfoyle edwardfoyle transferred this issue from aws-amplify/amplify-backend Dec 19, 2023
@AnilMaktala AnilMaktala self-assigned this Dec 20, 2023
@AnilMaktala
Copy link
Member

Hey @ubiqart, Thank you for raising this. We've managed to replicate the issue, so we're categorizing it as a bug for the team to investigate further.

image

@AnilMaktala AnilMaktala added bug Something isn't working and removed pending-triage labels Dec 20, 2023
@renebrandel
Copy link
Collaborator

@AnilMaktala - can we verify if this behavior exists in Gen 1

@renebrandel
Copy link
Collaborator

i.e.

type CustomType {
   test: Int @default(value: "1")
}

@AnilMaktala
Copy link
Member

This feature is not supported in Gen1.

image

@arundna arundna added feature-request New feature or request and removed bug Something isn't working labels Feb 9, 2024
@renebrandel
Copy link
Collaborator

Given this isn't supported in Gen 1, we'll deprioritize for now. We should still do this feature in the future. Just want us to prioritize feature parity with Gen 1 first.

@stocaaro stocaaro transferred this issue from aws-amplify/amplify-category-api Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants