grantila / ts-to-openapi

Convert TypeScript types to OpenAPI schema components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: What exactly makes this OpenApi compliant?

seriouscoderone opened this issue · comments

Can you describe how this is OpenApi compliant?
The dependencies you use are Draft-07

TL;DR: Nothing as of now.

This, and your PR is interesting. I'll give this a look and likely merge some time pretty soon. It seems sane and pretty straight forward.

I am however, completely rethinking the conversions between e.g. TypeScript and JSON Schema (of which OpenAPI is a superset-ish). And also GraphQL, or any other type system. I've just released a few package so far, based on core-types which is a generic type system specification I created.
More packages will come, and I'll eventually deprecate this package in favor of what will become typeconv (but that's not released yet). Hopefully before christmas.

But again, I'll look into this particular addition shortly - it makes very much sense.

Thx. There are not many TypeScript -> JsonSchema libraries. Usually the other way around. Maybe for good reason. Still thinking on that. But I have found this useful so far.

FYI I just released https://github.com/grantila/typeconv which still doesn't solve this for you if you want proper Open API support, because it's currently very limited. But it's a start.
typeconv doesn't support expanding graphql metatypes nicely (it doesn't expand e.g. Maybe<T>), but I'm planning on supporting that eventually.