-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Closed
Labels
Description
Description
We define "packageName": "myapi.rest.client" in the config file for the python generator.
This is because we want our REST API to de a submodule of the myapi.
The generated code does not give us the expected code layout.
openapi-generator version
I used OpenAPI generator CLI version 4.0.0-SNAPSHOT:
https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/openapi-generator-cli-4.0.0-20181210.103357-85.jar
OpenAPI declaration file content or url
python-sub-module.yaml:
openapi: '3.0.1'
info:
title: Test REST API
version: "1.0"
servers:
- url: /
paths:
/data:
get:
summary: Get the Remote Data
responses:
'200':
description: Remote Object
content:
application/json:
schema:
properties:
data:
type: stringCommand line used for generation
java -jar openapi-generator-cli-4.x.jar generate -i ./python-sub-module.yaml -g python -o ./client/python/ -c ./config/python.json
Steps to reproduce
python-sub-module.sh:
#!/bin/sh
mkdir -p config
cat >config/python.json <<-CONFIG
{
"packageName": "myapi.rest.client",
"projectName": "myapi-rest-client"
}
CONFIG
rm -rf client/python/
java -jar openapi-generator-cli-4.x.jar generate -i ./python-sub-module.yaml -g python -o ./client/python/ -c ./config/python.jsontom@localhost:~/issues$ ./python-sub-module.sh
tom@localhost:~/issues$ tree -aAC client/python/
client/python/
├── docs
│ └── DefaultApi.md
├── .gitignore
├── git_push.sh
├── myapi
│ └── rest
│ └── client
│ └── api
│ └── default_api.py
├── myapi.rest.client
│ ├── api
│ │ └── __init__.py
│ ├── api_client.py
│ ├── configuration.py
│ ├── __init__.py
│ ├── models
│ │ └── __init__.py
│ └── rest.py
├── .openapi-generator
│ └── VERSION
├── .openapi-generator-ignore
├── README.md
├── requirements.txt
├── setup.py
├── test
│ ├── __init__.py
│ └── test_default_api.py
├── test-requirements.txt
├── tox.ini
└── .travis.yml
10 directories, 20 filesRelated issues/PRs
- [Python] Support for package hierarchy #1302
- [BUG] [Python][Python-Flask] packageName dots are not replaced to slashes #1899
Suggest a fix
Fixes in progress: