Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #8404
Closed
Open
Issue created Jan 11, 2021 by Administrator@rootContributor0 of 6 checklist items completed0/6 checklist items

[BUG][Python] own Endpoint type shadows autogenerated Endpoint helper for python

Created by: RonnyPfannschmidt

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

having a openapi type declared endpoint creates the following wrong file header


from openapi_client.api_client import ApiClient, Endpoint
from openapi_client.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from openapi_client.model.endpoint import Endpoint

the own model will then shadow the helper and break the api spec

openapi-generator version

5.0.0

OpenAPI declaration file content or url
{
    "openapi": "3.0.3",
    "paths": {
        "/endpoints": {
            "post": {
                "operationId": "EndpointService_createEndpoint",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/Endpoint"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Endpoint"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "Endpoint": {
                "required": [
                    "description",
                    "name",
                    "type"
                ],
                "type": "object",
                "properties": {
                    "description": {
                        "type": "string",
                        "nullable": false
                    },
                    "enabled": {
                        "type": "boolean"
                    },
                    "id": {
                        "type": "string",
                        "format": "uuid"
                    },
                    "name": {
                        "type": "string",
                        "nullable": false
                    },
                    "properties": {
                    }
                }
            }
        }
    },
    "info": {
        "description": "The API for Integrations",
        "version": "1.0",
        "title": "Integrations"
    },
    "servers": [
        {
            "url": "http://localhost:{port}",
            "description": "Development Server",
            "variables": {
                "basePath": {
                    "default": "/api/integrations/v1.0"
                },
                "port": {
                    "default": "8080"
                }
            }
        }
    ]
}

(for JSON code), so it becomes more readable. If it is longer than about ten lines, please create a Gist (https://gist.github.com) or upload it somewhere else and link it here. -->

Steps to reproduce

java -jar openapi-generator-cli.jar generate -i api.notifications.integrations.spec.json -g python

Suggest a fix

i strongly suggest to import the api_client module and use api_client.Endpoint

Assignee
Assign to
Time tracking