-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Fix unnamed sub-schemas not being able to be normalized properly
- Loading branch information
Showing
4 changed files
with
138 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,7 +110,7 @@ EnumMap.setMethod(function set(name, value) { | |
* | ||
* @author Jelle De Loecker <[email protected]> | ||
* @since 1.2.1 | ||
* @version 1.3.6 | ||
* @version 1.4.0 | ||
* | ||
* @param {WeakMap} wm | ||
* | ||
|
@@ -136,26 +136,29 @@ EnumMap.setMethod(function toHawkejs(wm) { | |
cloned_entry.type = 'function'; | ||
} | ||
|
||
// Always add the `schema` property if it's there | ||
if (val.schema) { | ||
cloned_entry.schema = JSON.clone(val.schema, 'toHawkejs', wm); | ||
} | ||
|
||
let key, | ||
let field_key, | ||
field_val; | ||
|
||
for (key in val) { | ||
// Now we need to look for other `Schema`-like instances | ||
// and add those too | ||
for (field_key in val) { | ||
|
||
if (key == 'schema') { | ||
if (field_key == 'schema') { | ||
continue; | ||
} | ||
|
||
field_val = val[key]; | ||
field_val = val[field_key]; | ||
|
||
if (field_val) { | ||
const SchemaClass = Blast.isBrowser ? Classes.Alchemy.Client.Schema : Classes.Alchemy.Schema; | ||
|
||
if (field_val instanceof SchemaClass) { | ||
cloned_entry[key] = JSON.clone(field_val, 'toHawkejs', wm); | ||
cloned_entry[field_key] = JSON.clone(field_val, 'toHawkejs', wm); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters