Skip to content

Swagger Codegen version: 3.0.65 broke my javascript client code #1330

@ralpheichelberger

Description

@ralpheichelberger

image

my YAML didn't change
but now every returnType is set to null

I looked at what has changed, but I only found that there was a change vom cli version 43 to 44 and there some java framework changed.

The error occurs if you don't use inline responses but create a response under components / responses like this:

openapi: 3.0.1
info:
  title: Simple API
  version: 1.0.0
  description: Eine einfache API mit einem Array von Objekten als Rückgabewert.

paths:
  /items:
    get:
      summary: Hole ein Array von Objekten
      description: Gibt eine Liste von Objekten zurück.
      responses:
        '200':
          $ref: '#/components/responses/ItemListResponse'

components:
  schemas:
    Item:
      type: object
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: "Testobjekt"
        price:
          type: number
          format: float
          example: 19.99

  responses:
    ItemListResponse:
      description: Erfolgreiche Antwort mit einer Liste von Objekten.
      content:
        application/json:
          schema:
            type: array
            items:
              $ref: '#/components/schemas/Item'

Then the resulting DefaultApi.js looks like this:

/*
 * Simple API
 * Eine einfache API mit einem Array von Objekten als Rückgabewert.
 *
 * OpenAPI spec version: 1.0.0
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 *
 * Swagger Codegen version: 3.0.65
 *
 * Do not edit the class manually.
 *
 */
import ApiClient from "../ApiClient";

/**
* Default service.
* @module api/DefaultApi
* @version 1.0.0
*/
export default class DefaultApi {

    /**
    * Constructs a new DefaultApi. 
    * @alias module:api/DefaultApi
    * @class
    * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
    * default to {@link module:ApiClient#instanc
    e} if unspecified.
    */
    constructor(apiClient) {
        this.apiClient = apiClient || ApiClient.instance;
    }

    /**
     * Callback function to receive the result of the itemsGet operation.
     * @callback moduleapi/DefaultApi~itemsGetCallback
     * @param {String} error Error message, if any.
     * @param data This operation does not return a value.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Hole ein Array von Objekten
     * Gibt eine Liste von Objekten zurück.
     * @param {module:api/DefaultApi~itemsGetCallback} callback The callback function, accepting three arguments: error, data, response
     */
    itemsGet(callback) {
      
      let postBody = null;

      let pathParams = {
        
      };
      let queryParams = {
        
      };
      let headerParams = {
        
      };
      let formParams = {
        
      };

      let authNames = [];
      let contentTypes = [];
      let accepts = [];
      let returnType = null;

      return this.apiClient.callApi(
        '/items', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    }

}

And this won't give you the result of the server back.

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