Closed dmitrizagidulin closed 7 years ago
I disagree. RP uses JSON Document as a dependency which already depends on JSON Patch as well as the Initializer and Validator classes. The Initializer and Validator are currently being reworked to account for $ref
and will soon depend on JSON Pointer, which is what it was originally intended for when it was included in this library. None of these can be separated out for the reason of saving bandwidth or because of lib size.
This leaves JSON Mapping. JSON Mapping already depends on JSON Pointer and if it were separated out into an external lib, would incur the same cost that you are talking about here by requiring JSON Document just for JSON Pointer. (Disclaimer: This --- admittedly --- would be different if all of the above mentioned classes were in their own libs but see above)
These could be separated out but the result of it is it would be unlikely to provide much of a benefit in terms of bandwidth usage (best case: 3.21 kB, worst case: 0 B) and would incur significant difficulty in working with them.
At the very least I would suggest that the decision for the libs to be separated or not be deferred until JSON Document is stable.
I see, ok. I mean, obviously if we're using them, then the argument falls away.
The reason I brought up this issue, is that currently, we're not actually using either JSON Mapping or JSON Patch in RP or JSON Doc. Which is why I figured it's safe to factor them out.
If you guys are refactoring json doc to actually use them, then that's a different story.
All sorted then. Closing the issue.
If we move
JSONPatch.js
,JSONPointer.js
andJSONMapping.js
to an external lib, we will save about 15.5 kb of lib size (this is before minifying, but still). They're being packaged up in every RP bundle, but aren't used. Example output of awebpack
command foroidc-rp
: