cdevents / sdk-java

Java SDK for CDEvents
Apache License 2.0
5 stars 6 forks source link

No validation on constructing objects that have required fields #65

Open xibz opened 8 months ago

xibz commented 8 months ago

If a field is required, then we should enforce it in the constructor or when calling build (if we have a builder).

https://github.com/cdevents/sdk-java/blob/5d17b750fda57fd4a9d7ad2c5baec2bb4b9e2143/sdk/src/main/java/dev/cdevents/models/build/started/Subject.java#L23-L29

But no validation

aalmiray commented 6 months ago

I believe the jsonschema2pojo plugin has a setting for generating a constructor for all required fields. Be mindful that adding such constructor and removing the default one constitutes a breaking change.

cc: @afrittoli @rjalander