Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dot (.) in function and parameter name. #43

Open
yantrab opened this issue Aug 13, 2018 · 1 comment
Open

Dot (.) in function and parameter name. #43

yantrab opened this issue Aug 13, 2018 · 1 comment

Comments

@yantrab
Copy link

yantrab commented Aug 13, 2018

Thanks for the package.

my problem is that it is generates classes with dot in the parameters and functions:

export const _PASSPORT_CTRL.LOGIN_START = 's/PassportCtrl/_PASSPORT_CTRL.LOGIN_START'

export function PassportCtrl.login(body: api.UserLogin): Promise<api.Response<api.User>> {
  const parameters: api.OperationParamGroups = {
    body: {
      body
    }
  }
  return gateway.request(PassportCtrl.loginOperation, parameters)
}

and my swagger.json:

{
  "swagger": "2.0",
  "info": {
    "version": "1.0.0",
    "title": "Api documentation",
    "description": "",
    "termsOfService": ""
  },
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "securityDefinitions": {},
  "tags": [
    {
      "name": "PassportCtrl"
    }
  ],
  "paths": {
    "/rest/auth/login": {
      "post": {
        "operationId": "PassportCtrl.login",
        "tags": [
          "PassportCtrl"
        ],
        "parameters": [
          {
            "in": "body",
            "name": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/UserLogin"
            }
          }
        ],
        "consumes": [],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/User"
            }
          },
          "400": {
            "description": "Missing required parameter"
          }
        },
        "security": [],
        "produces": [],
        "description": "Description of this route",
        "summary": "Summary of this route"
      }
    },
    "/rest/auth/isAuthenticated": {
      "post": {
        "operationId": "PassportCtrl.isAuthenticated",
        "tags": [
          "PassportCtrl"
        ],
        "parameters": [],
        "consumes": [],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/User"
            }
          }
        },
        "security": [],
        "produces": [],
        "description": "return the user if is Authenticated and  exists in database",
        "summary": "Check if is user Authenticated"
      }
    },
    "/rest/auth/logout": {
      "get": {
        "operationId": "PassportCtrl.logout",
        "tags": [
          "PassportCtrl"
        ],
        "parameters": [],
        "consumes": [],
        "responses": {
          "200": {
            "description": "Success"
          }
        },
        "security": [],
        "produces": []
      }
    }
  },
  "definitions": {
    "User": {
      "properties": {
        "_id": {
          "minLength": 3,
          "maxLength": 20,
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      },
      "required": [
        "_id"
      ],
      "type": "object"
    },
    "UserLogin": {
      "properties": {
        "email": {
          "format": "email",
          "type": "string"
        },
        "password": {
          "minLength": 6,
          "type": "string"
        }
      },
      "required": [
        "email",
        "password"
      ],
      "type": "object"
    }
  }
}
@elsassph
Copy link

elsassph commented Oct 8, 2018

The library assumes that operationId is a valid JS identifier.

I've run in this problem and attempted a PR to sanitize identifiers:
#36

Maybe you can give it a go?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants