John Bush c4f0521e10 Fix escaped regex values in Python client (#1517). (#1539)
* Fix escaped regex values in Python client (#1517).

* Override PythonClientCodegen toRegularExpression() method to correct
  issue with backslashes being escaped. This issue was a result of
  calling escapeText() in the parent DefaultCodegen class.

* Only escape unescaped forward slashes in PythonClientCodegen.

* Override addRegularExpressionDelimiter in PythonClientCodegen.java
  such that only unescaped forward slashes in the pattern get escaped.
* Adds a new test resource .yaml file for specifically testing this
  issue.

* Check for regular expression modifiers in PythonClientCodegen.

* Adds check in postProcessPattern() in PythonClientCodegen.java to
  check if regular expression has modifiers defined. If so, it throws an
  exception as modifiers are not currently supported in the Python
  client.

* PythonClientCodegen warns that regex modifiers are not supported.

* Changes behavior in PythonClientCodegen.java to no longer throw an
  IllegalArgumentException in the case that a pattern contains
  modifiers. A warning message will be logged instead stating that
  modifiers are not currently supported by the codegen class.

* Remove warning for PythonClientCodegen regex modifier support.

* Removes warning message from PythonClientCodegen.java stating that
  regular expression modifiers are not currently supported. Further
  code review and testing revealed that this feature is already
  supported and working.

* Add updated Python client sample files.
2018-12-08 11:32:55 +08:00
..

petstore-api

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: " \ */ ' " =end --

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.0.0 */ ' " =end -- \r\n \n \r
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import petstore_api 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import petstore_api

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = petstore_api.FakeApi(petstore_api.ApiClient(configuration))
unknown_base_type = petstore_api.UNKNOWN_BASE_TYPE() # UNKNOWN_BASE_TYPE |  (optional)

try:
    # To test code injection */ ' \" =end -- \\r\\n \\n \\r
    api_instance.test_code_inject____end__rn_n_r(unknown_base_type=unknown_base_type)
except ApiException as e:
    print("Exception when calling FakeApi->test_code_inject____end__rn_n_r: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to *http://petstore.swagger.io */ ' " =end -- \r\n \n \r/v2 / ' " =end -- \r\n \n \r

Class Method HTTP request Description
FakeApi test_code_inject____end__rn_n_r PUT /fake To test code injection */ ' " =end -- \r\n \n \r

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key
  • API key parameter name: api_key */ ' " =end -- \r\n \n \r
  • Location: HTTP header

petstore_auth

  • Type: OAuth
  • Flow: implicit
  • Authorization URL: http://petstore.swagger.io/api/oauth/dialog
  • Scopes:
  • write:pets: modify pets in your account */ ' " =end -- \r\n \n \r
  • read:pets: read your pets */ ' " =end -- \r\n \n \r

Author

something@something.abc */ ' " =end -- \r\n \n \r