Description
When constructing an object, the generated javascript client recursively calls constructFromObject on enum types. This method is not defined on enum types.
Swagger-codegen version
Latest master (8c2267c)
Swagger declaration file content or url
swagger: '2.0'
info:
title: test title
description: test description
version: 0.1.0
schemes:
- http
produces:
- application/json
consumes:
- application/json
paths:
/foos:
post:
operationId: createFoo
description: Create a new Foo
tags:
- Foos
parameters:
- name: CreateFooRequest
in: body
schema:
$ref: '#/definitions/CreateFooRequest'
required: true
responses:
200:
description: OK response
definitions:
CreateFooRequest:
type: object
properties:
bar:
$ref: '#/definitions/Bar'
Bar:
type: string
enum:
- baz1
- baz2
- baz3
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i swagger.yml -l javascript -o gen-js
Steps to reproduce
- Run codegen against the above config.
- Open
src/model/CreateFooRequest.js and notice this logic for constructing the enum:
if (data.hasOwnProperty('bar')) {
obj['bar'] = Bar.constructFromObject(data['bar']);
}
If you open src/model/Bar.js, there is no constructFromObject method on that type.
Related issues
Didn't find any.
Suggest a Fix
Still digging...
Description
When constructing an object, the generated javascript client recursively calls constructFromObject on enum types. This method is not defined on enum types.
Swagger-codegen version
Latest master (8c2267c)
Swagger declaration file content or url
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i swagger.yml -l javascript -o gen-jsSteps to reproduce
src/model/CreateFooRequest.jsand notice this logic for constructing the enum:If you open
src/model/Bar.js, there is noconstructFromObjectmethod on that type.Related issues
Didn't find any.
Suggest a Fix
Still digging...