-
Notifications
You must be signed in to change notification settings - Fork 657
Description
What is your use-case and why do you need this feature?
When generating a schema from descriptors, or working with the descriptor tree in other ways (like my particular use-case: generating a UI form based on it), it would be nice to be able to access the default values of elements.
The biggest reason across all of these use-cases is documenting default values, e.g. in a schema or openAPI spec.
Describe the solution you'd like
A SerialDescriptor.getElementDefaultValue(index: Int): Any?
or : (() -> Any?)?
method that gets the default value if there is one or null if not, and a SerialDescriptor.elementHasDefaultValue(index: Int): Boolean
method. The second one may be redundant with isElementOptional
- I don't know whether the semantics are a 100% match.