DEV Community

Alexander Friedl
Alexander Friedl

Posted on

Need help: Open API 3.0 generator

Can anyone help me with the following Open API 3.0 confusion.

Say I want to specify an endpoint for a sign-up use case.

POST /signup
Enter fullscreen mode Exit fullscreen mode

The endpoint (on the frontend side) has a requestBody with a JSON:

{
"email": "user@user.com",
"password": "blaa",
"passwordConfirm": "blaa"
}
Enter fullscreen mode Exit fullscreen mode

The endpoint (on the backend side) should look like this:

{
"email": "user@user.com",
"password": "blaa",
"passwordConfirm": "blaa",
"handle": "username",
"createdAt": "2021-05-28T12:39:47.802Z"
}
Enter fullscreen mode Exit fullscreen mode

So there should be two more values, that only are handled by the backend side (createdAt and handle being initialized by the backend).

My goal is to generate the frontend and backend which should output different code:

  • frontend: email, password, passwordConfirm
  • backend: email, password, passwordConfirm, handle, createdAt

Is this something I can specify with Open API 3.0?
How would the specification look like?

Thanks for your help.

Top comments (0)