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
20.61k stars 6.29k forks source link

protobuf model not support array enum #16815

Open Lo0on opened 8 months ago

Lo0on commented 8 months ago
Description

protobuf-schema template , model not support array enum

openapi-generator version

all version

OpenAPI declaration file content or url
          "clientList": {
            "type": "array",
            "description": "client name",
            "items": {
              "type": "string",
              "description": "client name",
              "enum": [
                "APP",
                "M",
                "PC"
              ]
            }
          }
Command line used for generation
Steps to reproduce
Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/14892

https://github.com/Lo0on/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/protobuf-schema/model.mustache

Suggest a fix/enhancement

modules/openapi-generator/src/main/resources/protobuf-schema/model.mustache row 32 update {{#vendorExtensions.x-protobuf-type}}{{{.}}} {{/vendorExtensions.x-protobuf-type}}{{enumName}} {{name}} = {{vendorExtensions.x-protobuf-index}};

wing328 commented 8 months ago

can you please file a PR with the suggested fix when you've time? thank you