swagger-api/swagger-codegen

codegen doesn't take into account the default values

Aberta

#1.892 aberto em 14 de jan. de 2016

 (3 comentários) (0 reação) (0 responsável)HTML (5.474 forks)batch import
Server: Nodejshelp wanted

Métricas do repositório

Stars
 (12.701 estrelas)
Métricas de merge de PR
 (Métricas PR pendentes)

Description

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,

Guia do colaborador