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

Add an IsRequired property to PropertyShape and ParameterShape attributes. #116

Open
eiriktsarpalis opened this issue Feb 8, 2025 · 4 comments

Comments

@eiriktsarpalis
Copy link
Owner

Users should be able to control the requiredness of individual properties or constructor parameters using attribute annotations. Today this can only be changed influenced using either the required keyword or by marking a constructor parameter as optional.

@AArnott
Copy link
Contributor

AArnott commented Feb 8, 2025

Today this can only be changed influenced using either the required keyword or by marking a constructor parameter as optional.

This seems sufficient to me. Are there cases where we want to diverge from these indicators?

@eiriktsarpalis
Copy link
Owner Author

I've received a lot of feedback from STJ users needing to decouple the contract of the type from the contract of serialization.

@AArnott
Copy link
Contributor

AArnott commented Feb 8, 2025

So the idea is a hard rejection of data during deserialization if it omits a property that is marked as required this attribute?

@eiriktsarpalis
Copy link
Owner Author

Correct, although this still needs to be implemented at the individual converter layer.

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

No branches or pull requests

2 participants