-
Notifications
You must be signed in to change notification settings - Fork 78
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
Selection Set returns single instance of option CustomType array #2809
Comments
Just to elaborate on what I was expecting vs what is happening in each scenario:
|
Hi @MKlaeui we were not able to reproduce the issue described. We tried each scenario listed but the type from It seems that your |
Thanks for looking into this. Data Schema is version 1.3.10 Just want to reiterate that my problem is specific to Selection Set. The Schema is as I expect (for verbiage: a.ref('Verbiage').required().array()): const v: Schema['Customer']['type']['verbiage'] ; // v = verbiage[] | null | undefined But using the Selection Set I get: const { data: customerSet } = await client.models.Customer.list({ const abc = customerSet[0].verbiage; // abc = verbiage | null |
@MKlaeui thank you for reiterating that the issue was with selection set! I had forgotten that was specifically mentioned the first time I tried to reproduce this issue. Using selection set, I definitely see the problem and was able to reproduce consistently even on the latest versions of with this schema: const schema = a.schema({
AlphabetEnum: a.enum(["A", "B", "C", "D"]),
Verbiage: a.customType({
name: a.ref("AlphabetEnum").required(),
paragraphs: a.string().required().array().required(),
}),
Customer: a
.model({
id: a.id().required(),
name: a.string().required(),
verbiage: a.ref("Verbiage").required().array(),
})
.authorization((allow) => [allow.publicApiKey()]),
}); I see The type should be If I change the type of verbiage: a.ref("Verbiage").required().array().required(), Then I see the correct type of I will mark this as a bug for the team to look into further |
Environment information
Data packages
Description
Selection Set of an optional array of custom types returns unexpected values. Taking the sample app listed here: [(https://github.com//issues/2368)] , if you replace the line
verbiage: a.ref('Verbiage').required().array().required(),
withverbiage: a.ref('Verbiage').array().required(),
, then the result will be(Verbiage | null)[]
. If you replace it withverbiage: a.ref('Verbiage').required().array(),
then you get(Verbiage | null)
. I'm looking for something that returns(Verbiage[] | null)
. Is that not how it was meant to work?The text was updated successfully, but these errors were encountered: