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

best way to edit the generated graphql aws app sync schema in amplify v2? #2754

Open
cookiejest opened this issue Aug 8, 2024 · 6 comments
Labels
bug Something isn't working Gen 2 transferred

Comments

@cookiejest
Copy link

cookiejest commented Aug 8, 2024

Environment information

I need to add additional fields into a few of the generated graphql schema endpoints. Speicfically the 'owner' field. This is so I can use them in the backend to correctly sync data to the front end via graphql.

What is the best way to achieve this? I can make the edits directly in appsync console, but feel there should be a way to do this through amplify v2 that I can keep within my ci/cd pipeline.

Description

E.g I want to add a 'owner' field that have not been added automatically for some reason (I think they should be):

input CreateMessageInput {
	type: String
	message: String
	color: String
	runId: ID
	promptId: ID
	id: ID
	owner: String
}

This way i can use the graphql directly from my backend outside of amplify and have it stay in sync with the amplify v2 on the real time updates.

@cookiejest cookiejest changed the title best way to edit the generated graphql aws app sync schema? best way to edit the generated graphql aws app sync schema in amilify v2? Aug 8, 2024
@cookiejest cookiejest changed the title best way to edit the generated graphql aws app sync schema in amilify v2? best way to edit the generated graphql aws app sync schema in amplify v2? Aug 8, 2024
@ykethan
Copy link
Member

ykethan commented Aug 9, 2024

Hey👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance.

@ykethan ykethan transferred this issue from aws-amplify/amplify-backend Aug 9, 2024
@AnilMaktala AnilMaktala added the question Further information is requested label Aug 12, 2024
@AnilMaktala
Copy link
Member

Hey @cookiejest, Thanks for raising this. Could you please share your full schema?

@cookiejest
Copy link
Author

i think my problem is i did not include a owner field in the schema itself (I thought it would be auto populated but it was not). Once I added the field the owner the app sync was then correct with owner included.

  Message: a
    .model({
      type: a.string(),
      message: a.string(),
      color: a.string(),
      runId: a.id(),
      promptId: a.id(),
      owner: a.string(),
      run: a.belongsTo('Run', 'runId'),
      prompt: a.belongsTo('Prompt', 'promptId')
    })
    .authorization((allow) => [allow.owner()])

@AnilMaktala AnilMaktala self-assigned this Aug 14, 2024
@AnilMaktala
Copy link
Member

Hey @cookiejest, Thanks for clarifying. can you please provide the aws-amplify lib versions you are using in your app?

@cookiejest
Copy link
Author

"aws-amplify": "^6.4.3",
"@aws-amplify/backend": "^1.0.4",
"@aws-amplify/backend-cli": "^1.2.2",

@AnilMaktala
Copy link
Member

Hey @cookiejest, Thanks for additional information. We can reproduce the issue, Hence marking it as a bug for the team to evaluate further.

  Customer1: a
    .model({
      fullName: a.string(),
      email: a.email(),
      price: a.integer(),
      phone: a.phone(),
    })
    .authorization((allow) => [allow.owner()]),
image

@AnilMaktala AnilMaktala added bug Something isn't working and removed question Further information is requested pending-triage labels Aug 16, 2024
@AnilMaktala AnilMaktala removed their assignment Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Gen 2 transferred
Projects
None yet
Development

No branches or pull requests

3 participants