deckchair-technicians / vicets Goto Github PK
View Code? Open in Web Editor NEWValidation and coercion library for Typescript
Validation and coercion library for Typescript
@data
export class Foo {
readonly bar?: string | undefined = __(isstring());
}
Currently this will fail validation if key bar
is missinh
.. so the error message is confusing
e.g. field index
must be less than the length of someStringField
Depends on #23
Remember to test that recursion does not create an infinite loop.
Figure out how to cleanly pass dependencies to schema at runtime for dynamic validation (repositories and so on). Ideally do this without magic global state.
e.g. {a: 1, b: 1}
should not validate against {a: __(isnumber())}
Maybe create a standard test harness for all schema
Can't remember what I was thinking. Double check this.
undefined isn't a concept in json, so we can't express it in json schema. The tag is really just for the ObjectSchema
that eventually wraps TagSchemaAsOptional
.
May be out of scope. Don't forget to test circular dependencies, which should either be impossible, or blow up. Our classes are supposed to be pure value objects.
Include password schema, which unforms to "*****"
or similar.
i.e. hide impl
from the outside world
My best guess on this now is:
@data
export class Bar {
foo: MyEnum = __(isin(...Object.keys(MyEnum)));
}
Is there a better way?
@data
class A {
a:string=isstring().__();
}
@data
class B {
b:string=isstring().__();
}
const C : A & B = extendData(A,B);
like(e, pattern)
doesn't work as expected when e instanceof Error
Do we need a conform(schema, value) function that catches exceptions from the schema and adds them to problems?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.