Skip to content

[BUG] Spring generator bug with x-spring-provide-args + interfaceOnly=true + delegatePattern=true + requestMappingMode=api_interface #24063

Description

@wilx

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).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions