Giter Site home page Giter Site logo

pubkey / jsonschema-key-compression Goto Github PK

View Code? Open in Web Editor NEW
94.0 3.0 8.0 254 KB

Compress json-data based on its json-schema while still having valid json

License: Apache License 2.0

TypeScript 100.00%
json nosql compression json-schema jsonschema

jsonschema-key-compression's Introduction

jsonschema-key-compression's People

Contributors

pubkey avatar renovate-bot avatar renovate[bot] avatar seanwu1105 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jsonschema-key-compression's Issues

Further compaction

Have you considered making the encoding even more efficient by omitted key names for required fields, altogether?

e.g.

{
    "firstName": "Corrine",
    "lastName": "Ziemann",
    "title": "Ms.",
    "gender": "f",
    "zipCode": 75963,
    "countryCode": "en",
    "birthYear": 1960,
    "active": false,
    "shoppingCartItems": [
        {
            "productNumber": 29857,
            "amount": 1
        },
        {
            "productNumber": 53409,
            "amount": 6
        }
    ]
}

could become

["Corrine", "Ziemann", "Mrs.", false, [
        [29857, 1],
        [53409, 6]
    ],{
    "gender": "f",
    "zipCode": 75963,
    "countryCode": "en",
    "birthYear": 1960
}
]

Assuming that gender, zipCode, etc. are optional and the other fields are marked as required.

It seems like this could reduce the file size quite significantly.

Also you could consider applying the compression of graphql-crunch, which re-uses prior values if they are repeated.

Dependency Dashboard

This issue provides visibility into Renovate updates and their statuses. Learn more

This repository currently has no open or pending branches.


  • Check this box to trigger a request for Renovate to run again on this repository

Build error when migrating from Rollup 1.x to 2.x (via StencilJS, RxDB)

Hey!

We are consuming [email protected] in a StencilJS app.

When building with @stencil/[email protected] (which uses [email protected]), the app builds without an issue.

If I bump the StencilJS dependency to >=@stencil/[email protected] (which uses >= [email protected]) the build fails with the following error:

[ ERROR ]  Rollup: Parse Error: ./node_modules/jsonschema-key-compression/src/compress.ts:12:9
           Unexpected token (Note that you need plugins to import files that are not JavaScript)

     L11:  export function compressObject(
     L12:      table: CompressionTable,
     L13:      obj: PlainJsonObject

If I then manually add the @rollup/plugin-typescript to the rollup build plugins, the build error changes, and is now:

[ ERROR ]  Rollup: Plugin Error
           Could not load
           /{REDACTED}/app/node_modules/jsonschema-key-compression/src/index.ts
           (imported by ./node_modules/rxdb/dist/es/plugins/key-compression.js): Debug Failure. False expression:
           Expected fileName to be present in command line (plugin: typescript, load)

stencil/[email protected] uses [email protected], whereas stencil/[email protected] and greater use [email protected] and I can see there a failed Renovate PR build bumping to [email protected] (#107). This may also have build step implications?

GH comparison for StencilJS versions, at the point at which the build starts to fail: ionic-team/stencil@v1.13.0...v1.14.0

There's a barebones repo highlighting the issue here: https://github.com/chrisweight/jsonschema-build-failure

You can comment out the typescript() plugin in stencil.config.ts to see the first error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.