Open vrudikov opened 7 years ago
@thiagobustamante Hi. Any updates? If you are busy - please suggest me a string or filename. I will do a research
Hi, @vrudikov ,
The problem is not related to JsDocs. The problem is that typescript-rest-swagger can not understand this declaration:
export type SimpleHelloType = {
greeting: string;
};
if you use interfaces or classes, it works:
export interface SimpleHelloType {
greeting: string;
}
or
export class SimpleHelloType {
greeting: string;
}
I have to check why this type aliases are not working
@vrudikov , please, try 0.0.10 version
@thiagobustamante A-W-E-S-O-M-E! Thank you
The problem is not related to JsDocs. The problem is that typescript-rest-swagger can not understand this declaration
Yeah. I knew that. But wanted to understand where it should be fixed
Just a second. I think i found a bug. I will try to created a PR and will post a fix
@thiagobustamante Hello! Could you try to replace your object with this one:
export type SimpleHelloType = {
/**
* Description for greeting property
*/
greeting: string;
arrayOfSomething: Something[];
profile: {
name: string
};
comparePassword: (candidatePassword: string, cb: (err: any, isMatch: any) => {}) => void
};
export type Something = {
someone: string,
kind: string
};
And fire swagger generator again, plz
I receive this error:
Error: Unknown type: TypeLiteral
at resolveType (/Users/val.rudi/Documents/Nodejs/typescript-rest-swagger/src/metadata/resolveType.ts:38:15)
at /Users/val.rudi/Documents/Nodejs/typescript-rest-swagger/src/metadata/resolveType.ts:418:27
at Array.map (native)
at getModelTypeProperties (/Users/val.rudi/Documents/Nodejs/typescript-rest-swagger/src/metadata/resolveType.ts:378:14)
at getModelTypeProperties (/Users/val.rudi/Documents/Nodejs/typescript-rest-swagger/src/metadata/resolveType.ts:424:16)
at getReferenceType (/Users/val.rudi/Documents/Nodejs/typescript-rest-swagger/src/metadata/resolveType.ts:208:28)
at resolveType (/Users/val.rudi/Documents/Nodejs/typescript-rest-swagger/src/metadata/resolveType.ts:83:25)
Yes you are right. I added it to the test case and I am reopening the issue.
Is it the same reason why it does not work on types in interface ?
export type GroupId = number;
export interface Group {
id: GroupId;
groupName: string;
}
Also, In my case, this object is not directly linked to the rest layer. Is typescript-rest-swagger look for every defined type in the project ?
@thiagobustamante hi. have you had a time to look at my case? do you need any help?
@vrudikov This should be fixed by recent commits. Please try with the latest version (0.0.12
) and let me know if you still have issues.
@krazar Your issue is a bit different. I'm looking into it.
@ngraef Awesome. Thank you. Will take a look today
Wow. Forgot to look at it. Will do in near future
Hi, Thiago So i tried to return declared Type from API method and added type's reference to JSDoc, but swagger generator can't handle it. It just writes 'Inline Model 1':
You can see examples here and here