OpenAPITools / OpenAPITools/openapi-generator

[BUG] Description

Open
#6,570 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Java 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?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Documentation for swagger generated code seems to be missing the content type.

openapi-generator version

3.0.0-latest

This is a regression from swagger-codegen-cli where it is generated correctly.

OpenAPI declaration file content or url
swagger: '2.0'
info:
  title: test
  version: 1.0.0
consumes:
  - application/json
produces:
  - application/json
paths: 
  /person:
    post:
      operationId: createPerson
      responses:
        200:
          description: "Success"
          schema:
            type: object
Command line used for generation

I didn't test all generators but I did check java and php and the problem existed in both so it seems to be an underlying problem.

docker run --rm -v ${PWD}:/local/ openapitools/openapi-generator-cli:latest generate \
    -i /local/test.yaml -g java -o /local/.build
Steps to reproduce
  1. build the code using the above command
  2. Inspect the generated markdown in the documentation folder.

Expected:

### HTTP request headers
 
  - **Content-Type**: application/json
  - **Accept**: application/json

Actual:

### HTTP request headers
 
  - **Content-Type**: Not defined
  - **Accept**: application/json

ambiguous set of steps to reproduce the bug.-->

Related issues/PRs
Suggest a fix

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 with the provided test.yaml and Docker generation command, producing the Java or PHP client and inspecting the generated markdown in its documentation folder. Compare the Content-Type and Accept entries with the expected output; done means the generated documentation reflects the declared consumes and produces values.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi, php
Domain
api, documentation
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.