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

chore(TestModels): Add constraints inside list, map and union #485

Draft
wants to merge 13 commits into
base: main-1.x
Choose a base branch
from

Conversation

rishav-karanjit
Copy link

@rishav-karanjit rishav-karanjit commented Jul 23, 2024

Issue #, if available:

Description of changes:
This PR adds constraints inside list (ListWithConstraint), map (MapWithConstraint) and union (UnionWithConstraint) in the test model.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@rishav-karanjit rishav-karanjit changed the title PR to test codegen for constraints inside list, union and map constraints inside list, union and map Jul 25, 2024
@rishav-karanjit rishav-karanjit changed the title constraints inside list, union and map chore: constraints inside list, union and map Jul 25, 2024
@rishav-karanjit rishav-karanjit changed the title chore: constraints inside list, union and map chore(TestModels): constraints inside list, union and map Jul 25, 2024
@rishav-karanjit rishav-karanjit changed the title chore(TestModels): constraints inside list, union and map chore(TestModels): Add constraints inside list, map and union Jul 25, 2024
@@ -96,6 +96,11 @@ list ListLessThanOrEqualToTen {
member: String
}

@length(min: 1, max: 10)
list ListWithConstraint {
member: MyString
Copy link
Author

@rishav-karanjit rishav-karanjit Aug 12, 2024

Choose a reason for hiding this comment

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

Self commenting a note posterity:
MyString has constraint @length(min: 1, max: 10)

Other aggregate shapes that was added also has similar constraint

@alex-chew
Copy link
Contributor

It would be good to also add a constraint within multiple levels of structures, to ensure that we're not only validating input structures. For example

structure GetConstraintsInput {
  ... // existing members omitted for brevity
  inner: InnerStructure,
}

structure InnerStructure {
  str: NonEmptyString,
}

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.

2 participants