OpenAPITools / OpenAPITools/openapi-generator

[REQ] Generate different code for frontend and backend

Open
#9,638 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Problem

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

POST /signup

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

{
  "email": "user@user.com",
  "password": "blaa",
  "passwordConfirm": "blaa"
}

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"
}

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

Describe the solution you'd like

No solution yet

Describe alternatives you've considered

No alternatives I've considered yet

Additional context

No additional context yet

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points. Start by clarifying how one OpenAPI request body should express frontend-only versus backend-only fields, then identify the generator paths for client and server output. Done means an agreed design and distinct generated representations for both sides, with tests covering the signup example.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api, backend, frontend, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.