OpenAPITools / OpenAPITools/openapi-generator

[BUG] Description

Open
#3,897 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
    Yes
  • Have you validated the input using an OpenAPI validator ([example]
    Yes
    (https://apidevtools.org/swagger-parser/online/))?
  • What's the version of OpenAPI Generator used?
    openapi-generator-cli:v3.3.4
  • Have you search for related issues/PRs?
    Yes, no related issues
  • What's the actual output vs expected output?
    Actual:
    package model

type Comp struct {

Files []*os.File `json:"Files,omitempty"`

}

Expected:
package model
import "os"

type Comp struct {

Files []*os.File `json:"Files,omitempty"`

}

  • [Optional] Bounty to sponsor the fix (example)
Description

openapi generate for go-gin-server target has issues with the multipart form type specification format: binary

openapi-generator version

openapi-generator-cli:v3.3.4

OpenAPI declaration file content or url
Command line used for generation
  openapitools/openapi-generator-cli:${OPEN_API_VERSION} generate \
  --input-spec /local/${OPEN_API_SPEC} \
  --generator-name ${GENERATOR} \
  --additional-properties=packageName=name \
  --output <>
Steps to reproduce
Related issues/PRs
Suggest a fix

Generate the model code with the import "os" package

Result
package model
import "os"

type Comp struct {

Files []*os.File `json:"Files,omitempty"`

}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the go-gin-server generation described in the issue with the multipart form property using format: binary, then inspect the generated Comp model. Compare the actual output with the expected import of os; done means the generated Go model includes the required import and remains valid.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.