ts-proto icon indicating copy to clipboard operation
ts-proto copied to clipboard

feat: support deprecatedOnly option to make deprecated fields optional

Open tufandevrim opened this issue 1 year ago • 2 comments

Add deprecatedOnly option for useOptionals option to make only deprecated fields optional. This PR aims to address the issue https://github.com/stephenh/ts-proto/issues/993

tufandevrim avatar Feb 28 '24 06:02 tufandevrim

@stephenh thoughts on this PR appreciated. I figured deprecatedOnly in useOptionals config is practical solution but we could also have this as separate option.

Right now in our codebase, we don't use useOptional config which forces developers to set the fields if it is marked as "required" (without optional). Even though we rarely depreciate required fields in our schemas, it is very annoying that we must still set deprecated required fields!

tufandevrim avatar Mar 05 '24 23:03 tufandevrim

Hi @tufandevrim this seems pretty reasonable, see the one question about repeateds, but otherwise this lgtm!

stephenh avatar Mar 06 '24 15:03 stephenh

Hi @tufandevrim this seems pretty reasonable, see the one question about repeateds, but otherwise this lgtm!

@stephenh yeah that was great feedback and made sense. Just updated the code to make deprecated repeated fields optional. Thanks again

tufandevrim avatar Mar 23 '24 07:03 tufandevrim

@tufandevrim looks like a minor prettier error in main.ts; can you fix it up? Thanks!

stephenh avatar Mar 24 '24 20:03 stephenh

@tufandevrim looks like a minor prettier error in main.ts; can you fix it up? Thanks!

Oops! fixed now!

tufandevrim avatar Mar 25 '24 16:03 tufandevrim

Sweet, thanks @tufandevrim !

stephenh avatar Mar 26 '24 04:03 stephenh

:tada: This PR is included in version 1.170.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

stephenh avatar Mar 26 '24 04:03 stephenh