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

fix: added @default schema validations #2541

Merged
merged 2 commits into from May 16, 2024
Merged

Conversation

bzsurbhi
Copy link
Contributor

@bzsurbhi bzsurbhi commented May 9, 2024

Description of changes

Adde schema validations for

  • @default directive

    • The @default directive may only be added to object definitions annotated with @model
    • The @default directive may only be added to scalar or enum field types
    • The @default directive only takes a value property
    • String cannot represent a non string value: the @default directive has a non String value
  • ownerField should be of type String

CDK / CloudFormation Parameters Changed

N/A

Description of how you validated changes

Checklist

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@bzsurbhi bzsurbhi requested a review from a team as a code owner May 9, 2024 18:29
type Inicio
@model
@auth(
rules: [{ allow: owner, operations: [create, delete, update, read], provider: userPools, ownerField: "autores", groups: ["MeuCPD"] }]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you intentionally added groups for owner rule? Are there any validations in transformers to stop this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, one of our customers had this schema. So just used the same schema for our test. The validation on our end only checks for ownerField type
I'm not sure if any validations exists on the data side to stop this.

sundersc
sundersc previously approved these changes May 15, 2024
phani-srikar
phani-srikar previously approved these changes May 15, 2024
@bzsurbhi bzsurbhi dismissed stale reviews from phani-srikar and sundersc via cfc8f8d May 15, 2024 18:55
@phani-srikar phani-srikar merged commit 26ad761 into aws-amplify:main May 16, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants