fix: do not crash for invalid parameter.in value

closes #1340
This commit is contained in:
Roman Hotsiy 2020-08-19 13:15:47 +03:00
parent 7e7d95fe18
commit addf8956e3
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0

View File

@ -84,11 +84,11 @@ export class FieldModel {
} else if (info.style) { } else if (info.style) {
this.style = info.style; this.style = info.style;
} else if (this.in) { } else if (this.in) {
this.style = DEFAULT_SERIALIZATION[this.in].style; this.style = DEFAULT_SERIALIZATION[this.in]?.style ?? 'form'; // fallback to from in case "in" is invalid
} }
if (info.explode === undefined && this.in) { if (info.explode === undefined && this.in) {
this.explode = DEFAULT_SERIALIZATION[this.in].explode; this.explode = DEFAULT_SERIALIZATION[this.in]?.explode ?? true;
} else { } else {
this.explode = !!info.explode; this.explode = !!info.explode;
} }