PostgREST / postgrest

REST API for any Postgres database
https://postgrest.org
MIT License
23.25k stars 1.02k forks source link

Enum array support #1353

Open bwbroersma opened 5 years ago

bwbroersma commented 5 years ago

Enum looks nice in SwaggerUI, enum arrays do not. Here the changes that work for me for nice SwaggerUI output, but it might not be correct for the OpenAPI standard: code diff

bwbroersma commented 5 years ago

Ok the previous commit / provided solution is not the correct way to do it, this will also result in an Example Value

{
  "the-enum-array-field": "first-value"
}

were we would want more something like

{
  "the-enum-array-field": ["first-value"]
}
bwbroersma commented 5 years ago

The correct Swagger to output (according to the docs) is:

{
  "format": "schema.typename[]",
  "type": "array",
  "items": {
    "type": "string",
    "enum": ["first-value", "second-value"]
  }
}
kavitang-sa commented 2 weeks ago

Any update on this issue? We have an enum array column and would want the above mentioned response from the OpenApi response.

laurenceisla commented 2 weeks ago

@kavitang-sa I don't think this will be fixed here (in the core repository), but it will be addressed in the postgrest-openapi project.

kavitang-sa commented 2 weeks ago

Thanks @laurenceisla I'll create an issue there to address this.

wolfgangwalther commented 2 weeks ago

I'll create an issue there to address this.

No need to do that, we will track it here.

kavitang-sa commented 2 weeks ago

I'll create an issue there to address this.

No need to do that, we will track it here.

Great, I just read this after creating an issue. I'll remove it, thank you @wolfgangwalther !