DEV Community

Alexander Friedl
Alexander Friedl

Posted on

2 3

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.

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay