Grammar refactoring

* Grammar refactoring WIP

* ISerializer.grammar

* Fixing various bugs in the grammar

* Small touch that improoves performance

* Fix unknown values grammar

* Various fixes

* Serialization refactoring to drop suboject logic

* Details fixed

* Entity attributes initialization refactoring

* JSDoc error fixed

* Rename value key to default

* Remove useless default

* Revert string keys
This commit is contained in:
barsdeveloper
2023-04-01 19:55:16 +02:00
committed by GitHub
parent b235d63348
commit bb24486303
44 changed files with 6395 additions and 6248 deletions

View File

@@ -6,59 +6,65 @@ import SimpleObject from "./SimpleObject"
export default class ComplexEntity extends IEntity {
static attributes = {
alpha: 32,
alpha: {
default: 32,
},
bravo: {
type: Number,
value: 78,
default: 78,
},
charlie: {
type: String,
value: "Charlie",
default: "Charlie",
},
delta: {
type: String,
value: null,
default: null,
},
echo: {
default: "echo",
},
echo: "echo",
foxtrot: {
value: false,
default: false,
},
golf: {
type: Array,
},
hotel: {
type: Array,
value: null,
default: null,
},
india: {
type: [Number]
type: [Number],
},
juliett: {
type: [String],
value: ["a", "b", "c", "d", "e"],
default: ["a", "b", "c", "d", "e"],
},
kilo: {
type: [Boolean],
value: () => [true, false, false, true, true],
default: () => [true, false, false, true, true],
},
lima: {
type: String,
value: "Foo",
default: "Foo",
showDefault: false,
},
mike: {
type: new UnionType(Number, String, Array),
value: "Bar",
default: "Bar",
},
november: {
type: new UnionType(Number, String, Array),
},
oscar: {
type: SimpleObject
type: SimpleObject,
},
papa: {
default: () => new SimpleObject(12, 13),
},
papa: () => new SimpleObject(12, 13),
quebec: {
value: 0, // will assign undefined because it does not satisfy the predicate
default: 0, // will assign undefined because it does not satisfy the predicate
predicate: v => v >= 1 && v <= 10,
},
}