forked from loafle/openapi-generator-original
Apply readWriteVars to constructor in python/model.mustach
This commit is contained in:
parent
03f5619beb
commit
2c939b03b4
@ -44,6 +44,8 @@ nosetests.xml
|
|||||||
coverage.xml
|
coverage.xml
|
||||||
*,cover
|
*,cover
|
||||||
.hypothesis/
|
.hypothesis/
|
||||||
|
venv/
|
||||||
|
.python-version
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
*.mo
|
*.mo
|
||||||
|
@ -14,7 +14,7 @@ class {{classname}}(object):
|
|||||||
NOTE: This class is auto generated by the swagger code generator program.
|
NOTE: This class is auto generated by the swagger code generator program.
|
||||||
Do not edit the class manually.
|
Do not edit the class manually.
|
||||||
"""
|
"""
|
||||||
def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}):
|
def __init__(self{{#readWriteVars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/readWriteVars}}):
|
||||||
"""
|
"""
|
||||||
{{classname}} - a model defined in Swagger
|
{{classname}} - a model defined in Swagger
|
||||||
|
|
||||||
@ -33,9 +33,12 @@ class {{classname}}(object):
|
|||||||
{{/hasMore}}{{/vars}}
|
{{/hasMore}}{{/vars}}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#vars}}
|
{{#readOnlyVars}}
|
||||||
|
self._{{name}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}
|
||||||
|
{{/readOnlyVars}}
|
||||||
|
{{#readWriteVars}}
|
||||||
self._{{name}} = {{name}}
|
self._{{name}} = {{name}}
|
||||||
{{/vars}}
|
{{/readWriteVars}}
|
||||||
{{#vars}}{{#-first}}
|
{{#vars}}{{#-first}}
|
||||||
{{/-first}}
|
{{/-first}}
|
||||||
@property
|
@property
|
||||||
|
@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https://
|
|||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Package version: 1.0.0
|
- Package version: 1.0.0
|
||||||
- Build date: 2016-06-08T10:26:51.066+08:00
|
- Build date: 2016-06-08T23:40:51.798+09:00
|
||||||
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
|
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
|
||||||
|
|
||||||
## Requirements.
|
## Requirements.
|
||||||
@ -24,7 +24,7 @@ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
|
|||||||
|
|
||||||
Then import the package:
|
Then import the package:
|
||||||
```python
|
```python
|
||||||
import swagger_client
|
import petstore_api
|
||||||
```
|
```
|
||||||
|
|
||||||
### Setuptools
|
### Setuptools
|
||||||
@ -38,7 +38,7 @@ python setup.py install --user
|
|||||||
|
|
||||||
Then import the package:
|
Then import the package:
|
||||||
```python
|
```python
|
||||||
import swagger_client
|
import petstore_api
|
||||||
```
|
```
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
@ -47,11 +47,11 @@ Please follow the [installation procedure](#installation--usage) and then run th
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
import time
|
import time
|
||||||
import swagger_client
|
import petstore_api
|
||||||
from swagger_client.rest import ApiException
|
from petstore_api.rest import ApiException
|
||||||
from pprint import pprint
|
from pprint import pprint
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = swagger_client.FakeApi
|
api_instance = petstore_api.FakeApi
|
||||||
number = 3.4 # float | None
|
number = 3.4 # float | None
|
||||||
double = 1.2 # float | None
|
double = 1.2 # float | None
|
||||||
string = 'string_example' # str | None
|
string = 'string_example' # str | None
|
||||||
|
@ -32,7 +32,7 @@ class Name(object):
|
|||||||
NOTE: This class is auto generated by the swagger code generator program.
|
NOTE: This class is auto generated by the swagger code generator program.
|
||||||
Do not edit the class manually.
|
Do not edit the class manually.
|
||||||
"""
|
"""
|
||||||
def __init__(self, name=None, snake_case=None, _property=None, _123_number=None):
|
def __init__(self, name=None, _property=None):
|
||||||
"""
|
"""
|
||||||
Name - a model defined in Swagger
|
Name - a model defined in Swagger
|
||||||
|
|
||||||
@ -55,10 +55,10 @@ class Name(object):
|
|||||||
'_123_number': '123Number'
|
'_123_number': '123Number'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self._snake_case = None
|
||||||
|
self.__123_number = None
|
||||||
self._name = name
|
self._name = name
|
||||||
self._snake_case = snake_case
|
|
||||||
self.__property = _property
|
self.__property = _property
|
||||||
self.__123_number = _123_number
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
|
@ -32,7 +32,7 @@ class ReadOnlyFirst(object):
|
|||||||
NOTE: This class is auto generated by the swagger code generator program.
|
NOTE: This class is auto generated by the swagger code generator program.
|
||||||
Do not edit the class manually.
|
Do not edit the class manually.
|
||||||
"""
|
"""
|
||||||
def __init__(self, bar=None, baz=None):
|
def __init__(self, baz=None):
|
||||||
"""
|
"""
|
||||||
ReadOnlyFirst - a model defined in Swagger
|
ReadOnlyFirst - a model defined in Swagger
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class ReadOnlyFirst(object):
|
|||||||
'baz': 'baz'
|
'baz': 'baz'
|
||||||
}
|
}
|
||||||
|
|
||||||
self._bar = bar
|
self._bar = None
|
||||||
self._baz = baz
|
self._baz = baz
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
x
Reference in New Issue
Block a user