KY-Programming / generator

Type Generator: No framework. No magic. Just code. 100% debuggable.
https://generator.ky-programming.de
MIT License
18 stars 4 forks source link

Controller with array return type generates invalid typescript import #18

Closed joachim-heck closed 4 years ago

joachim-heck commented 4 years ago

I've just tested out the controller export feature and came across some weird generation behaviour:

Controller Endpoint:

[HttpGet, Route("string")]
public string[] GetStrings()
{
    return new List<string>().ToArray();
}

will be generated with a corrupt import definition: string[]

// ------------------------------------------------------------------------------
//  <auto-generated>
//      This code was generated with KY.Generator 5.0.1.0
//      Manual changes to this file may cause unexpected behavior in your application.
//      Manual changes to this file will be overwritten if the code is regenerated.
//  </auto-generated>
// ------------------------------------------------------------------------------
// tslint:disable

import { String[] } from "../api-models/string";

...

    public getStrings(httpOptions: {} = undefined): Observable<String[]> {
        let subject = new Subject<String[]>();
        this.http.get<String[]>(this.serviceUrl + "/api/v1/modelling", httpOptions).subscribe((result) => {
            subject.next(result);
            subject.complete();
        }, (error) => subject.error(error));
        return subject;
    }
ky-one commented 4 years ago

Will be part of the next release