Skip to content

Commit bbc3bbb

Browse files
committed
ignore additionalProperties when are declared as function
Signed-off-by: Antonio Mendoza Pérez <[email protected]>
1 parent 2dfb446 commit bbc3bbb

27 files changed

+78
-52
lines changed

Diff for: package-lock.json

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

Diff for: src/lib/definitions/callbackstate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class Callbackstate {
110110
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
111111
* @returns {Specification.Callbackstate} without deleted properties.
112112
*/
113-
normalize(): Callbackstate {
113+
normalize = (): Callbackstate => {
114114
const clone = new Callbackstate(this);
115115

116116
normalizeUsedForCompensationProperty(clone);
@@ -121,5 +121,5 @@ export class Callbackstate {
121121
setEndValueIfNoTransition(clone);
122122

123123
return clone;
124-
}
124+
};
125125
}

Diff for: src/lib/definitions/databasedswitch.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ export class Databasedswitch {
8484
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
8585
* @returns {Specification.Databasedswitch} without deleted properties.
8686
*/
87-
normalize(): Databasedswitch {
87+
normalize = (): Databasedswitch => {
8888
const clone = new Databasedswitch(this);
8989

9090
normalizeUsedForCompensationProperty(clone);
9191
normalizeOnErrorsProperty(clone);
9292
normalizeDataConditionsProperty(clone);
9393

9494
return clone;
95-
}
95+
};
9696
}

Diff for: src/lib/definitions/defaultdef.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ export class Defaultdef /* Default definition. Can be either a transition or end
3939
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
4040
* @returns {Specification.Defaultdef} without deleted properties.
4141
*/
42-
normalize(): Defaultdef {
42+
normalize = (): Defaultdef => {
4343
const clone = new Defaultdef(this);
4444

4545
normalizeEndProperty(clone);
4646
normalizeTransitionProperty(clone);
4747
setEndValueIfNoTransition(clone);
4848

4949
return clone;
50-
}
50+
};
5151
}

Diff for: src/lib/definitions/delaystate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class Delaystate {
9393
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
9494
* @returns {Specification.Delaystate} without deleted properties.
9595
*/
96-
normalize(): Delaystate {
96+
normalize = (): Delaystate => {
9797
const clone = new Delaystate(this);
9898

9999
normalizeUsedForCompensationProperty(clone);
@@ -102,5 +102,5 @@ export class Delaystate {
102102
normalizeTransitionProperty(clone);
103103
setEndValueIfNoTransition(clone);
104104
return clone;
105-
}
105+
};
106106
}

Diff for: src/lib/definitions/end.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ export class End {
4545
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
4646
* @returns {Specification.End} without deleted properties.
4747
*/
48-
normalize(): End {
48+
normalize = (): End => {
4949
const clone = new End(this);
5050

5151
normalizeCompensateProperty(clone);
5252
normalizeTerminateProperty(clone);
5353

5454
return clone;
55-
}
55+
};
5656
}

Diff for: src/lib/definitions/enddatacondition.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export class Enddatacondition {
4444
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
4545
* @returns {Specification.Enddatacondition} without deleted properties.
4646
*/
47-
normalize(): Enddatacondition {
47+
normalize = (): Enddatacondition => {
4848
const clone = new Enddatacondition(this);
4949

5050
normalizeEndProperty(clone);
5151

5252
return clone;
53-
}
53+
};
5454
}

Diff for: src/lib/definitions/enddeventcondition.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ export class Enddeventcondition {
5656
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
5757
* @returns {Specification.Enddeventcondition} without deleted properties.
5858
*/
59-
normalize(): Enddeventcondition {
59+
normalize = (): Enddeventcondition => {
6060
const clone = new Enddeventcondition(this);
6161

6262
normalizeEndProperty(clone);
6363

6464
return clone;
65-
}
65+
};
6666
}

Diff for: src/lib/definitions/error.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class Error {
5151
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
5252
* @returns {Specification.Error} without deleted properties.
5353
*/
54-
normalize(): Error {
54+
normalize = (): Error => {
5555
const clone = new Error(this);
5656

5757
normalizeEndProperty(clone);
@@ -60,5 +60,5 @@ export class Error {
6060
setEndValueIfNoTransition(clone);
6161

6262
return clone;
63-
}
63+
};
6464
}

Diff for: src/lib/definitions/eventbasedswitch.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ export class Eventbasedswitch {
9191
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
9292
* @returns {Specification.Eventbasedswitch} without deleted properties.
9393
*/
94-
normalize(): Eventbasedswitch {
94+
normalize = (): Eventbasedswitch => {
9595
const clone = new Eventbasedswitch(this);
9696

9797
normalizeUsedForCompensationProperty(clone);
9898
normalizeOnErrorsProperty(clone);
9999
normalizeEventConditionsProperty(clone);
100100

101101
return clone;
102-
}
102+
};
103103
}

Diff for: src/lib/definitions/eventdef.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ export class Eventdef {
5858
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
5959
* @returns {Specification.Eventdef} without deleted properties.
6060
*/
61-
normalize(): Eventdef {
61+
normalize = (): Eventdef => {
6262
const clone = new Eventdef(this);
6363

6464
normalizeKindProperty(clone);
6565

6666
return clone;
67-
}
67+
};
6868
}

Diff for: src/lib/definitions/eventstate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class Eventstate /* This state is used to wait for events from event sour
8989
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
9090
* @returns {Specification.Eventstate} without deleted properties.
9191
*/
92-
normalize(): Eventstate {
92+
normalize = (): Eventstate => {
9393
const clone = new Eventstate(this);
9494

9595
normalizeExclusiveProperty(clone);
@@ -100,5 +100,5 @@ export class Eventstate /* This state is used to wait for events from event sour
100100
setEndValueIfNoTransition(clone);
101101

102102
return clone;
103-
}
103+
};
104104
}

Diff for: src/lib/definitions/exectimeout.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ export class Exectimeout {
3939
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
4040
* @returns {Specification.Exectimeout} without deleted properties.
4141
*/
42-
normalize(): Exectimeout {
42+
normalize = (): Exectimeout => {
4343
const clone = new Exectimeout(this);
4444

4545
normalizeInterruptProperty(clone);
4646

4747
return clone;
48-
}
48+
};
4949
}

Diff for: src/lib/definitions/foreachstate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class Foreachstate {
113113
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
114114
* @returns {Specification.Foreachstate} without deleted properties.
115115
*/
116-
normalize(): Foreachstate {
116+
normalize = (): Foreachstate => {
117117
const clone = new Foreachstate(this);
118118

119119
normalizeUsedForCompensationProperty(clone);
@@ -123,5 +123,5 @@ export class Foreachstate {
123123
setEndValueIfNoTransition(clone);
124124

125125
return clone;
126-
}
126+
};
127127
}

Diff for: src/lib/definitions/function.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,12 @@ export class Function {
4040
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
4141
* @returns {Specification.Function} without deleted properties.
4242
*/
43-
normalize(): Function {
43+
44+
normalize = (): Function => {
4445
const clone = new Function(this);
4546

4647
normalizeTypeRestProperty(clone);
4748

4849
return clone;
49-
}
50+
};
5051
}

Diff for: src/lib/definitions/injectstate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class Injectstate {
8484
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
8585
* @returns {Specification.Injectstate} without deleted properties.
8686
*/
87-
normalize(): Injectstate {
87+
normalize = (): Injectstate => {
8888
const clone = new Injectstate(this);
8989

9090
normalizeUsedForCompensationProperty(clone);
@@ -94,5 +94,5 @@ export class Injectstate {
9494
setEndValueIfNoTransition(clone);
9595

9696
return clone;
97-
}
97+
};
9898
}

Diff for: src/lib/definitions/onevents.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ export class Onevents {
4848
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
4949
* @returns {Specification.Onevents} without deleted properties.
5050
*/
51-
normalize(): Onevents {
51+
normalize = (): Onevents => {
5252
const clone = new Onevents(this);
5353

5454
normalizeActionModeParallelProperty(clone);
5555

5656
return clone;
57-
}
57+
};
5858
}

Diff for: src/lib/definitions/operationstate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class Operationstate {
102102
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
103103
* @returns {Specification.Operationstate} without deleted properties.
104104
*/
105-
normalize(): Operationstate {
105+
normalize = (): Operationstate => {
106106
const clone = new Operationstate(this);
107107

108108
normalizeActionModeSequentialProperty(clone);
@@ -113,5 +113,5 @@ export class Operationstate {
113113
setEndValueIfNoTransition(clone);
114114

115115
return clone;
116-
}
116+
};
117117
}

Diff for: src/lib/definitions/parallelstate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class Parallelstate {
106106
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
107107
* @returns {Specification.Parallelstate} without deleted properties.
108108
*/
109-
normalize(): Parallelstate {
109+
normalize = (): Parallelstate => {
110110
const clone = new Parallelstate(this);
111111

112112
normalizeCompletionTypeProperty(clone);
@@ -118,5 +118,5 @@ export class Parallelstate {
118118
setEndValueIfNoTransition(clone);
119119

120120
return clone;
121-
}
121+
};
122122
}

Diff for: src/lib/definitions/repeat.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ export class Repeat {
5151
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
5252
* @returns {Specification.Repeat} without deleted properties.
5353
*/
54-
normalize(): Repeat {
54+
normalize = (): Repeat => {
5555
const clone = new Repeat(this);
5656

5757
normalizeContinueOnErrorProperty(clone);
5858
normalizeCheckBeforeProperty(clone);
5959

6060
return clone;
61-
}
61+
};
6262
}

Diff for: src/lib/definitions/subflowstate.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class Subflowstate {
105105
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
106106
* @returns {Specification.Subflowstate} without deleted properties.
107107
*/
108-
normalize(): Subflowstate {
108+
normalize = (): Subflowstate => {
109109
const clone = new Subflowstate(this);
110110

111111
normalizeUsedForCompensationProperty(clone);
@@ -120,5 +120,5 @@ export class Subflowstate {
120120
setEndValueIfNoTransition(clone);
121121

122122
return clone;
123-
}
123+
};
124124
}

Diff for: src/lib/definitions/transition.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export class Transition {
4444
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
4545
* @returns {Specification.Transition} without deleted properties.
4646
*/
47-
normalize(): Transition {
47+
normalize = (): Transition => {
4848
const clone = new Transition(this);
4949

5050
normalizeCompensateProperty(clone);
5151

5252
return clone;
53-
}
53+
};
5454
}

Diff for: src/lib/definitions/transitiondatacondition.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ export class Transitiondatacondition {
4444
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
4545
* @returns {Specification.Transitiondatacondition} without deleted properties.
4646
*/
47-
normalize(): Transitiondatacondition {
47+
normalize = (): Transitiondatacondition => {
4848
const clone = new Transitiondatacondition(this);
4949

5050
normalizeTransitionProperty(clone);
5151

5252
return clone;
53-
}
53+
};
5454
}

Diff for: src/lib/definitions/transitioneventcondition.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ export class Transitioneventcondition {
5555
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
5656
* @returns {Specification.Transitioneventcondition} without deleted properties.
5757
*/
58-
normalize(): Transitioneventcondition {
58+
normalize = (): Transitioneventcondition => {
5959
const clone = new Transitioneventcondition(this);
6060

6161
normalizeTransitionProperty(clone);
6262

6363
return clone;
64-
}
64+
};
6565
}

Diff for: src/lib/definitions/workflow.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export class Workflow {
9898
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
9999
* @returns {Specification.Workflow} without deleted properties.
100100
*/
101-
normalize(): Workflow {
101+
normalize = (): Workflow => {
102102
const clone = new Workflow(this);
103103
normalizeKeepActiveProperty(clone);
104104

@@ -111,7 +111,7 @@ export class Workflow {
111111

112112
normalizeExecTimeout(clone);
113113
return clone;
114-
}
114+
};
115115

116116
/**
117117
* Parses the provided string as Workflow
@@ -144,6 +144,6 @@ export class Workflow {
144144
*/
145145
static toYaml(workflow: Workflow): string {
146146
validate('Workflow', workflow);
147-
return yaml.dump(workflow.normalize());
147+
return yaml.dump(JSON.parse(JSON.stringify(workflow.normalize())));
148148
}
149149
}

Diff for: src/lib/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const validate = (typeName: string, data: any): boolean => {
1111
const validateFn: ValidateFunction | undefined = validators.get(typeName);
1212
// TODO: ignore validation if no validator or throw ?
1313
if (!validateFn) return data;
14-
if (!validateFn(data)) {
14+
if (!validateFn(JSON.parse(JSON.stringify(data)))) {
1515
console.warn(validateFn.errors);
1616
const firstError: DefinedError = (validateFn.errors as DefinedError[])[0];
1717
throw new Error(

0 commit comments

Comments
 (0)