Coder Social home page Coder Social logo

jacob-alford / schemata-ts Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 1.0 3.3 MB

An all-inclusive schema engine featuring schemata inspired by io-ts and validators.js. Written for TypeScript with fp-ts

Home Page: https://schemata.jacob-alford.dev/

License: MIT License

JavaScript 0.06% TypeScript 99.93% Shell 0.01%
camelcase-keys deserialization json-schema parser serialization validator

schemata-ts's Introduction

jacob-alford

schemata-ts's People

Contributors

0x706b avatar allcontributors[bot] avatar dependabot[bot] avatar golergka avatar jacob-alford avatar newswim avatar skeate 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

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

golergka

schemata-ts's Issues

Add OptionalOption `generic` module

A schemable-combinator that has the parameter shape :: type SchemableParams<S> = <A>(sa: HKT<S, A>) => HKT<S, Option<A>>

Should live in:src/generic/OptionalOption

There are two ways to arrive at Option<A>: from nullable and from undefinable. Unfortunately these are not lawfully combinable, because the requirement of an isomorphism :: encoder <-> decoder for this construction is not bijective.

Add `Encoder` field to `templateCombinator.ts`

Since we now generate the schemable instances for Encoder (#56), let's go ahead and add it to the template generator.

To test, running yarn generate:template string <Module> should generate an Encoder instance for that module. Presumably the default for all of these should be Enc.id().

Generate SchemableExt with combinator's JSDoc comment

Adding JSDocs to all of the generated properties of SchemableExt would display useful information when making a new schema and using intellisense.

This is quite tricky because for each module in string, number, date:

  • Read the file contents
  • Isolate the module's JSDoc comment (returning Left if jsdoc comment does not exist, or contains TODO)
  • Remove comment's asterisks, and empty space
  • Keep the raw comment around and inject it as a _.createJSDocComment immediately above the module property declaration in the SchemableExt interface

Correct Float modules upper / lower bounds

I incorrectly assumed the upper/lower bounds of floating point numbers in javascript was Number.MAX_SAFE_INTEGER, but it turns out there's a different property: Number.MAX_VALUE and Number.MIN_VALUE which ought to be used for all the float modules.

Additionally, the comments need to be updated to reflect the bigger range

Add `fast-check` and Arbitrary Schemable

One of the tricky parts to this will be to make sure fast-check doesn't make it into the library bundle. This might mean implementing our own definition of Arbitrary?

Improve the `Base64` module

Refactor existing tests

Many of the existing tests are written hastily, and need to be updated with test-strength parity to validator.js. There are some new test-utils available that makes bulk testing easy in #35

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.