Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/node-swagger-generator/lib/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,9 @@ class GenericTypeConverter implements IAbstractedTypeConverter<IAbstractedType>{
constructor(private contextBuilder: ContextBuilder) {
}

voidTypeConvert(type: SchemaLessAbstractedType): IAbstractedType {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be VoidAbstractedType

return type;
}
schemaLessTypeConvert(type: SchemaLessAbstractedType): IAbstractedType {
return type;
}
Expand Down
14 changes: 14 additions & 0 deletions src/node-swagger-generator/lib/languages/csharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class CSharpAbstractedTypeConverter implements IAbstractedTypeConverter<IType> {

}

voidTypeConvert(type: SchemaLessAbstractedType): CSharpType {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be VoidAbstractedType

return CSharpType.void();
}

schemaLessTypeConvert(type: SchemaLessAbstractedType): CSharpType {
return CSharpType.any;
}
Expand Down Expand Up @@ -94,6 +98,7 @@ class CSharpType implements IType {
isArray: boolean;
itemType: CSharpType;
isFile: boolean;
isVoid: boolean;
isGeneric: boolean;
genericArguments: CSharpType[];
isDictionary: boolean;
Expand Down Expand Up @@ -124,6 +129,15 @@ class CSharpType implements IType {
public static any: CSharpType = new CSharpType('object', null, true, false, false, false, false);
public static file: CSharpType = new CSharpType('IFile', null, true, false, false, false, true);
public static dateTimeOffset: CSharpType = new CSharpType('DateTimeOffset', null, true, false, false, false, false);
private static _void: CSharpType;

public static void(){
if (!CSharpType._void){
CSharpType._void = new CSharpType('void', null, true, false, false, false, false);
CSharpType._void.isVoid = true;
}
return CSharpType._void;
}

public static ambient(name: string, namespace: string): CSharpType {
var type = new CSharpType(name.replace('<>', ""), null, true, false, false, false, false);
Expand Down
14 changes: 14 additions & 0 deletions src/node-swagger-generator/lib/languages/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class TypescriptAbstractedTypeConverter implements IAbstractedTypeConverter<ITyp

}

voidTypeConvert(type: SchemaLessAbstractedType): TypescriptType {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be VoidAbstractedType

return TypescriptType.void();
}

schemaLessTypeConvert(type: SchemaLessAbstractedType): TypescriptType {
return TypescriptType.any;
}
Expand Down Expand Up @@ -94,6 +98,7 @@ class TypescriptType implements IType {
isArray: boolean;
itemType: TypescriptType;
isFile: boolean;
isVoid: boolean;
isGeneric: boolean;
genericArguments: TypescriptType[];
isDictionary: boolean;
Expand Down Expand Up @@ -123,6 +128,15 @@ class TypescriptType implements IType {
public static boolean: TypescriptType = new TypescriptType('boolean', null, true, false, false, false, false);
public static any: TypescriptType = new TypescriptType('any', null, true, false, false, false, false);
public static file: TypescriptType = new TypescriptType('Uint8Array', null, true, false, false, false, true);
private static _void: TypescriptType;

public static void(){
if (!TypescriptType._void){
TypescriptType._void = new TypescriptType('void', null, true, false, false, false, false);
TypescriptType._void.isVoid = true;
}
return TypescriptType._void;
}

public static ambient(name: string, namespace: string): TypescriptType {
var type = new TypescriptType(name.replace('<>', ""), null, true, false, false, false, false);
Expand Down
7 changes: 7 additions & 0 deletions src/node-swagger-generator/lib/typing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export interface ITyped {
}

export interface IAbstractedTypeConverter<T> {
voidTypeConvert(type: SchemaLessAbstractedType): T;
schemaLessTypeConvert(type: SchemaLessAbstractedType): T;
mapTypeConvert(type: MapAbstractedType): T;
builtinTypeConvert(type: BuiltinAbstractedType): T;
Expand Down Expand Up @@ -62,6 +63,12 @@ export interface IDefinition extends IExtensible {
}


export class VoidAbstractedType implements IAbstractedType {
convert<T>(converter: IAbstractedTypeConverter<T>): T {
return converter.voidTypeConvert(this);
}
}

export class SchemaLessAbstractedType implements IAbstractedType {
convert<T>(converter: IAbstractedTypeConverter<T>): T {
return converter.schemaLessTypeConvert(this);
Expand Down