Issue with services.ts on swagger link

It seems that when I debug my application that utilises a swagger link I get a compile error on the file. Code snippet is below:-

    headers = headers.set('Accept', 'application/json');
    let params = new HttpParams();
    if (deviceUuid) {
      params = params.set('deviceUUID', deviceUuid);
    }    if (fromDate) {
      params = params.set('from_date', fromDate);
    }    if (toDate) {
      params = params.set('to_date', toDate);
    }    if (limit != null) {
      params = params.set('limit', limit.toString());
    } else {
      params = params.set('limit', 30);
    if (offset != null) {
      params = params.set('offset', offset.toString());
    } else {
      params = params.set('offset', 0);
    if (sort != null) {
      params = params.set('sort', sort.toString());
    } else {
      params = params.set('sort', 1);
    if (exist) {
      params = params.set('exist', exist);

It seems that the limit and offset, which are numeric values, are being set as that in the file but the non-null values are being set to a string. When i edit the file to put quotes around the numeric values it compiles ok but, of course, these are then overwritten again. Can you please help?

Hi @Otis,

This seems to be a problem with the code generation when the default parameter value is of numeric type. We will fix it with the next Radzen version. As a workaround you can either:

  • edit the swagger.json file (if at all possible) and change the default from 30 to "30"
  • or add the service typescript file to Radzen's ignore list and made the required changes

I have done the latter for now but just glad to see that it is an issue that is not of my own making :slight_smile:

Although I have added the environment.ts and swagger.service.ts files into the code generation ignore list they are continually updating when I am debugging, which is more than frustrating.

Is there any news on when you would be able to update the issue?

Try to specify just the file name with extension without the path