hashicorp / nomad-openapi

OpenAPI specification and related artifacts for HashiCorp Nomad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

array and object nullable is not handled correctly, at least for python.

yihuaf opened this issue · comments

In the openapi spec, when the type is array, the generated python validation code will complain when the value is null, which the nomad restful API does return. For example, if I call:

    configuration = nomad_client.Configuration(host="http://127.0.01:4646/v1")
    api_client = nomad_client.ApiClient(configuration)
    api_instance = JobsApi(api_client)
    job_name = HELLO_WORLD_JOB_NAME
    job_status = api_instance.get_job(job_name)
    print(job_status)

the get_job call should return a job, but a number of fields such as constraints are returned null, but it is defined as array type in the openapi spec. The same with object type. The openapi solution seems to be adding nullable: true to these fields, but there are a lot of them. Not sure what is the best solution to automatically fix this.