gcanti / Io Ts Codegen
Licence: mit
Code generation for io-ts
Stars: ✭ 123
Programming Languages
typescript
32286 projects
Labels
Projects that are alternatives of or similar to Io Ts Codegen
Snowflaqe
A dotnet CLI tool to work with GraphQL queries: static query verification, type checking and code generating type-safe clients for F# and Fable.
Stars: ✭ 69 (-43.9%)
Mutual labels: code-generation
Prisma Docs Generator
Prisma generator for automatically generating documentation reference from the Prisma schema.
Stars: ✭ 91 (-26.02%)
Mutual labels: code-generation
Spider
A small dart library to generate Assets dart code from assets folder.
Stars: ✭ 90 (-26.83%)
Mutual labels: code-generation
Laravel Create
Create Laravel projects really fast
Stars: ✭ 1,331 (+982.11%)
Mutual labels: code-generation
Mid
mid is a generic domain-specific language for generating code and documentation
Stars: ✭ 68 (-44.72%)
Mutual labels: code-generation
Ts Type Info
TypeScript AST and code generator [Deprecated]
Stars: ✭ 90 (-26.83%)
Mutual labels: code-generation
Pylbm
Numerical simulations using flexible Lattice Boltzmann solvers
Stars: ✭ 83 (-32.52%)
Mutual labels: code-generation
Geco
Simple code generator based on a console project, running on .Net core and using C# interpolated strings
Stars: ✭ 97 (-21.14%)
Mutual labels: code-generation
Gowrtr
gowrtr is a library that supports golang code generation
Stars: ✭ 70 (-43.09%)
Mutual labels: code-generation
Json2java4idea
A JSON to Java conversion plugin for Intellij IDEA and AndroidStudio.
Stars: ✭ 69 (-43.9%)
Mutual labels: code-generation
Quenya
Quenya is a framework to build high-quality REST API applications based on extended OpenAPI spec
Stars: ✭ 121 (-1.63%)
Mutual labels: code-generation
Goreadme
Generate readme file from Go doc. Now available with Github actions!
Stars: ✭ 113 (-8.13%)
Mutual labels: code-generation
Predicateflow
Write amazing, strong-typed and easy-to-read NSPredicate.
Stars: ✭ 98 (-20.33%)
Mutual labels: code-generation
Motivation
Generate both static and runtime types from an intermediate language.
The intermediate language can in turn be generated from other schemas: JSON Schema, Swagger, metarpheus, etc..
io-ts
compatibility
io-ts-codegen version |
target io-ts version |
---|---|
0.4.0+ | 1.0.0+ || 2.0.0+ |
0.3.0+ | 1.0.0+ || 2.0.0+ |
Usage
Nodes of the intermediate language can be built from the provided builders.
import * as gen from 'io-ts-codegen'
// list of type declarations
const declarations = [
gen.typeDeclaration('Persons', gen.arrayCombinator(gen.identifier('Person'))),
gen.typeDeclaration(
'Person',
gen.typeCombinator([gen.property('name', gen.stringType), gen.property('age', gen.numberType)])
)
]
// apply topological sort in order to get the right order
const sorted = gen.sort(declarations)
console.log(sorted.map(d => gen.printRuntime(d)).join('\n'))
console.log(sorted.map(d => gen.printStatic(d)).join('\n'))
Output (as string)
const Person = t.type({
name: t.string,
age: t.number
})
const Persons = t.array(Person)
interface Person {
name: string
age: number
}
type Persons = Array<t.TypeOf<typeof Person>>
Documentation
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].