Skip to content

Models are not generated #140

Description

@kevinglier

Hey all together!

I'm having an issue with the generation. It seems like, that for me, no models are generated. The index.ts in the models directory is just empty (with the tslint:disable).

The APIs that got generated also have the type "void", even though they should return a type.

This is the standard example of an .Net Core application. The WeatherForecast should actually return the "WeatherForecast" class:

/**
   * Response generated for [ 200 ] HTTP response code.
   */
  getWeatherForecast(
    requestHttpOptions?: HttpOptions,
    observe?: 'body',
  ): Observable<void>;
  getWeatherForecast(
    requestHttpOptions?: HttpOptions,
    observe?: 'response',
  ): Observable<HttpResponse<void>>;
  getWeatherForecast(
    requestHttpOptions?: HttpOptions,
    observe?: 'events',
  ): Observable<HttpEvent<void>>;
  getWeatherForecast(
    requestHttpOptions?: HttpOptions,
    observe: any = 'body',
  ): Observable<void | HttpResponse<void> | HttpEvent<void>> {
    const path = `/WeatherForecast`;
    const options = {
      ...this.options,
      ...requestHttpOptions,
      observe,
    };

    return this.http.get<void>(`${this.domain}${path}`, options);
  }

Within the swagger.json, the type is visible. Am I doing something wrong or is the Swagger version too new or something?

{
  "openapi": "3.0.1",
  "info": {
    "title": "MyApi",
    "version": "1.0"
  },
  "paths": {
    "/WeatherForecast": {
      "get": {
        "tags": [
          "WeatherForecast"
        ],
        "operationId": "GetWeatherForecast",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WeatherForecast"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "WeatherForecast": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "temperatureC": {
            "type": "integer",
            "format": "int32"
          },
          "temperatureF": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "summary": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    }
  }
}

Thanks for you help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions