PostgREST / postgrest

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

Is openapi `required` always undefined for a `VIEW`? #3745

Closed softmarshmallow closed 1 month ago

softmarshmallow commented 1 month ago

I am building a postgREST openapi parser, and trying to tell if the property is null or not null by required: [...]

It seems like properties with default value are also included in required, so it is safe to interpret it as not null, but for VIEW, told by where only get method is allowed, required is not present.

I'm wondering If I can rely on this spec and interpretation.

Is it by design or a mistake? - for me since the required represents for both read create (as properties with default value are still present in required), the VIEW should also have a required spec for representing null | not null

wolfgangwalther commented 1 month ago

Have a look at #1947 and especially https://github.com/PostgREST/postgrest/issues/1947#issuecomment-1003597415. None of your observations are considered to be as we'd like it to be, so don't expect it to stay like that.