-
Notifications
You must be signed in to change notification settings - Fork 0
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
Custom types can't be referenced more than once #495
Comments
Hi @Erid , thanks for raising this issue and providing reproduction steps. Unfortunately, I have not been able to reproduce the behavior described in this issue. I tried deploying this schema: CustomType: a.customType({
id: a.string().required(),
name: a.string().required(),
}),
getSomething: a
.query()
.arguments({
arg1: a.string().required(),
})
.returns(a.ref("CustomType").required().array().required())
.handler(a.handler.function(getSomething))
.authorization((allow) => [allow.group("Admin")]),
getSomething2: a
.query()
.arguments({
arg1: a.string().required(),
})
.returns(a.ref("CustomType").required().array().required())
.handler(a.handler.function(getSomething))
.authorization((allow) => [allow.group("Admin")]), but was able to compile and deploy successfully. Can you confirm you are using the latest versions of the |
Thanks for the reply @chrisbonifacio, it's odd, I was positive that was enough to reproduce, but maybe I missed something. I'll try to reproduce by creating a new project and introduce parts of the schema bit by bit; since I can't share the company's code. And yes, I have version |
Hi @Erid, just wanted to follow up and see if you are still blocked on this issue. If you need more time to provide a reproducible app, totally understand! I did try downgrading to We also thought maybe the conflict in auth directives might've been caused by having the same auth rule on the schema level so I tried that but alas, the schema still compiled and deployed const schema = a
.schema({
CustomType: a.customType({
id: a.string().required(),
name: a.string().required(),
}),
getSomething: a
.query()
.arguments({
arg1: a.string().required(),
})
.returns(a.ref("CustomType").required().array().required())
.handler(a.handler.function(getSomething))
.authorization((allow) => [allow.group("Admin")]),
getSomething2: a
.query()
.arguments({
arg1: a.string().required(),
})
.returns(a.ref("CustomType").required().array().required())
.handler(a.handler.function(getSomething))
.authorization((allow) => [allow.group("Admin")]),
})
.authorization((allow) => [allow.group("Admin")]); |
Thanks for the follow up @chrisbonifacio! I need some more time to repro, it's still happening to me, I "worked around it" by duplicating the type for now; but this week I didn't have the time to create the app to repro and I'm away from my computer for a few days now. I'll have it for you next week! I need to find the root cause 😅 |
Before opening, please confirm:
JavaScript Framework
Not applicable
Amplify APIs
GraphQL API
Amplify Version
v6
Amplify Categories
api
Backend
Amplify Gen 2
Environment information
Describe the bug
When defining a custom type, if I try to reference it as the return type of a query, it works, however, if I do it on more than one query it throws an error.
Expected behavior
I would expect the Schema to let me reference the same custom type more than once.
Reproduction steps
The text was updated successfully, but these errors were encountered: