cyclosproject / ng-openapi-gen

An OpenAPI 3.0 codegen for Angular
MIT License
397 stars 132 forks source link

Add an option to prevent model names capitalization #319

Closed ninjaxelite closed 1 month ago

ninjaxelite commented 6 months ago

After generating my code with ng-openapi-gen my model object ending word is camelcased but in the provided json url the ending word is uppercase. Sample result:

export interface InstituteDtoModel {
  institut: number;
  sap_id: number;
}

In my json it looks like this:

"/api/base/institutes": {
            "get": {
                "tags": [
                    "base-controller"
                ],
                "operationId": "getInstitutes",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "array",
                                    "items": {
                                        "$ref": "#/components/schemas/InstituteDTO"
                                    }
                                }
                            }
                        }
                    }
                },
                "security": [
                    {
                        "Authorization": []
                    }
                ]
            }
        },

I run it via my Angular package script: "openapi-gen": "ng-openapi-gen -c ./ng-openapi.config.json"

The config looks like this:

{
  "$schema": "node_modules/ng-openapi-gen/ng-openapi-gen-schema.json",
  "input": "http://localhost:8080/api-docs",
  "output": "src/app/generated",
  "modelSuffix": "Model"
}

I want my generated class to have the uppercase (InstituteDTOModel) ending instead of camelcasing (InstituteDtoModel). Am I doing something wrong cause I can't find any config for that.

luisfpg commented 1 month ago

Sorry, this tool has always worked like this. As I don't have almost any time to work on, the only way for this to be supported would be via a PR (which also doesn't have any guarantee that will be merged soon enough).

luisfpg commented 1 month ago

Well, it happens to have an open PR: https://github.com/cyclosproject/ng-openapi-gen/pull/276 So, maybe it gets implemented eventually.