Skip to content

[BUG] Vendor extensions in request body are ignored #6765

@0x4a616e

Description

@0x4a616e

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you search for related issues/PRs?
  • What's the version of OpenAPI Generator used?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Vendor extensions added to the request body section of the specification are not available in mustache templates.

openapi-generator version

3.4.1

OpenAPI declaration file content or url
Command line used for generation
paths:
  /users:
    post:
      summary: Adds a new user
      requestBody:
        x-foo: "extension" # <- not available in mustache templates
        content:
          application/json:
            schema:      # Request body contents
              type: object
              properties:
                id:
                  type: integer
                name:
                  type: string
              example:   # Sample object
                id: 10
                name: Jessica Smith
      responses:
        '200':
          description: OK
Steps to reproduce

Generate server API from the snippet above, using a custom bodyParts.mustache template containing {{{vendorExtensions.x-foo}}}, which will be empty.

Related issues/PRs
Suggest a fix

DefaultCodegen.fromRequestBody should probably copy the vendor extensions from RequestBody to CodegenParameter

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