Jacob Floyd 469b21830c
Add pythonSrcRoot option to python servers (aiohttp/flask/blueplanet) to support src/ layout projects [and reenable/fix all python server tests] (#5423)
* python server: Add pythonSrcRoot option

This will allow the python project to be in a subdirectory (as specified
in pythonSrcRoot). That could mean following the src layout with sources
under src/ or lib/. Multi-language projects might use a sub directory
like python/, or whatever makes sense for the project.

By default, the pythonSrcRoot is "", meaning the existing behavior is
the default.

* python server: update template files to support pythonSrcRoot

* python server: update docs to add pythonSrcRoot option

* python server: add pythonSrcRoot sample script

* python server: build sample srclayout project

* [Python] copy test files preserving history

* [Python] Make a conflict to preserve file copy history

* [Python] customize pom.xml for src layout tests

* [Python] add python-aiohttp-srclayout tests

* [Python] Fix server tests by updating requirements

Reverts the PR that disabled python2 server tests:
https://github.com/OpenAPITools/openapi-generator/pull/4949

Reverts commits that disabled python3 server tests:
9adfedbfbb45c7059e64b3d9a285710bded4fb62
17ee990baaa80585242c7a07d64e2be4888fcfd0

Issue about the python 3 tests:
https://github.com/OpenAPITools/openapi-generator/issues/5235

I couldn't find an issue about the python2 tests being disabled.
I'm guessing build errors like the following were the trigger:
https://travis-ci.org/github/OpenAPITools/openapi-generator/builds/634238181

Let's see what breaks!

* [Python] Copy setup.py to python-aiohttp

* [Python] Save history while copying setup.py to python-aiohttp

* [Python] Add aiohttp server setup.py

* [Python] Fix python server tests with src layout

* [Python] bump Flask-Testing version

* [Python] Pin pyyaml for py2.7 flask server

* [Python] simplify flask server requirements

* consolidate server tests

* [Python] rebuild python server samples

* [Python] Fix python server requirements for older pythons

Documented minimum python version for our aiohttp server is 3.5.
Documented minimum python version for our flask server is 3.4.
Connexion 2.3 is the last version to support python 3.4 and 3.5, so fix
the version pinning to correctly select <=2.3 for these EOL python
versions. Newer pythons should get the latest if possible as there many
relevant bug fixes.

Werkzeug also needs to be pinned for these old versions in the aiohttp
server just like for the flask server.

3.4 and 3.5 are EOL. We really should increase the minimum supported
version, but that is for another PR to do.
2020-04-07 23:14:13 -07:00

5.3 KiB

title sidebar_label
Config Options for python-flask python-flask
Option Description Values Default
allowUnicodeIdentifiers boolean, toggles whether unicode identifiers are allowed in names or not, default is false false
controllerPackage controller package controllers
defaultController default controller default_controller
ensureUniqueParams Whether to ensure parameter names are unique in an operation (rename parameters that are not). true
packageName python package name (convention: snake_case). openapi_server
packageVersion python package version. 1.0.0
prependFormOrBodyParameters Add form or body parameters to the beginning of the parameter list. false
pythonSrcRoot put python sources in this subdirectory of output folder (defaults to "" for). Use this for src/ layout.
serverPort TCP port to listen to in app.run 8080
sortModelPropertiesByRequiredFlag Sort model properties to place required parameters before optional parameters. true
sortParamsByRequiredFlag Sort method arguments to place required parameters before optional parameters. true
supportPython2 support python2 false
useNose use the nose test framework false

IMPORT MAPPING

Type/Alias Imports
Array java.util.List
ArrayList java.util.ArrayList
BigDecimal java.math.BigDecimal
Date java.util.Date
DateTime org.joda.time.*
File java.io.File
HashMap java.util.HashMap
List java.util.*
LocalDate org.joda.time.*
LocalDateTime org.joda.time.*
LocalTime org.joda.time.*
Map java.util.Map
Set java.util.*
Timestamp java.sql.Timestamp
URI java.net.URI
UUID java.util.UUID

INSTANTIATION TYPES

Type/Alias Instantiated By

LANGUAGE PRIMITIVES

  • Dict
  • List
  • bool
  • byte
  • bytearray
  • date
  • datetime
  • file
  • float
  • int
  • object
  • str

RESERVED WORDS

  • and
  • as
  • assert
  • break
  • class
  • continue
  • def
  • del
  • elif
  • else
  • except
  • exec
  • false
  • finally
  • for
  • from
  • global
  • if
  • import
  • in
  • is
  • lambda
  • none
  • nonlocal
  • not
  • or
  • pass
  • print
  • property
  • raise
  • return
  • self
  • true
  • try
  • while
  • with
  • yield

FEATURE SET

Client Modification Feature

Name Supported Defined By
BasePath ToolingExtension
Authorizations ToolingExtension
UserAgent ToolingExtension

Data Type Feature

Name Supported Defined By
Custom OAS2,OAS3
Int32 OAS2,OAS3
Int64 OAS2,OAS3
Float OAS2,OAS3
Double OAS2,OAS3
Decimal ToolingExtension
String OAS2,OAS3
Byte OAS2,OAS3
Binary OAS2,OAS3
Boolean OAS2,OAS3
Date OAS2,OAS3
DateTime OAS2,OAS3
Password OAS2,OAS3
File OAS2
Array OAS2,OAS3
Maps ToolingExtension
CollectionFormat OAS2
CollectionFormatMulti OAS2
Enum OAS2,OAS3
ArrayOfEnum ToolingExtension
ArrayOfModel ToolingExtension
ArrayOfCollectionOfPrimitives ToolingExtension
ArrayOfCollectionOfModel ToolingExtension
ArrayOfCollectionOfEnum ToolingExtension
MapOfEnum ToolingExtension
MapOfModel ToolingExtension
MapOfCollectionOfPrimitives ToolingExtension
MapOfCollectionOfModel ToolingExtension
MapOfCollectionOfEnum ToolingExtension

Documentation Feature

Name Supported Defined By
Readme ToolingExtension
Model ToolingExtension
Api ToolingExtension

Global Feature

Name Supported Defined By
Host OAS2,OAS3
BasePath OAS2,OAS3
Info OAS2,OAS3
Schemes OAS2,OAS3
PartialSchemes OAS2,OAS3
Consumes OAS2
Produces OAS2
ExternalDocumentation OAS2,OAS3
Examples OAS2,OAS3
XMLStructureDefinitions OAS2,OAS3
MultiServer OAS3
ParameterizedServer OAS3
ParameterStyling OAS3
Callbacks OAS3
LinkObjects OAS3

Parameter Feature

Name Supported Defined By
Path OAS2,OAS3
Query OAS2,OAS3
Header OAS2,OAS3
Body OAS2
FormUnencoded OAS2
FormMultipart OAS2
Cookie OAS3

Schema Support Feature

Name Supported Defined By
Simple OAS2,OAS3
Composite OAS2,OAS3
Polymorphism OAS2,OAS3
Union OAS3

Security Feature

Name Supported Defined By
BasicAuth OAS2,OAS3
ApiKey OAS2,OAS3
OpenIDConnect OAS3
BearerToken OAS3
OAuth2_Implicit OAS2,OAS3
OAuth2_Password OAS2,OAS3
OAuth2_ClientCredentials OAS2,OAS3
OAuth2_AuthorizationCode OAS2,OAS3

Wire Format Feature

Name Supported Defined By
JSON OAS2,OAS3
XML OAS2,OAS3
PROTOBUF ToolingExtension
Custom OAS2,OAS3