-
Notifications
You must be signed in to change notification settings - Fork 9
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
Support Optional Elements #39
Comments
Hi @itworksafisher, I would also want to support optional elements, however it's a bit more complex as this requires a refactoring on the Delivery SDK part to allow optional elements. This refactoring is all the more complicated because of I'm planning on looking into this in upcoming months, but I can't promise anything as of yet. I'll keep this issue open for now. |
I agree with @Enngage.
Perhaps we could leverage the |
You could possibly do this
But that would make both |
Motivation
Currently, all content element properties are generated like they are required, i.e. that they will always have a value, yet kontent.ai allows you to mark whether a content element is required or not. Non required properties should be optional in the model.
Proposed solution
myElement: Type
for required elements andmyElement?: Type
for optional elements.Additional Comments
This is likely a breaking change for consumers, especially those running strict Typescript because they will now have to write code to handle checking whether optional properties have a value or not.
This could potentially be offset by adding a CLI flag for supporting optional elements so this feature is opt in.
The text was updated successfully, but these errors were encountered: