OpenAPITools / OpenAPITools/openapi-generator

[REQ] Feature Request Description

Open
#8,532 0 comments 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

When we generate a typescript client, openapi generator makes interfaces to describe types. In other languages like java it generates pojo-s.

If anybody reuses these generated interfaces/classes it is a disadvantage, that generated code definition allows to modify the object after creating it.

So I need a feature (that can be a parameter) to make generated model immutable.

In typescript for instance if you use this parameter, it would generate an immutable model:

export interface Balance { 
    /**
     * Amount
     */
    readonly amount: number;
    /**
     * ISO 4217 Alpha 3 currency code
     */
    readonly currency?: Balance.CurrencyEnum;
}

It is also possible to make immutable model in other languages like kotlin, java, etc.

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 OpenAPI Generator and TypeScript interfaces, with Java and Kotlin as additional examples, but no files, tests, or entry points. Start by locating the generators and configuration path for model generation; done means an option produces immutable models across the intended languages, including readonly TypeScript properties.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin, openapi, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.