-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
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
Python generator throws an exception when adding supporting files and custom package name
openapi-generator version
5.1.1
OpenAPI declaration file content or url
openapi: 3.0.0
info:
title: Some title
version: 1.0
paths: {}
components:
schemas: {}
responses: {}
parameters: {}
examples: {}
requestBodies: {}
headers: {}
securitySchemes:
basic_auth:
type: http
scheme: basic
api_key:
type: apiKey
name: id
in: header
Bearer:
type: apiKey
name: Authorization
in: header
links: {}
callbacks: {}
tags: []
servers: []runtime-config.yaml
packageName: "infra_sdk.runtime"
projectName: "infra-sdk-runtime"
packageVersion: "0.1.0"
appDescription: "Some description"
generatorName: "python"
templateDir: "mustache-templates/python/runtime"
files:
deprecated-api/translation-scheme.json:
folder: deprecatedapitranslator
destinationFilename: translation-scheme.json
templateType: SupportingFilesGeneration Details
java -jar openapi-generator-cli.jar generate -g python -i openapi-runtime.yaml -c config/python/runtime-config.yaml -o ../out
Steps to reproduce
Using openapi-runtime.yaml as input spec and config as runtime-config.yaml and empty templates dir, trying to generate python bindings throws below exception
Exception in thread "main" java.lang.IllegalStateException: Duplicate key init.mustache (attempted merging values SupportingFile[templateFile='init.mustache', folder='vmware_infra_sdk', destinationFilename='init.py', canOverwrite=true] and SupportingFile[templateFile='init.mustache', folder='test', destinationFilename='init.py', canOverwrite=true])
Related issues/PRs
Suggest a fix
Provide func while creating map in processUserDefinedTemplates() to use user-defined values
https://github.com/OpenAPITools/openapi-generator/blob/v5.1.1/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java#L940