Skip to content

Latest commit

 

History

History
74 lines (55 loc) · 3.4 KB

README.md

File metadata and controls

74 lines (55 loc) · 3.4 KB

ChURI

NPM Build Status Code Quality Coverage GitHub Project API Documentation

ChURI is a polyglot serializer, deserializer and validator supporting various data formats.

The data processing is based on data schemas. Schemas are written in TypeScript. ChURI compiles such schemas into efficient code implementing serializers, deserializers, and validators for the data conforming to those schemas.

The core data format encodes the data with URI Charge Notation. It is designed to pass structured data inside URI. Such URI is called Charged URI, or just ChURI.

Other data formats supported out of the box:

  • JSON
  • application/x-www-form-urlencoded (URI query parameters)
  • URL-encoded
  • plain text

Some formats support insets containing data in another formats. For example, the application/x-www-form-urlencoded format allows query parameter values to be encoded as URL-encoded ones, as plain text, or as URI Charge. The choice is made by data schema.

Charged URI and URI Charge

Charged URI (ChURI) may include arbitrary structured data. The data is encoded with URI Charge Notation.

It is like JSON for GET requests, but may include even more:

https://example.com/!v(3)api/user;id=0n302875106592253/article;slug=hello-world/comments?date=since(!date'1970-01-01)till(!now)&range=from(10)to(20)

See the explanation >>>

Read more about URI Charge Notation >>>

This Package

This package provides:

  • ChURI class, which is a read-only URL class that grants access to charges.
  • URI charging utilities.
  • Schema-based parser, serializer, and validator.
  • URI Charge Notation support
  • JSON support.
  • application/x-www-form-urlencoded format support.
  • Other formats support, such as plain text and URI-encoded values.