Base solution for your next web application
Open Closed

service-proxies - many autogenerated member misnamed #11101


User avatar
0
tbentley created

I am running AspNet Zero version 10.3.0 Angular version I have been using the framework very successfully for many years Yesterday I created a new service and added it to the service-proxy.module.ts as required I then ran the nswag refresh.bat to autogenerate the service-proxies.ts, and then did an npm start on the angular project, I got a bunch of errors of the type:

**> Error: ./src/app/admin/tenants/tenants.component.ts 421:50-66

"export 'EntityDtoOfInt64' was not found in '@shared/service-proxies/service-proxies'

Error: ./src/app/admin/maintenance/maintenance.component.ts 80:26-43 "export 'EntityDtoOfString' was not found in '@shared/service-proxies/service-proxies'

Error: ./src/app/shared/layout/nav/menu-search-bar/menu-search-bar.component.ts 47:33-50 "export 'NameValueOfString' was not found in '@shared/service-proxies/service-proxies'

Error: ./src/app/admin/webhook-subscription/create-or-edit-webhook-subscription-modal.component.ts 147:76-93 "export 'NameValueOfString' was not found in '@shared/service-proxies/service-proxies'

Error: ./src/app/admin/webhook-subscription/create-or-edit-webhook-subscription-modal.component.ts 191:60-77 "export 'NameValueOfString' was not found in '@shared/service-proxies/service-proxies'**

When I look at the generated service-proxies for the members raising errors and they all have extra characters in the name. For example the EntityDtoOfString is now EntityDto_1OfOfStringAndCoreLibAnd_0AndCulture_neutralAndPublicKeyToken_7cec85d7bea7798e as can be seen from the snippet below.

 /**
     * @param body (optional) 
     * @return Success
     */
    clearCache(body: EntityDto_1OfOfStringAndCoreLibAnd_0AndCulture_neutralAndPublicKeyToken_7cec85d7bea7798e | undefined): Observable<void> {
        let url_ = this.baseUrl + "/api/services/app/Caching/ClearCache";
        url_ = url_.replace(/[?&]$/, "");

        const content_ = JSON.stringify(body);

How can I fix the corrupted service-proxies.ts?. I have tried deleting it and regenerating it multiple times.

Thanks... Terry


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @tbentley

    Did you recently change any configuration related to Swashbuckle on server side ?

  • User Avatar
    0
    tbentley created

    Not that I remember. I did upgrade Postman recently - not sure if that would do anything with Swashbuckle. When I scroll down to the bottom of the Swagger web page, I see the same issue of the extraneous information in the Schemas

  • User Avatar
    0
    tbentley created

    I think I have found part of the problem. Many months ago I added the option for Swagger options.CustomSchemaIds(type => type.FullName); as I was getting and error casued by a third party class that had some of the same name for entites that I had. This appended information to the name to make it unique. I am not sure why though it is now appending all the extra information and causing the erro. For now I have removed the CustomerSchemaIds option and just renamed my entities.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @tbentley

    Thanks for the update, options.CustomSchemaIds(type => type.FullName); is not suggested in AspNet Zero.