temporalio / proposals

Temporal proposals
https://temporal.io
MIT License
69 stars 18 forks source link

Typed search attributes in SDK #74

Closed cretz closed 1 year ago

cretz commented 1 year ago

Rendered (until merged): https://github.com/cretz/temporal-proposals/blob/sdk-typed-search-attributes.md/sdk-typed-search-attributes.md

Basically just tried to come up with a non-breaking way to add typed, single-value search attributes to our SDKs.

cretz commented 1 year ago

I'm wondering why you prefer splitting the proposal into 2 different phases with distinct APIs. We typically like to have a single way to do things in our SDKs and this proposal goes against that principle.

I need an API for accessing multiple and an optional API for accessing single. Those are two separate things, not two ways of the same thing. I can remove the one for accessing single if needed (which we may need to do anyways if we want to prepare for accepting errors as a result of failed upsert inside workflow).

bergundy commented 1 year ago

I'm wondering why you prefer splitting the proposal into 2 different phases with distinct APIs. We typically like to have a single way to do things in our SDKs and this proposal goes against that principle.

I need an API for accessing multiple and an optional API for accessing single. Those are two separate things, not two ways of the same thing. I can remove the one for accessing single if needed (which we may need to do anyways if we want to prepare for accepting errors as a result of failed upsert inside workflow).

That's not what I meant, you have a "" and " later" mentioned here, which are 2 completely separate API approaches. I'd rather figure out a single long term solution that we're happy with now and avoid introducing multiple ways to access search attributes.

cretz commented 1 year ago

I'd rather figure out a single long term solution that we're happy with now and avoid introducing multiple ways to access search attributes.

I don't think you can avoid multiple ways of accessing unless we can decide how to do multi-access and single-access at the same time. I have some ideas, let me make an addendum to this proposal for discussion.

cretz commented 1 year ago

I have added a second solution that retains the ability to get/set/upsert search attributes as a whole with a new "search attributes" collection in each language that relies on user-defined keys and restricts types. As expected, the devil is in the backwards compatibility details.

cretz commented 1 year ago

After some team discussion we have decided a typed search attribute collection with typed key definitions makes the most sense. I will be closing this PR (but leaving branch around for a bit) and making a new PR/branch with these updates. We have also decided to focus on a single language at first, so we chose Java since its challenges represent the other languages' challenges reasonably well.

cretz commented 1 year ago

Closing in favor of #75