Title: Provide config option to resolve duplicate model names · Issue #783 · openapi-generators/openapi-python-client · GitHub
Open Graph Title: Provide config option to resolve duplicate model names · Issue #783 · openapi-generators/openapi-python-client
X Title: Provide config option to resolve duplicate model names · Issue #783 · openapi-generators/openapi-python-client
Description: I have an OpenAPI spec that has two endpoints with the same operationId ("raw-data"). Their paths are ".../node3/raw-data" and ".../node4/raw-data". The generator doesn't create a model for the Node 3 200 response, because of a name coll...
Open Graph Description: I have an OpenAPI spec that has two endpoints with the same operationId ("raw-data"). Their paths are ".../node3/raw-data" and ".../node4/raw-data". The generator doesn't create a model for the Nod...
X Description: I have an OpenAPI spec that has two endpoints with the same operationId ("raw-data"). Their paths are ".../node3/raw-data" and ".../node4/raw-data". The generator does...
Opengraph URL: https://github.com/openapi-generators/openapi-python-client/issues/783
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Provide config option to resolve duplicate model names","articleBody":"I have an OpenAPI spec that has two endpoints with the same operationId (\"raw-data\"). Their paths are \".../node3/raw-data\" and \".../node4/raw-data\". The generator doesn't create a model for the Node 3 200 response, because of a name collision with the Node 4 200 response. \r\n\r\nWhat I want is a a config option to resolve this issue.\r\n\r\nAs a suggestion, the option could be to include the first tag in the class name to create unique model class names. The grouping within the \"api\" module into separate folders based on the first tag (\"node3/raw_data.py\" and \"node4/raw_data.py\", respectively) prevents name collisions there. I want something similar for the models. \r\n\r\nUsing \"class_override\" in the config doesn't work, because both of the RawDataResponse200 model classes are renamed and the issue persists. \r\n\r\nWhat I'm doing currently is manually editing my OpenAPI spec before running the generator. I don't have any detailed control of how my OpenAPI spec is generated, it comes from a third party program. It would be great to not have to do this manually, since the generator output becomes inconsistent (suddenly there's an endpoint method in the client library with a name different from the API endpoint) and it's harder to maintain. \r\n\r\nHere is the relevant warning message:\r\n```\r\nWarning(s) encountered while generating. Client was generated, but some pieces may be missing\r\n\r\nWARNING parsing GET /v0/node3/raw-data within node3.\r\n\r\nCannot parse response for status code 200 (Attempted to generate duplicate models with name \"RawDataResponse200\"), response will be ommitted from generated client\r\n\r\nSchema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=None, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, properties={'node3.raw-dataResponse': Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=\u003cDataType.OBJECT: 'object'\u003e, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, properties={'node3.VARCHAR': Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=\u003cDataType.STRING: 'string'\u003e, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), 'node3.raw-dataResult': Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=\u003cDataType.OBJECT: 'object'\u003e, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, properties={'node3.row': Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=\u003cDataType.ARRAY: 'array'\u003e, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=\u003cDataType.OBJECT: 'object'\u003e, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, properties={'node3.datetime': Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=\u003cDataType.STRING: 'string'\u003e, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, properties=None, additionalProperties=None, description=None, schema_format='date-time', default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), 'node3.value': Schema(title=None, multipleOf=None, maximum=None, exclusiveMaximum=None, minimum=None, exclusiveMinimum=None, maxLength=None, minLength=None, pattern=None, maxItems=None, minItems=None, uniqueItems=None, maxProperties=None, minProperties=None, required=None, enum=None, type=\u003cDataType.NUMBER: 'number'\u003e, allOf=[], oneOf=[], anyOf=[], schema_not=None, items=None, properties=None, additionalProperties=None, description=None, schema_format='float', default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)}, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None), properties=None, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)}, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)}, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)}, additionalProperties=None, description=None, schema_format=None, default=None, nullable=False, discriminator=None, readOnly=None, writeOnly=None, xml=None, externalDocs=None, example=None, deprecated=None)\r\n\r\nIf you believe this was a mistake or this tool is missing a feature you need, please open an issue at https://github.com/openapi-generators/openapi-python-client/issues/new/choose\r\n```\r\n\r\n\r\nand here are the relevant parts of my OpenAPI spec that can be used to recreate the issue\r\n\r\n```json\r\n{\r\n \"openapi\": \"3.0.1\",\r\n \"info\": {\r\n \"title\": \"redacted\",\r\n \"description\": \"redacted\",\r\n \"version\": \"redacted\"\r\n },\r\n \"servers\": [\r\n {\r\n \"url\": \"https://example.com\",\r\n \"description\": \"redacted\"\r\n }\r\n ],\r\n \"tags\": [\r\n {\r\n \"name\": \"node4\"\r\n },\r\n {\r\n \"name\": \"node3\"\r\n }\r\n ],\r\n \"paths\": {\r\n \"/v0/node4/raw-data\": {\r\n \"get\": {\r\n \"tags\": [\r\n \"node4\"\r\n ],\r\n \"summary\": \"raw-data\",\r\n \"description\": \"\",\r\n \"operationId\": \"raw-data\",\r\n \"parameters\": [\r\n {\r\n \"name\": \"i_bucket\",\r\n \"in\": \"query\",\r\n \"required\": false,\r\n \"schema\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n {\r\n \"name\": \"i_range\",\r\n \"in\": \"query\",\r\n \"required\": false,\r\n \"schema\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n {\r\n \"name\": \"i_measurement\",\r\n \"in\": \"query\",\r\n \"required\": false,\r\n \"schema\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n {\r\n \"name\": \"i_filter\",\r\n \"in\": \"query\",\r\n \"required\": false,\r\n \"schema\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"Successful response\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"properties\": {\r\n \"node4.raw-dataResponse\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"node4.VARCHAR\": {\r\n \"type\": \"string\"\r\n },\r\n \"node4.raw-dataResult\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"node4.row\": {\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"node4.datetime\": {\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"node4.value\": {\r\n \"type\": \"string\"\r\n },\r\n \"node4.field\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"/v0/node3/raw-data\": {\r\n \"get\": {\r\n \"tags\": [\r\n \"node3\"\r\n ],\r\n \"summary\": \"raw-data\",\r\n \"description\": \"\",\r\n \"operationId\": \"raw-data\",\r\n \"parameters\": [\r\n {\r\n \"name\": \"i_measurement\",\r\n \"in\": \"query\",\r\n \"required\": false,\r\n \"schema\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n {\r\n \"name\": \"i_from\",\r\n \"in\": \"query\",\r\n \"required\": false,\r\n \"schema\": {\r\n \"type\": \"string\"\r\n }\r\n },\r\n {\r\n \"name\": \"i_to\",\r\n \"in\": \"query\",\r\n \"required\": false,\r\n \"schema\": {\r\n \"type\": \"string\"\r\n }\r\n }\r\n ],\r\n \"responses\": {\r\n \"200\": {\r\n \"description\": \"Successful response\",\r\n \"content\": {\r\n \"application/json\": {\r\n \"schema\": {\r\n \"properties\": {\r\n \"node3.raw-dataResponse\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"node3.VARCHAR\": {\r\n \"type\": \"string\"\r\n },\r\n \"node3.raw-dataResult\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"node3.row\": {\r\n \"type\": \"array\",\r\n \"items\": {\r\n \"type\": \"object\",\r\n \"properties\": {\r\n \"node3.datetime\": {\r\n \"type\": \"string\",\r\n \"format\": \"date-time\"\r\n },\r\n \"node3.value\": {\r\n \"type\": \"number\",\r\n \"format\": \"float\"\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n}\r\n```","author":{"url":"https://github.com/odaom","@type":"Person","name":"odaom"},"datePublished":"2023-07-31T12:29:59.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/783/openapi-python-client/issues/783"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b55f5b44-bd2b-81a2-89d6-2248574c929c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BE6A:3FE9A:B88209:E93428:697EFC06 |
| html-safe-nonce | 26e7a5f7f6195e19e78aaf2fd9a1d4b1adac6e469365b5243e34d0f5f35de4fd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRTZBOjNGRTlBOkI4ODIwOTpFOTM0Mjg6Njk3RUZDMDYiLCJ2aXNpdG9yX2lkIjoiMjU4MjY2MTAyNzY2OTY3MDkxOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 627d91d4b8f18aade67e800e31073a33c2a42b1be97791e300ce709accca3cbc |
| hovercard-subject-tag | issue:1829087406 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/openapi-generators/openapi-python-client/783/issue_layout |
| twitter:image | https://opengraph.githubassets.com/21c4f80b7c11e241c7080b54b67f3e061bc09ac6826f07488a6e6f16523e7e00/openapi-generators/openapi-python-client/issues/783 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/21c4f80b7c11e241c7080b54b67f3e061bc09ac6826f07488a6e6f16523e7e00/openapi-generators/openapi-python-client/issues/783 |
| og:image:alt | I have an OpenAPI spec that has two endpoints with the same operationId ("raw-data"). Their paths are ".../node3/raw-data" and ".../node4/raw-data". The generator doesn't create a model for the Nod... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | odaom |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/openapi-generators/openapi-python-client git https://github.com/openapi-generators/openapi-python-client.git |
| octolytics-dimension-user_id | 84925606 |
| octolytics-dimension-user_login | openapi-generators |
| octolytics-dimension-repository_id | 240776275 |
| octolytics-dimension-repository_nwo | openapi-generators/openapi-python-client |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 240776275 |
| octolytics-dimension-repository_network_root_nwo | openapi-generators/openapi-python-client |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width