grantila / grantila/typeconv

Add option to read stdin

Open
#23 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
447
Forks
10
PR merge metrics
No merged PRs in 30d

Description

There's already `-O -`. typeconv could take `-` as input, too. (It would probably imply writing to stdout as well, since filename can't be determined automatically)

### Use case

We already can do this:

```shell
npx typeconv -f ts -t jsc -O - models.ts | datamodel-codegen > models.py
```

Why not the other way around?

```py
# generate_jsonschema.py

import json
from pydantic.schema import schema
from models import *

print(json.dumps(schema([MyModel, ...]), indent=2))
```

```shell
python generate_jsonschema.py | npx typeconv -f jsc -t ts - > models.ts
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.