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

Disallow union of code in BaseErrorSchema #262

Merged
merged 1 commit into from
Aug 26, 2024

Conversation

masad-frost
Copy link
Member

@masad-frost masad-frost commented Aug 24, 2024

Why

Currently we allow a union of error objects and those objects can have a union of codes. For consistency, especially to simplify codegen, let's just expect a union of objects.

What changed

image unionofcode
image unionoferror

Versioning

  • Breaking protocol change
  • Breaking ts/js API change

@masad-frost
Copy link
Member Author

masad-frost commented Aug 24, 2024

Current dependencies on/for this PR:

This comment was autogenerated by Freephite.

@masad-frost masad-frost marked this pull request as ready for review August 24, 2024 01:42
@masad-frost masad-frost requested a review from a team as a code owner August 24, 2024 01:42
@masad-frost masad-frost requested review from bradymadden97 and removed request for a team August 24, 2024 01:42
message: TLiteralString | TString;
}>
| TObject<{
code: TLiteralString | TUnion<Array<TLiteralString>>;
code: TLiteralString;
Copy link
Contributor

Choose a reason for hiding this comment

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

is there an advantage of having this be a union of two types that only differ by an optional extras?

this is giving me "corporate wants you to find the differences between these two pictures" vibes.

Copy link
Member Author

@masad-frost masad-frost Aug 24, 2024

Choose a reason for hiding this comment

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

Honestly we haven't used extras anywhere, maybe a YAGNI and we should get rid of it for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

But to answer your question, yes this is necessary. You can't express optional schema fields

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@lhchavez lhchavez left a comment

Choose a reason for hiding this comment

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

also, is this the new meta?

no-more-drake-react-the-new-wave-is-not-like-us-react-v0-l7a7ridqlqad1

@bradymadden97 bradymadden97 removed their request for review August 26, 2024 04:11
Base automatically changed from 08-23-Use_snapshot_testing_for_schema_serialization to main August 26, 2024 17:22
@masad-frost masad-frost force-pushed the 08-23-Disallow_union_of_code_in_BaseErrorSchema branch from a7a5d5a to b8a4f66 Compare August 26, 2024 17:32
@masad-frost masad-frost merged commit bf6dd54 into main Aug 26, 2024
6 checks passed
@masad-frost masad-frost deleted the 08-23-Disallow_union_of_code_in_BaseErrorSchema branch August 26, 2024 22:19
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