jnwltr / swagger-angular-generator

Generator of API layer in TypeScript for Angular 2+ apps
MIT License
91 stars 46 forks source link

required:true is not respected for array fields #130

Open Schwankenson opened 3 years ago

Schwankenson commented 3 years ago

I have this parameter in my swagger.json . required is set to false

"parameters":[
    {
        "name":"token_types",
        "in":"query",
        "description":"Token types",
        "required":false,
        "type":"array",
        "items":{
            "type":"string",
            "enum":[
            "option_a",
            "option_b",
            "option_c",                        
            ]
        }
    }
],

if generates this typescript code:

const queryParamBase = {
  token_types: params.token_types.join(','),
};

I have to specify an empty list, when generating the parameters. But it optional, so I expect that it`s fine to not set it in the params