ServiceStack / Issues

Issue Tracker for the commercial versions of ServiceStack
11 stars 8 forks source link

ServiceStack models are suddenly appearing in codegen #758

Closed rockgecko-development closed 3 years ago

rockgecko-development commented 3 years ago

Hi, I'm using ServiceStack 5.10.5 from MyGet (thanks to your resolution in #756, which I have been using fine past few weeks). Have you recently pushed a new version with the same version name? Today I generated a new codegen for my dart client, and there's suddenly a lot of builtin ServiceStack and ServiceStack.OpenApi models appearing, and I'm not sure why - they weren't there before and I am not using them. It's added about 2,000 lines to my dto file. When I do the codegen locally it is fine, but from my CI pipeline it has these extra classes - which makes me think the MyGet dependencies have changed even tho I specify 5.10.5. Both my local and CI codegen still show Version: 5.105 at the top of the codegen response.

The extra classes include AppInfo, MetaAuthProvider, AuthInfo, AutoQueryConvention, AutoQueryInfo, ScriptMethodType, SharpPagesInfo, MetadataDataMember, etc. There's also a few minor syntax changes (improvements!) in the dart code eg changed create: () => List<Foo>() to create: () => <Foo>[] example:

// @DataContract
class OpenApiContact implements IConvertible
{
    // @DataMember(Name="name")
    String name;

    // @DataMember(Name="url")
    String url;

    // @DataMember(Name="email")
    String email;

    OpenApiContact({this.name,this.url,this.email});
    OpenApiContact.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        name = json['name'];
        url = json['url'];
        email = json['email'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'name': name,
        'url': url,
        'email': email
    };

    getTypeName() => "OpenApiContact";
    TypeContext context = _ctx;
}
mythz commented 3 years ago

Should be resolved with the latest release of v5.10.5 that's now available on MyGet.

As you already have v5.10.5 installed you'll need to clear your NuGet packages cache in order to download the latest version, e.g:

$ nuget locals all -clear

You can find some more info about Versioning Scheme in the docs, i.e. the odd number Patch Version e.g. v5.10.5 always refers to the latest pre-release package on MyGet, which you'll need to clear your NuGet packages cache to download the latest pre-release packages. Your local version is still using the cached version at the time of your last restore whereas your CI is fetching the latest pre-release version on MyGet.