Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Columns with NOT NULL and DEFAULT and serials should not be "required" #1653

Open
user753 opened this issue Nov 18, 2020 · 3 comments
Open

Comments

@user753
Copy link

user753 commented Nov 18, 2020

Environment

  • PostgreSQL version: 12
  • PostgREST version: 7.0.1
  • Operating system: Windows 10

Description of issue

For table

create table user (
    id         serial primary key,
    name       text not null
);

Post method Swagger user model is generated as

"user":{"required":["id","name"]}

Shouldn't required contain only "name"?

@wolfgangwalther
Copy link
Member

I agree.

This seems to be wrong:

& required .~ map colName (filter (not . colNullable) cs))

Columns with default value should not be marked as required, even if they have a NOT NULL constraint.

@umkl
Copy link

umkl commented Oct 29, 2022

any updates? we need it for deets!

@wolfgangwalther
Copy link
Member

@ungarmichael Feel free to open a PR!

@wolfgangwalther wolfgangwalther changed the title Swagger required field for serial primary key Columns with NOT NULL and DEFAULT should not be "required" Nov 4, 2022
@wolfgangwalther wolfgangwalther changed the title Columns with NOT NULL and DEFAULT should not be "required" Columns with NOT NULL and DEFAULT and serials should not be "required" Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants