Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.
/ churi Public archive

Multi-format schema-based serializer, deserializer and validator. Charged URI syntax. URI Charge Notation

License

Notifications You must be signed in to change notification settings

UCNot/churi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

85ff5a1 · Nov 26, 2024
Apr 29, 2023
Jul 31, 2023
Jul 3, 2023
Oct 9, 2024
Nov 21, 2022
Apr 17, 2023
Nov 21, 2022
Nov 21, 2022
Feb 26, 2023
Apr 8, 2023
Aug 30, 2023
Oct 9, 2024
Jul 5, 2023
Nov 26, 2024
Oct 9, 2024
Jul 30, 2023
Oct 8, 2024
Aug 31, 2023

Repository files navigation

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.