swagger-api/swagger-codegen

codegen doesn't take into account the default values

Open

#1,892 建立於 2016年1月14日

在 GitHub 查看
 (3 留言) (0 反應) (0 負責人)HTML (5,474 fork)batch import
Server: Nodejshelp wanted

倉庫指標

Star
 (12,701 star)
PR 合併指標
 (30 天內沒有已合併 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,

貢獻者指南