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

Added support for NSSet properties #91

Merged
merged 6 commits into from
Nov 3, 2017

Conversation

rmls
Copy link
Contributor

@rmls rmls commented Oct 23, 2017

Taking #70 as inspiration for how to spec it, this PR takes into consideration the unique key that can be defined for array properties. Is set, instead of creating a NSArray, it will create a NSSet instead.

Example:

some_prop: {
  type: "array",
  unique: true
}

@ghost
Copy link

ghost commented Oct 23, 2017

🚫 CI failed with log

@ghost
Copy link

ghost commented Oct 24, 2017

🚫 CI failed with log

@@ -100,6 +102,15 @@ - (instancetype)initWithModelDictionary:(NS_VALID_UNTIL_END_OF_SCOPE NSDictionar
}
}
{
__unsafe_unretained id value = modelDictionary[@"contributors"]; // Collection will retain.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't this need to be converted to NSSet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I just added it.

NSMutableSet *result0 = [NSMutableSet setWithCapacity:items0.count];
for (id obj0 in items0) {
if (obj0 != (id)kCFNull) {
[result0 addObject:[obj0 dictionaryRepresentation]];
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we're going to have to add a cast here to avoid hitting warnings for strict selector matching. Added an issue here #90

+counts: ?{ +[string]: number } /* Integer */,
+created_at: ?PlankDate,
+contributors: ?Set<UserType>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

@maicki - Can you sign off on the flow changes?


export type BoardType = $Shape<{|
+name: ?string,
+id: ?string,
+image: ?ImageType,
+image: ImageType,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did this change? Seems not related to this change though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maicki I don't know exactly. This was all generated code.

Copy link
Contributor

@maicki maicki left a comment

Choose a reason for hiding this comment

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

Flow looks good to me

@ghost
Copy link

ghost commented Nov 2, 2017

1 Warning
⚠️ Any source code changes should have an entry in CHANGELOG.md or have #trivial in their title.

Generated by 🚫 Danger

@maicki
Copy link
Contributor

maicki commented Nov 3, 2017

@rahul-malik LGTM merge whenever

@rahul-malik rahul-malik merged commit d480449 into pinterest:master Nov 3, 2017
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.

3 participants