The constructors for classes in module api have the following problem:
they have all optional fields, and accept a desc parameter of the
corresponding interface type from shapes -- but the shapes types
have required fields, so you can't supply a value constructed from an
api class.
Assuming the intention is to let people call constructors with plain
objects, like this:
The constructors for classes in module api have the following problem: they have all optional fields, and accept a
desc
parameter of the corresponding interface type fromshapes
-- but theshapes
types have required fields, so you can't supply a value constructed from an api class.Assuming the intention is to let people call constructors with plain objects, like this:
.. then there's no need for interfaces, since the class is the correct type already. So:
make constructors accept the type itself, rather than the shapes interface.
give the api classes required and optional fields per their swagger definition, rather than making all the fields optional.
make the
desc
argument (supplying all the fields) mandatory, so that you must supply the required fields.