ChURI
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 main data format supported is URI Charge Notation, which is used to encode data included into URI. Such URI is called Charged URI, or 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)
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.