OpenAPITools / OpenAPITools/openapi-generator
[BUG] Spring generator bug with x-spring-provide-args + interfaceOnly=true + delegatePattern=true + requestMappingMode=api_interface
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
Description
Spring generator bug with x-spring-provide-args + interfaceOnly=true + delegatePattern=true + requestMappingMode=api_interface:
The generated request-mapped wrapper method, e.g. _foo(String providedArg), includes parameters from x-spring-provide-args, but the wrapper delegates to foo() without passing them. The user-overridable foo(...) method also does not declare those parameters.
openapi-generator version
master
OpenAPI declaration file content or url
Easy reproducer:
tmpdir="$(mktemp -d)" && \
cat > "$tmpdir/x-spring-provide-args-api-interface.yaml" <<'YAML'
openapi: 3.0.3
info:
title: x-spring-provide-args api interface test
version: 1.0.0
paths:
/foo:
get:
tags:
- foo
operationId: foo
x-spring-provide-args:
- "@Size(max = 64) String providedArg"
responses:
"204":
description: no content
YAML
java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \
-g spring \
-i "$tmpdir/x-spring-provide-args-api-interface.yaml" \
-o "$tmpdir/out" \
--additional-properties=library=spring-boot,interfaceOnly=true,delegatePattern=true,requestMappingMode=api_interface \
--global-property=apis,apiTests=false,apiDocs=false,models=false,modelTests=false,modelDocs=false,supportingFiles=false && \
printf '\nGenerated interface:\n%s\n' "$tmpdir/out/src/main/java/org/openapitools/api/FooApi.java" && \
cat "$tmpdir/out/src/main/java/org/openapitools/api/FooApi.java"
Steps to reproduce
Use x-spring-provide-args with delegation.
Related issues/PRs
Suggest a fix
See #24071 (or #24064).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided shell reproducer with the Spring generator and inspect the generated FooApi.java. Compare the request-mapped wrapper and delegated foo(...) signatures when x-spring-provide-args, interfaceOnly, delegatePattern, and requestMappingMode=api_interface are enabled. Done means the provided argument is consistently declared and passed through the generated delegation path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100