Skip to content

[BUG] ERROR! Not handling <code> as Body Parameter at the moment #2580

Open
@adamdecaf

Description

@adamdecaf
Description

I get the following error when trying to generate a Go client:

[main] ERROR o.o.codegen.DefaultCodegen - ERROR! Not handling  class Parameter {
    name: null
    in: null
    description: null
    required: null
    deprecated: null
    allowEmptyValue: null
    style: null
    explode: null
    allowReserved: null
    schema: null
    examples: null
    example: null
    content: null
    $ref: #/components/parameters/idempotencyKey
} as Body Parameter at the moment

This comes about when my root.yaml file contains a paths sub-object with a $ref to an external OpenAPI spec file for a path like:

paths:
  /originators:
    post:
      tags:
        - Originators
      summary: Create a new Originator object
      operationId: addOriginator
      security:
        - bearerAuth: []
        - cookieAuth: []
      parameters:
        - $ref: '#/components/parameters/requestId'
        - $ref: '#/components/parameters/idempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateOriginator'        

  parameters:
    idempotencyKey:
      in: header
      name: X-Idempotency-Key
      description: Idempotent key in the header which expires after 24 hours. These strings should contain enough entropy for to not collide with each other in your requests.
      example: a4f88150
      required: false
      schema:
        type: string
openapi-generator version

4.0.0-beta2

Steps to reproduce
OPENAPI_GENERATOR_VERSION=4.0.0-beta2 ./openapi-generator generate -i openapi.yaml -g go -o ./client
Suggest a fix

Looking at the relevant source code this path is simply commented out (and has been for quite some time), so I assume there's a refactor needed?

I'm willing to offer a patch which fixes this, but I'm unsure of the history or what all would need to be refactored. Any advice? I'll contribute a reproducible local test as part of the PR.

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