Skip to content

Commit 569788a

Browse files
authored
All container properties must be optional (elastic#1140)
1 parent 3925c38 commit 569788a

File tree

6 files changed

+28
-15
lines changed

6 files changed

+28
-15
lines changed

compiler/model/build-model.ts

+7
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,13 @@ function compileClassOrInterfaceDeclaration (declaration: ClassDeclaration | Int
416416
'Class and interfaces can only have property declarations or signatures'
417417
)
418418
const property = modelProperty(member)
419+
if (type.variants?.kind === 'container' && property.containerProperty == null) {
420+
assert(
421+
member,
422+
!property.required,
423+
'All @variants container properties must be optional'
424+
)
425+
}
419426
type.properties.push(property)
420427
}
421428

output/schema/schema.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/validation-errors.json

+9-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/transform/_types/Transform.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export class PivotGroupByContainer {
8282
*/
8383
export class RetentionPolicyContainer {
8484
/** Specifies that the transform uses a time field to set the retention policy. */
85-
time: RetentionPolicy
85+
time?: RetentionPolicy
8686
}
8787

8888
export class RetentionPolicy {
@@ -154,7 +154,7 @@ export class Sync {}
154154
*/
155155
export class SyncContainer {
156156
/** Specifies that the transform uses a time field to synchronize the source and destination indices. */
157-
time: TimeSync
157+
time?: TimeSync
158158
}
159159

160160
export class TimeSync {

specification/watcher/_types/Trigger.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { ScheduleContainer, ScheduleTriggerEvent } from './Schedule'
2424
* @variants container
2525
*/
2626
export class TriggerContainer {
27-
schedule: ScheduleContainer
27+
schedule?: ScheduleContainer
2828
}
2929

3030
export class TriggerEvent {}
@@ -33,7 +33,7 @@ export class TriggerEvent {}
3333
* @variants container
3434
*/
3535
export class TriggerEventContainer {
36-
schedule: ScheduleTriggerEvent
36+
schedule?: ScheduleTriggerEvent
3737
}
3838

3939
export class TriggerEventResult {

0 commit comments

Comments
 (0)