Skip to content

Conversation

@cwaldren-ld
Copy link
Contributor

@cwaldren-ld cwaldren-ld commented Jul 18, 2023

Previously, context kind was an std::string.

The requirement that it not be an empty string was enforced by parent data model deserializers.

Now, we have a dedicated type-safe wrapper viaBOOST_STRONG_TYPEDEF. The custom tag_invoke enforces the invariant so it's not possible to deserialize it inconsistently.

@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #209882: Make newtype for Kind in SDK data model.


namespace launchdarkly::data_model {

BOOST_STRONG_TYPEDEF(std::string, ContextKind);
Copy link
Contributor Author

@cwaldren-ld cwaldren-ld Jul 18, 2023

Choose a reason for hiding this comment

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

It's nice that this exists, but it doesn't support move construction. I'll not worry about that until it proves worrisome (at which point we could roll our own macro easily.)

Copy link
Member

Choose a reason for hiding this comment

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

I suppose I could have used this in place of my tag types for flags/segments.

@cwaldren-ld cwaldren-ld marked this pull request as ready for review July 18, 2023 22:24
@cwaldren-ld cwaldren-ld requested review from a team and kinyoklion July 18, 2023 22:24
@cwaldren-ld cwaldren-ld merged commit 99dea86 into server-side Jul 18, 2023
@cwaldren-ld cwaldren-ld deleted the cw/sc-209882/kind-newtype branch July 18, 2023 23:15
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