Skip to content

Devx 867 render body fix - #353

Merged
ShipilA merged 6 commits into
mainfrom
DEVX-867-renderBody-fix
Sep 4, 2026
Merged

ShipilA merged 6 commits into
mainfrom
DEVX-867-renderBody-fix

Conversation

@ShipilA

@ShipilA ShipilA commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

@ShipilA
ShipilA requested a review from a team as a code owner September 3, 2026 14:01
@ShipilA
ShipilA requested review from jenschude and a lite review from Copilot and removed request for a team September 3, 2026 14:01

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Failed Failed Infrastructure as Code high 1   medium 1   low 3   info 4 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca
🛡️ The following IaC misconfigurations have been detected
NAME FILE
high Global Security Field Is Undefined .../multipart-body.yaml View in code
medium Field 'securityScheme' On Components Is Undefined .../multipart-body.yaml View in code
low Response Code Missing (v3) .../multipart-body.yaml View in code
low No Global And Operation Security Defined .../multipart-body.yaml View in code
low Response on operations that should have a body has undefined schema .../multipart-body.yaml View in code
info Server URL Uses Undefined Variables .../multipart-body.yaml View in code
info Object Without Required Property .../multipart-body.yaml View in code
info Schema Has A Required Property Undefined .../multipart-body.yaml View in code
info Schema Has A Required Property Undefined .../multipart-body.yaml View in code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The current renderer and the new fixture emit content at the wrong indentation level (sibling of requestBody), producing invalid OpenAPI/YAML and potentially masking the intended multipart rendering fix.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adds a regression test and fixtures for rendering multiple request body media types (JSON + multipart/form-data) into OpenAPI, and adjusts the OAS renderer to emit a single requestBody.content map rather than repeating content per body.

Changes:

  • Add a RAML test API and an expected OpenAPI fixture covering application/json + multipart/form-data request bodies.
  • Add a Kotlin test asserting the generated openapi.yaml matches the new fixture.
  • Update OasResourceRenderer to render content at the requestBody level and render each body as a media-type entry.
File summaries
File Description
languages/oas/src/test/resources/multipart-body-test.raml New RAML input defining JSON and multipart request bodies for the same operation.
languages/oas/src/test/resources/fixtures/multipart-body.yaml New expected OpenAPI output fixture for multipart + JSON request bodies.
languages/oas/src/test/kotlin/languages/oas/TestCodeGenerator.kt New regression test validating the generated OpenAPI matches the multipart fixture.
languages/oas/src/main/kotlin/io/vrap/codegen/languages/oas/model/OasResourceRenderer.kt Adjust requestBody rendering to emit content once and list media types beneath it.
Review details

Suppressed comments (2)

languages/oas/src/main/kotlin/io/vrap/codegen/languages/oas/model/OasResourceRenderer.kt:133

  • With content: moved out of renderBody, the returned snippet should no longer include the extra leading indentation; otherwise the generated "*/*" entry is over-indented under requestBody.content.
            return """
                |  "*/*":
                |    schema:
                |      type: string
            """.trimMargin().keepAngleIndent()

languages/oas/src/main/kotlin/io/vrap/codegen/languages/oas/model/OasResourceRenderer.kt:138

  • This body rendering is now inserted under requestBody.content; the content-type key and nested schema lines need to be de-dented by two spaces to keep valid OpenAPI/YAML structure (and to match how response bodies are rendered).
            |  ${body.contentType}:${if (body.type != null) """
            |    schema:
            |      <<${body.type.renderAnyType()}>>
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread languages/oas/src/test/resources/fixtures/multipart-body.yaml

@orca-security-eu orca-security-eu Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Failed Failed Infrastructure as Code high 1   medium 1   low 3   info 3 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca
🛡️ The following IaC misconfigurations have been detected
NAME FILE
high Global Security Field Is Undefined .../multipart-body.yaml View in code
medium Field 'securityScheme' On Components Is Undefined .../multipart-body.yaml View in code
low Response on operations that should have a body has undefined schema .../multipart-body.yaml View in code
low No Global And Operation Security Defined .../multipart-body.yaml View in code
low Response Code Missing (v3) .../multipart-body.yaml View in code
info Schema Has A Required Property Undefined .../multipart-body.yaml View in code
info Schema Has A Required Property Undefined .../multipart-body.yaml View in code
info Server URL Uses Undefined Variables .../multipart-body.yaml View in code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The change is localized, fixes a concrete OpenAPI structure issue, and is backed by an exact-match regression test and fixture.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@ShipilA
ShipilA merged commit 790a4a6 into main Sep 4, 2026
6 of 7 checks passed
@ShipilA
ShipilA deleted the DEVX-867-renderBody-fix branch September 4, 2026 09:06
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.

3 participants