Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to read stdin #23

Open
notpushkin opened this issue Apr 15, 2022 · 0 comments
Open

Add option to read stdin #23

notpushkin opened this issue Apr 15, 2022 · 0 comments

Comments

@notpushkin
Copy link

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:

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

Why not the other way around?

# generate_jsonschema.py

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

print(json.dumps(schema([MyModel, ...]), indent=2))
python generate_jsonschema.py | npx typeconv -f jsc -t ts - > models.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant