swagger-api/swagger-codegen

codegen doesn't take into account the default values

开放

#1,892 创建于 2016年1月14日

 (3 条评论) (0 个反应) (0 位负责人)HTML (5,474 个派生)batch import
Server: Nodejshelp wanted

仓库指标

星标
 (12,701 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Hi,

Here is my swagger description:

  inline_response_200:
    properties:
      surname:
        type: "integer"
        default: 1
        format: "int32"
      name:
        type: "string"
        default: "lazy"
        enum:
        - clueless
        - lazy
        - adventurous
        - aggressive

And that's what we receive in the generated nodejs app:

exports.newCustomer = function(request) {

  var examples = {};

  examples['application/json'] = {
  "name" : "aeiou",
  "surname" : 123
};

Is that ok, that default values are not taken into consideration? string is the same each time, the numer also the same. Is that possible to make it work? As we don't want to use hardcoded examples.

Regards,

贡献者指南