You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 29c336e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(dts-generator): trust source data for event parameter optionality
Previously, all properties in generated $Xxx$YyyEventParameters interfaces
were unconditionally forced to optional (?), regardless of their actual
"optional" value in the api.json source data.
Now the generator respects each parameter's optional field by default:
- optional: false → required (no ?)
- optional: true or undefined → optional (?)
For events whose parameter optionality has not yet been verified in the
OpenUI5/SAPUI5 sources, a new "eventsWithAllParamsOptional" directive
(string[] in .dtsgenrc) preserves the legacy all-optional behavior.
Format: "fully.qualified.ClassName:eventName"
Changes:
- generate-from-objects.ts: Add eventsWithAllParamsOptional to Directives.
- generate.ts: Initialize the new directive field.
- json-fixer.ts: Pass directives to addEventParameterInterfaces(). Add
"events" to mapLikeProperties so .dtsgenrc overlays can target individual
events by name.
- json-event-parameter-interfaces.ts: Invert buildProperties() to respect
source data by default; only force all-optional when the event is in the
eventsWithAllParamsOptional deny-list. Log a warning when a parameter
has no "optional" value (unexpected edge case).
- Regenerated snapshot .d.ts files (parameters with optional: false now
appear as required).
Needed for #529
Event parameter interfaces now reflect actual optionality from the UI5 source data. Previously all event parameters were unconditionally generated as optional (`?`); now parameters marked `optional: false` in the API are generated as required. A new `eventsWithAllParamsOptional` directive in `.dtsgenrc` lets you preserve the legacy all-optional behavior for specific events whose optionality hasn't been verified upstream yet.
consthasParameters=Object.keys(allParameters).length>0;// remember because elements from allParameters are removed below; if true, then at least somesuperclass has parameters
280
297
281
298
// search superclasses for same event
@@ -320,7 +337,15 @@ function createEventParameterInterfaces(
0 commit comments