Skip to content

Added OpenAPI Generator rawBodyMode and object field improved generation handling - #714

Merged
GoodforGod merged 3 commits into
masterfrom
feature/openapi-generator-gen-improvements
Aug 1, 2026
Merged

Added OpenAPI Generator rawBodyMode and object field improved generation handling#714
GoodforGod merged 3 commits into
masterfrom
feature/openapi-generator-gen-improvements

Conversation

@GoodforGod

@GoodforGod GoodforGod commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
  • Add rawBodyMode for bare OpenAPI object request/response bodies.
  • Default mode is BYTES, generating byte[] / ByteArray for top-level bare object bodies. RAW mode generates HTTP body abstractions instead: HttpBodyOutput / HttpBodyInput depending on client/server direction.
  • Also keeps nested model object fields as Object / Any, adds HTTP body mappers, and covers Java/Kotlin client/server generation with bare object request/response tests.

Merge after #712


Client:

  @HttpRoute(
      method = "POST",
      path = "/store/raw-object"
  )
  DefaultApiResponses.RawObjectApiResponse rawObject(@Header HttpHeaders additionalHeaders, byte[] body); // or HttpBodyOutput body
 @Generated("io.koraframework.openapi.generator.javagen.ApiResponseGenerator")
  sealed interface RawObjectApiResponse {
    @Generated("io.koraframework.openapi.generator.javagen.ApiResponseGenerator")
    non-sealed interface RawObjectObjectApiResponse extends RawObjectApiResponse {
      byte[] content(); // or HttpBodyInput content

      int statusCode();
    }

    /**
     * Raw object response (status code 200)
     */
    @Generated("io.koraframework.openapi.generator.javagen.ApiResponseGenerator")
    record RawObject200ApiResponse(byte[] content) implements RawObjectObjectApiResponse {
      @Override
      public int statusCode() {
        return 200;
      }
    }

    /**
     * Raw object server error (status code 500)
     */
    @Generated("io.koraframework.openapi.generator.javagen.ApiResponseGenerator")
    record RawObject500ApiResponse(byte[] content) implements RawObjectObjectApiResponse {
      @Override
      public int statusCode() {
        return 500;
      }
    }
  }

Server:

  @HttpRoute(
      method = "POST",
      path = "/store/raw-object"
  )
  DefaultApiResponses.RawObjectApiResponse rawObject(HttpHeaders _headers, byte[] body) throws Exception; // or HttpBodyInput body
  @Generated("io.koraframework.openapi.generator.javagen.ApiResponseGenerator")
  sealed interface RawObjectApiResponse {
    /**
     * Raw object response (status code 200)
     */
    @Generated("io.koraframework.openapi.generator.javagen.ApiResponseGenerator")
    record RawObject200ApiResponse(byte[] content) implements RawObjectApiResponse { // or HttpBodyOutput content
    }

    /**
     * Raw object server error (status code 500)
     */
    @Generated("io.koraframework.openapi.generator.javagen.ApiResponseGenerator")
    record RawObject500ApiResponse(byte[] content) implements RawObjectApiResponse { // or HttpBodyOutput content
    }
  }

@GoodforGod GoodforGod added this to the v2.0.0 milestone Jul 10, 2026
@GoodforGod GoodforGod added new feature New feature request module: openapi Related to Openapi module labels Jul 10, 2026
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Test Results

182 tests   182 ✅  10m 58s ⏱️
  5 suites    0 💤
  5 files      0 ❌

Results for commit 92ac66f.

♻️ This comment has been updated with latest results.

@github-actions

Copy link
Copy Markdown

Dependency Vulnerability Report

Found 2 vulnerabilities across 2 coordinates.

Checked 159 Maven coordinates from gradle/libs.versions.toml via OSV.dev.

com.fasterxml.jackson.core:jackson-databind:2.22.0

Aliases: jackson2-databind

  • GHSA-5jmj-h7xm-6q6v, CVE-2026-54515: jackson-databind has case-insensitive deserialization bypasses per-property @JsonIgnoreProperties

io.undertow:undertow-core:2.4.2.Final

Aliases: undertow-core

  • GHSA-3x3v-w654-m28m, CVE-2026-3260: Undertow: Denial of Service via Multipart/Form-Data Parsing on HTTP GET Requests

@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown

Dependency Update Report

Update level: patch

Found 8 dependency updates.

gradle/libs.versions.toml

  • grpc-java: 1.82.2 -> 1.82.3
  • apache-httpclient (org.apache.httpcomponents.client5:httpclient5, inline:143): 5.6.2 -> 5.6.3
  • s3client-aws (software.amazon.awssdk:s3, inline:248): 2.47.5 -> 2.47.6
  • commons-codec: 1.22.0 -> 1.22.1
  • zeebe: 8.9.12 -> 8.9.13
  • kotlin-stdlib: 2.4.0 -> 2.4.10
  • jspecify (org.jspecify:jspecify, inline:76): 1.0.0 -> 1.0.1
  • classgraph (io.github.classgraph:classgraph, inline:168): 4.8.184 -> 4.8.186

@GoodforGod
GoodforGod force-pushed the feature/openapi-generator-gen-improvements branch from e3354c5 to 4fe0df1 Compare July 21, 2026 12:10
@GoodforGod
GoodforGod marked this pull request as draft July 23, 2026 14:05
- Default mode is `BYTES`, generating `byte[]` / `ByteArray` for top-level bare object bodies. `RAW` mode generates HTTP body abstractions instead: `HttpBodyOutput` / `HttpBodyInput` depending on client/server direction.
- Also keeps nested model `object` fields as `Object` / `Any`, adds HTTP body mappers, and covers Java/Kotlin client/server generation with bare object request/response tests.
@GoodforGod
GoodforGod force-pushed the feature/openapi-generator-gen-improvements branch from 4fe0df1 to eea1f82 Compare July 31, 2026 23:20
Added explicit rawBodyMode choices for bare object request and response bodies. BYTES remains the default, BODY generates HttpBodyInput/HttpBodyOutput abstractions, and OBJECT restores Object/Any generation with JSON mapper annotations.
@GoodforGod
GoodforGod marked this pull request as ready for review August 1, 2026 00:01
@GoodforGod
GoodforGod merged commit de1dea3 into master Aug 1, 2026
8 checks passed
@GoodforGod
GoodforGod deleted the feature/openapi-generator-gen-improvements branch August 1, 2026 00:20
GoodforGod added a commit that referenced this pull request Aug 1, 2026
…eration handling (#714)

* - Add `rawBodyMode` for bare OpenAPI `object` request/response bodies.
- Default mode is `BYTES`, generating `byte[]` / `ByteArray` for top-level bare object bodies. `RAW` mode generates HTTP body abstractions instead: `HttpBodyOutput` / `HttpBodyInput` depending on client/server direction.
- Also keeps nested model `object` fields as `Object` / `Any`, adds HTTP body mappers, and covers Java/Kotlin client/server generation with bare object request/response tests.

* Added OpenAPI bare object body modes with BODY and OBJECT

Added explicit rawBodyMode choices for bare object request and response bodies. BYTES remains the default, BODY generates HttpBodyInput/HttpBodyOutput abstractions, and OBJECT restores Object/Any generation with JSON mapper annotations.

* Fixed Javadoc generation

Added HttpHeaders for bytes and body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: openapi Related to Openapi module new feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant