Skip to content

[python][flask] operationId should be relative if x-swagger-router-controller is present #4106

@danyx23

Description

@danyx23
Description

The docs say that adding x-swagger-router-controller should make the operationId field relative - however, the operationId field in the swagger subdirectory of the generated python flask scaffold always contains the full default controller prefix.

Swagger-codegen version

Current stable (2.2.1)

Swagger declaration file content or url
swagger: '2.0'
info:
  version: 0.0.0
  title: Simple API
paths:
  /test:
    get:
      summary: "demonstrate x-swagger-router-controller bug in python flask"
      x-swagger-router-controller: bla
      operationId: test_get
      responses:
        200:
          description: OK
Command line used for generation
java -jar swagger-codegen-cli.jar generate -l python-flask -i .\Swagger.yaml
Steps to reproduce
  1. Generate the python flask scaffold with the above command or the swagger online editor
  2. check swagger/swagger.yaml in the generated scaffold. operationId should be just
    operationId: "test_get" but is operationId: "controllers.default_controller.test_get"
Related issues

Couldn't find one

Suggest a Fix

The code preprocessing the operationId field should take the field x-swagger-router-controller into account: https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/FlaskConnexionCodegen.java#L234

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions