Skip to content

feat: add shared generator worker module for Gradle and Maven plugins - #3372

Open
vpelikh wants to merge 1 commit into
springdoc:mainfrom
vpelikh:generator-worker
Open

vpelikh wants to merge 1 commit into
springdoc:mainfrom
vpelikh:generator-worker

Conversation

@vpelikh

@vpelikh vpelikh commented Sep 24, 2026 •

Copy link
Copy Markdown

Summary

Adds shared single forked-JVM worker (springdoc-openapi-generator-worker) that boots the application context, lets springdoc-openapi build the spec, writes it to disk, and shuts the context down.
Boots a reactive context with a no-op ReactiveWebServerFactory (fully serverless) or a servlet context on an ephemeral port, writes the spec, then exits.

Changes

New module

  • springdoc-openapi-generator-worker/ — shared forked-JVM worker used by both plugins. Detects the target app's stack from its classpath and dispatches to a WebFlux or WebMvc generator.

Design notes

  • No per-stack config on the plugin side. The worker infers WebFlux vs WebMvc from the target app's classpath, so a single task/java handles both stacks.
  • No fixed port is used. WebFlux never binds a port; WebMvc uses an ephemeral port (0) and shuts down immediately after writing the spec.
  • WebFlux is genuinely serverless (no-op ReactiveWebServerFactory); WebMvc starts a real, short-lived container because the servlet model requires a ServletContext.
  • The plugin intentionally does not force a springdoc stack API onto the fork classpath; the target app's runtime classpath already provides the stack it needs. This keeps the fork classpath identical in shape to the Maven Mojo.

Follow-ups

  • Reuse this module in Gradle and Maven plugins

Part of #3367

…en plugins

- springdoc-openapi-generator-worker: shared thin worker whose entry point
  GeneratorWorkerMain detects the app's web stack from the fork classpath and
  dispatches to GeneratorWorkerWebFlux (REACTIVE, no port bound via a no-op
  ReactiveWebServerFactory) or GeneratorWorkerWebMvc (SERVLET, ephemeral port 0,
  shut down immediately). Writes the JSON/YAML atomically and fails fast on an
  unsupported format.
- Registered in springdoc-openapi-bom; added gitignore.
@vpelikh

vpelikh commented Sep 24, 2026

Copy link
Copy Markdown
Author

Hey @bnasslahsen, check this one, please.

@vpelikh vpelikh changed the title Add shared generator worker module for Gradle and Maven plugins feat: add shared generator worker module for Gradle and Maven plugins Sep 24, 2026

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant