OpenAPITools / OpenAPITools/openapi-generator

Dont apply useOptional globally like models

Open
#24,537 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

Hi,

I use obsolete version 4.3.1 of pluging to generate server stubs and pojos for spring boot java with useOptional, that means it java Optional wrapper is used in method parameters when required false.

Now I want to upgrade to newer version, maybe newest one and after generation I see that optionals are used also for model fields and it breaks my compiled code and it would require a lot of refactoring.

Would be possible to create some additional config option like useModelOptional to achieve backward compatibility with 4.3.1 for instance?

Or exist some workarounf how to do it?

thanks
br metalpalo

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 or tests. Start by reproducing Spring Boot Java server-stub and POJO generation with useOptional enabled, comparing parameter and model-field output with version 4.3.1. Done means a separate configuration can preserve the older model-field behavior while retaining the newer parameter behavior, with coverage for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, spring-boot
Domain
backend-api-design, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.