-
Notifications
You must be signed in to change notification settings - Fork 245
Primitive data types should not be optionals #250
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
Comments
Hi, you can also use I think this is close to your needs. It satisfies point (2) - properties are optional by default, for point (3) you can use So only point (1) doesn't work automatically as you wanted but on the other hand it is consistent with Jackson2 library which also considers properties of primitive types as optional by default. #183 contains more information about this parameter. What do you think? |
You're mostly right. Jackson2 is a good starting point. However Jackson(2) can be configured globally, while the typescript-generator only considers the annotations of the current class. Jackson has a |
I didn't think about global configuration. That's true that currently To achieve this functionality (primitive types as required property) I would use some existing mechanism in Jackson rather than adding new option. I tried to use |
Nevermind, I found a working solution. Using a extension using |
Your PR is now merged and released, closing the issue. |
Hi,
we're currently using
OptionalProperties.all
which isn't ideal for all cases. To be more specific:int getNumber()
should not be optionalInteger getNumber()
should be by default optionalIf you want I can make a PR for that. I'd add an additional annotation
OptionalProperties.default
, which could easily cover the first two cases. For the last case we could either use theoptionalAnnotations
setting for the non-optional annotations, or create a new onenonOptionalAnnotations
.The text was updated successfully, but these errors were encountered: