swagger-angular-generator icon indicating copy to clipboard operation
swagger-angular-generator copied to clipboard

required:true is not respected for array fields

Open Schwankenson opened this issue 4 years ago • 0 comments

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

Schwankenson avatar Nov 06 '20 13:11 Schwankenson