Open juansie96 opened 1 year ago
I have the same problem, it seems to ignore generics.
import { getTypeScriptReader, getOpenApiWriter, makeConverter } from 'typeconv';
const input = 'export interface Foo<T> { data: T[]; success: boolean; }';
const reader = getTypeScriptReader();
const writer = getOpenApiWriter({ format: 'yaml' });
const { convert } = makeConverter(reader, writer);
const { data } = await convert({ data: input });
console.log(data);
Output:
openapi: 3.0.0
info:
title: Converted with typeconv
version: '1'
x-comment: >-
Generated by core-types-json-schema
(https://github.com/grantila/core-types-json-schema) on behalf of typeconv
(https://github.com/grantila/typeconv)
paths: {}
components:
schemas: {}
As a curiosity, when the generic is omitted, this result is obtained:
...
const input = 'export interface Foo<> { data: T[]; success: boolean; }';
...
Output:
openapi: 3.0.0
info:
title: Converted with typeconv
version: '1'
x-comment: >-
Generated by core-types-json-schema
(https://github.com/grantila/core-types-json-schema) on behalf of typeconv
(https://github.com/grantila/typeconv)
paths: {}
components:
schemas:
Foo:
properties:
data:
items: {}
title: Foo.data
type: array
success:
title: Foo.success
type: boolean
required:
- data
- success
additionalProperties: false
title: Foo
type: object
+1 here. Definitely reduces the utility of this without having generics be converted.
This should be great! Sometimes generics are almost mandatory
Hello! I expect this to work:
but it isn't recognizing type params, all my types with generic type implementation are not constructed on my .swagger.yaml oapi output file. What can I do or it's not supported?