Skip to content

ignore additionalProperties when are declared as function #119

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib/definitions/callbackstate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class Callbackstate {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Callbackstate} without deleted properties.
*/
normalize(): Callbackstate {
normalize = (): Callbackstate => {
const clone = new Callbackstate(this);

normalizeUsedForCompensationProperty(clone);
Expand All @@ -120,5 +120,5 @@ export class Callbackstate {
setEndValueIfNoTransition(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/databasedswitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ export class Databasedswitch {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Databasedswitch} without deleted properties.
*/
normalize(): Databasedswitch {
normalize = (): Databasedswitch => {
const clone = new Databasedswitch(this);

normalizeUsedForCompensationProperty(clone);
normalizeOnErrorsProperty(clone);
normalizeDataConditionsProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/defaultdef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ export class Defaultdef /* Default definition. Can be either a transition or end
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Defaultdef} without deleted properties.
*/
normalize(): Defaultdef {
normalize = (): Defaultdef => {
const clone = new Defaultdef(this);

normalizeEndProperty(clone);
normalizeTransitionProperty(clone);
setEndValueIfNoTransition(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/delaystate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export class Delaystate {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Delaystate} without deleted properties.
*/
normalize(): Delaystate {
normalize = (): Delaystate => {
const clone = new Delaystate(this);

normalizeUsedForCompensationProperty(clone);
Expand All @@ -101,5 +101,5 @@ export class Delaystate {
normalizeTransitionProperty(clone);
setEndValueIfNoTransition(clone);
return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/end.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ export class End {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.End} without deleted properties.
*/
normalize(): End {
normalize = (): End => {
const clone = new End(this);

normalizeCompensateProperty(clone);
normalizeTerminateProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/enddatacondition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export class Enddatacondition {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Enddatacondition} without deleted properties.
*/
normalize(): Enddatacondition {
normalize = (): Enddatacondition => {
const clone = new Enddatacondition(this);

normalizeEndProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/enddeventcondition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ export class Enddeventcondition {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Enddeventcondition} without deleted properties.
*/
normalize(): Enddeventcondition {
normalize = (): Enddeventcondition => {
const clone = new Enddeventcondition(this);

normalizeEndProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class Error {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Error} without deleted properties.
*/
normalize(): Error {
normalize = (): Error => {
const clone = new Error(this);

normalizeEndProperty(clone);
Expand All @@ -59,5 +59,5 @@ export class Error {
setEndValueIfNoTransition(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/eventbasedswitch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ export class Eventbasedswitch {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Eventbasedswitch} without deleted properties.
*/
normalize(): Eventbasedswitch {
normalize = (): Eventbasedswitch => {
const clone = new Eventbasedswitch(this);

normalizeUsedForCompensationProperty(clone);
normalizeOnErrorsProperty(clone);
normalizeEventConditionsProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/eventdef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ export class Eventdef {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Eventdef} without deleted properties.
*/
normalize(): Eventdef {
normalize = (): Eventdef => {
const clone = new Eventdef(this);

normalizeKindProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/eventstate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class Eventstate /* This state is used to wait for events from event sour
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Eventstate} without deleted properties.
*/
normalize(): Eventstate {
normalize = (): Eventstate => {
const clone = new Eventstate(this);

normalizeExclusiveProperty(clone);
Expand All @@ -99,5 +99,5 @@ export class Eventstate /* This state is used to wait for events from event sour
setEndValueIfNoTransition(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/exectimeout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ export class Exectimeout {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Exectimeout} without deleted properties.
*/
normalize(): Exectimeout {
normalize = (): Exectimeout => {
const clone = new Exectimeout(this);

normalizeInterruptProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/foreachstate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export class Foreachstate {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Foreachstate} without deleted properties.
*/
normalize(): Foreachstate {
normalize = (): Foreachstate => {
const clone = new Foreachstate(this);

normalizeUsedForCompensationProperty(clone);
Expand All @@ -122,5 +122,5 @@ export class Foreachstate {
setEndValueIfNoTransition(clone);

return clone;
}
};
}
5 changes: 3 additions & 2 deletions src/lib/definitions/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ export class Function {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Function} without deleted properties.
*/
normalize(): Function {

normalize = (): Function => {
const clone = new Function(this);

normalizeTypeRestProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/injectstate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class Injectstate {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Injectstate} without deleted properties.
*/
normalize(): Injectstate {
normalize = (): Injectstate => {
const clone = new Injectstate(this);

normalizeUsedForCompensationProperty(clone);
Expand All @@ -93,5 +93,5 @@ export class Injectstate {
setEndValueIfNoTransition(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/onevents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export class Onevents {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Onevents} without deleted properties.
*/
normalize(): Onevents {
normalize = (): Onevents => {
const clone = new Onevents(this);

normalizeActionModeParallelProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/operationstate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class Operationstate {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Operationstate} without deleted properties.
*/
normalize(): Operationstate {
normalize = (): Operationstate => {
const clone = new Operationstate(this);

normalizeActionModeSequentialProperty(clone);
Expand All @@ -112,5 +112,5 @@ export class Operationstate {
setEndValueIfNoTransition(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/parallelstate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class Parallelstate {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Parallelstate} without deleted properties.
*/
normalize(): Parallelstate {
normalize = (): Parallelstate => {
const clone = new Parallelstate(this);

normalizeCompletionTypeProperty(clone);
Expand All @@ -117,5 +117,5 @@ export class Parallelstate {
setEndValueIfNoTransition(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/repeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ export class Repeat {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Repeat} without deleted properties.
*/
normalize(): Repeat {
normalize = (): Repeat => {
const clone = new Repeat(this);

normalizeContinueOnErrorProperty(clone);
normalizeCheckBeforeProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/subflowstate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class Subflowstate {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Subflowstate} without deleted properties.
*/
normalize(): Subflowstate {
normalize = (): Subflowstate => {
const clone = new Subflowstate(this);

normalizeUsedForCompensationProperty(clone);
Expand All @@ -119,5 +119,5 @@ export class Subflowstate {
setEndValueIfNoTransition(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export class Transition {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Transition} without deleted properties.
*/
normalize(): Transition {
normalize = (): Transition => {
const clone = new Transition(this);

normalizeCompensateProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/transitiondatacondition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ export class Transitiondatacondition {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Transitiondatacondition} without deleted properties.
*/
normalize(): Transitiondatacondition {
normalize = (): Transitiondatacondition => {
const clone = new Transitiondatacondition(this);

normalizeTransitionProperty(clone);

return clone;
}
};
}
4 changes: 2 additions & 2 deletions src/lib/definitions/transitioneventcondition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ export class Transitioneventcondition {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Transitioneventcondition} without deleted properties.
*/
normalize(): Transitioneventcondition {
normalize = (): Transitioneventcondition => {
const clone = new Transitioneventcondition(this);

normalizeTransitionProperty(clone);

return clone;
}
};
}
6 changes: 3 additions & 3 deletions src/lib/definitions/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class Workflow {
* Normalize the value of each property by recursively deleting properties whose value is equal to its default value. Does not modify the object state.
* @returns {Specification.Workflow} without deleted properties.
*/
normalize(): Workflow {
normalize = (): Workflow => {
const clone = new Workflow(this);
normalizeKeepActiveProperty(clone);

Expand All @@ -110,7 +110,7 @@ export class Workflow {

normalizeExecTimeout(clone);
return clone;
}
};

/**
* Parses the provided string as Workflow
Expand Down Expand Up @@ -143,6 +143,6 @@ export class Workflow {
*/
static toYaml(workflow: Workflow): string {
validate('Workflow', workflow);
return yaml.dump(workflow.normalize());
return yaml.dump(JSON.parse(JSON.stringify(workflow.normalize())));
}
}
2 changes: 1 addition & 1 deletion src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const validate = (typeName: string, data: any): boolean => {
throw Error(`Validate function not defined for type '${typeName}'`);
}

if (!validateFn(data)) {
if (!validateFn(JSON.parse(JSON.stringify(data)))) {
console.warn(validateFn.errors);
const firstError: DefinedError = (validateFn.errors as DefinedError[])[0];
throw new Error(
Expand Down
Loading