Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models are not generated #140

Open
kevinglier opened this issue Nov 19, 2023 · 0 comments
Open

Models are not generated #140

kevinglier opened this issue Nov 19, 2023 · 0 comments

Comments

@kevinglier
Copy link

kevinglier commented Nov 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant