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.35k stars 6.46k forks source link

[BUG] Confluence Wiki output doesn't work for array types #7485

Open zyrain opened 3 years ago

zyrain commented 3 years ago

Bug Report Checklist

Description

When the openAPI spec contains array types, the generator doesn't create proper Cwiki.

Example (incorrect) output: ... || Response Type | array[ErrorResult] | || Response Model | [array[ErrorResult] Model|#array[ErrorResult]ModelAnchor|Jump to model] |

It should be more like: ... || Response Type | array of ErrorResult | || Response Model | [ErrorResult Model|#ErrorResultModelAnchor|Jump to model] |

openapi-generator version

v4.3.1

OpenAPI declaration file content or url
{
  "openapi": "3.0.1",
  "info": { "title": "foo", "version": "1.0.0" },
  "servers": [ { "url": "https://foo.com/bar" } ],
  "paths": {
    "/foo": {
      "get": {
        "summary": "baz",
        "operationId": "getBaz",
        "responses": { "404": { "description": "Requested resource was not found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ArrayOfErrorResult" } } } } }
      }
    }
  },
  "components": {  "schemas": {
      "ErrorResult": { "type": "object", "properties": { "message": {
            "type": "string",
            "description": "Additional details about error encountered"
          },
          "code": { "type": "integer", "description": "Error code", "format": "int32" }  },
        "description": "Contains error details of request"
      },
      "ArrayOfErrorResult": { "type": "array", "items": { "$ref": "#/components/schemas/ErrorResult"       } } } } }
Generation Details

openapi-generator generate -i example.json -g cwiki

Related issues/PRs

Didn't see any

Suggest a fix

The mustache file looks correct, but it's using a field ({{{dataType}}} that puts in the square brackets, confusing Confluence. Simple escaping doesn't seem to work.

auto-labeler[bot] commented 3 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.