modelina
modelina copied to clipboard
feat: add jsonbinpack preset
Description This PR adds jsonbinpack preset that enables you to convert your models into highly space-efficient binary. This is an alternative to just converting the models into JSON.
This preset does have contingencies:
- Since the original input does not contain metadata about it, it is assuming draft 7 as default. But it does have support for draft 4 and 6. And because AsyncAPI schema object is a draft 7 variant, that is supported as well.
- Once a JSON schema generator is supported - https://github.com/asyncapi/modelina/pull/666 - it might be worth within the preset to use that generator. That way any input would be able to still use this preset.
Blocked by https://github.com/asyncapi/modelina/pull/855
Leaving it here for later when implementing #612
/**
* Potential runtime test:
*
const instance = new Test({});
instance.email = '[email protected]';
const expectedJSON = JSON.parse(instance.marshal());
const jsonpackbuffer = await instance.jsonbinSerialize();
const test = await Test.jsonbinDeserialize(jsonpackbuffer);
const actualJson = JSON.parse(test.marshal());
expect(actualJson).toEqual(expectedJSON);
*
*/
/rtm
:tada: This PR is included in version 1.0.0-next.7 :tada:
The release is available on:
Your semantic-release bot :package::rocket:







