OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.91k stars 6.58k forks source link

[BUG] Description #6570

Open neclimdul opened 4 years ago

neclimdul commented 4 years ago

Bug Report Checklist

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
auto-labeler[bot] commented 4 years ago

👍 Thanks for opening this issue! 🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

neclimdul commented 4 years ago

yeah, not actually java specific :-/ I originally found this on the php client. bots.. :-D