modelina icon indicating copy to clipboard operation
modelina copied to clipboard

feat: add jsonbinpack preset

Open jonaslagoni opened this issue 3 years ago • 1 comments

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:

  1. 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.
  2. 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

jonaslagoni avatar Aug 10 '22 16:08 jonaslagoni

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Aug 10 '22 17:08 sonarqubecloud[bot]

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);
 * 
 */

jonaslagoni avatar Sep 15 '22 11:09 jonaslagoni

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Sep 15 '22 15:09 sonarqubecloud[bot]

/rtm

Samridhi-98 avatar Sep 16 '22 11:09 Samridhi-98

:tada: This PR is included in version 1.0.0-next.7 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

asyncapi-bot avatar Sep 16 '22 11:09 asyncapi-bot