Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added
ClassMetadata
models.getClassMetadata
.Motivation
In order to migrate
inversify
, several responsibilities are being moved frominversify
to@inversifyjs/core
. The first one is metadata management.Currently,
inversify
has this responsibility distributed among several modules, making hard figuring out what's expected to be stored as metadata:It's currently challenging to know what's the expected metadata associated to a type.
inversify
metadata internal data structures don't represent some edge cases (like the handling of lazy service identifiers).Several checks as enforcing no duplicated tags can be simplified with the right data structures.
Code can be decoupled from
reflect-metadata
, making it more maintainable.This decoupling would unlock the implementation of better metadata representations. This can result in reducing the operations and the amount of objects involved in the process of planning the instantiation of a service, something that would result in the simplification of the source code and boosting the performance of the library.
ClassMetadata
is proposed as a data structure that represents the metadata associated to a certain type. This data structure handles in an efficient way most of the operations involved in the planning process.Testability
Once this approach is discussed and validated, several tests must be included:
getClassMetadata
is consistent withinversify
'sMetadataReader
andTarget
.