This is an automated email from the ASF dual-hosted git repository. potiuk pushed a commit to branch apply-2.0.1-fixes in repository https://gitbox.apache.org/repos/asf/airflow-client-python.git
commit 941bf92624b11059618e691668c72499c489ff8f Author: Sumit Maheshwari <[email protected]> AuthorDate: Thu May 13 12:41:16 2021 +0530 Prepare release 2.0.1 due to Openapi generator upgrade --- airflow_client/.openapi-generator/FILES | 1 - airflow_client/.openapi-generator/VERSION | 2 +- airflow_client/README.md | 2 +- airflow_client/client/__init__.py | 2 +- airflow_client/client/api_client.py | 2 +- airflow_client/client/configuration.py | 4 ++-- airflow_client/client/model_utils.py | 31 +++++++++++++++++++++---------- airflow_client/docs/DAGApi.md | 18 ------------------ airflow_client/docs/DAGRunApi.md | 4 ---- airflow_client/docs/PoolApi.md | 8 -------- airflow_client/docs/TaskInstanceApi.md | 8 ++++++-- 11 files changed, 33 insertions(+), 49 deletions(-) diff --git a/airflow_client/.openapi-generator/FILES b/airflow_client/.openapi-generator/FILES index 7cb763d..39736ae 100644 --- a/airflow_client/.openapi-generator/FILES +++ b/airflow_client/.openapi-generator/FILES @@ -111,7 +111,6 @@ client/model/x_com_collection_all_of.py client/model/x_com_collection_item.py client/model_utils.py client/models/__init__.py -client/models/__init__.py client/rest.py docs/Action.md docs/ActionCollection.md diff --git a/airflow_client/.openapi-generator/VERSION b/airflow_client/.openapi-generator/VERSION index acf69b4..3bff059 100644 --- a/airflow_client/.openapi-generator/VERSION +++ b/airflow_client/.openapi-generator/VERSION @@ -1 +1 @@ -5.1.0 \ No newline at end of file +5.1.1 \ No newline at end of file diff --git a/airflow_client/README.md b/airflow_client/README.md index baa2c33..cd952e7 100644 --- a/airflow_client/README.md +++ b/airflow_client/README.md @@ -238,7 +238,7 @@ fulfilling the request. This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 1.0.0 -- Package version: 1.0.0 +- Package version: 2.0.1 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://airflow.apache.org](https://airflow.apache.org) diff --git a/airflow_client/client/__init__.py b/airflow_client/client/__init__.py index bbedafa..8a592ee 100644 --- a/airflow_client/client/__init__.py +++ b/airflow_client/client/__init__.py @@ -28,7 +28,7 @@ """ -__version__ = "1.0.0" +__version__ = "2.0.1" # import ApiClient from airflow_client.client.api_client import ApiClient diff --git a/airflow_client/client/api_client.py b/airflow_client/client/api_client.py index 3b92f07..5ae4ed2 100644 --- a/airflow_client/client/api_client.py +++ b/airflow_client/client/api_client.py @@ -94,7 +94,7 @@ class ApiClient(object): self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.user_agent = 'OpenAPI-Generator/2.0.0/python' def __enter__(self): return self diff --git a/airflow_client/client/configuration.py b/airflow_client/client/configuration.py index ae881cf..618145d 100644 --- a/airflow_client/client/configuration.py +++ b/airflow_client/client/configuration.py @@ -91,7 +91,7 @@ class Configuration(object): :param server_operation_variables: Mapping from operation ID to a mapping with string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before. - :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format :Example: @@ -419,7 +419,7 @@ conf = client.Configuration( "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 1.0.0\n"\ - "SDK Package Version: 1.0.0".\ + "SDK Package Version: 2.0.1".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/airflow_client/client/model_utils.py b/airflow_client/client/model_utils.py index b20f6b8..60c9902 100644 --- a/airflow_client/client/model_utils.py +++ b/airflow_client/client/model_utils.py @@ -1511,13 +1511,19 @@ def model_to_dict(model_instance, serialize=True): # exist in attribute_map attr = model_instance.attribute_map.get(attr, attr) if isinstance(value, list): - if not value or isinstance(value[0], PRIMITIVE_TYPES): - # empty list or primitive types - result[attr] = value - elif isinstance(value[0], ModelSimple): - result[attr] = [x.value for x in value] - else: - result[attr] = [model_to_dict(x, serialize=serialize) for x in value] + if not value: + # empty list or None + result[attr] = value + else: + res = [] + for v in value: + if isinstance(v, PRIMITIVE_TYPES) or v is None: + res.append(v) + elif isinstance(v, ModelSimple): + res.append(v.value) + else: + res.append(model_to_dict(v, serialize=serialize)) + result[attr] = res elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], @@ -1577,11 +1583,16 @@ def get_valid_classes_phrase(input_classes): def convert_js_args_to_python_args(fn): from functools import wraps @wraps(fn) - def wrapped_init(self, *args, **kwargs): + def wrapped_init(_self, *args, **kwargs): + """ + An attribute named `self` received from the api will conflicts with the reserved `self` + parameter of a class method. During generation, `self` attributes are mapped + to `_self` in models. Here, we name `_self` instead of `self` to avoid conflicts. + """ spec_property_naming = kwargs.get('_spec_property_naming', False) if spec_property_naming: - kwargs = change_keys_js_to_python(kwargs, self.__class__) - return fn(self, *args, **kwargs) + kwargs = change_keys_js_to_python(kwargs, _self.__class__) + return fn(_self, *args, **kwargs) return wrapped_init diff --git a/airflow_client/docs/DAGApi.md b/airflow_client/docs/DAGApi.md index 1692f29..da1f46f 100644 --- a/airflow_client/docs/DAGApi.md +++ b/airflow_client/docs/DAGApi.md @@ -550,25 +550,7 @@ with client.ApiClient(configuration) as api_client: api_instance = dag_api.DAGApi(api_client) dag_id = "dag_id_example" # str | The DAG ID. dag = DAG( - dag_id="dag_id_example", - root_dag_id="root_dag_id_example", is_paused=True, - is_subdag=True, - fileloc="fileloc_example", - file_token="file_token_example", - owners=[ - "owners_example", - ], - description="description_example", - schedule_interval=ScheduleInterval( - type="CronExpression", - value="value_example", - ), - tags=[ - Tag( - name="name_example", - ), - ], ) # DAG | update_mask = [ "update_mask_example", diff --git a/airflow_client/docs/DAGRunApi.md b/airflow_client/docs/DAGRunApi.md index e026cdf..708fcff 100644 --- a/airflow_client/docs/DAGRunApi.md +++ b/airflow_client/docs/DAGRunApi.md @@ -424,12 +424,8 @@ with client.ApiClient(configuration) as api_client: dag_id = "dag_id_example" # str | The DAG ID. dag_run = DAGRun( dag_run_id="dag_run_id_example", - dag_id="dag_id_example", execution_date=dateutil_parser('1970-01-01T00:00:00.00Z'), - start_date=dateutil_parser('1970-01-01T00:00:00.00Z'), - end_date=dateutil_parser('1970-01-01T00:00:00.00Z'), state=DagState("success"), - external_trigger=True, conf={}, ) # DAGRun | diff --git a/airflow_client/docs/PoolApi.md b/airflow_client/docs/PoolApi.md index 22133b1..b8f705a 100644 --- a/airflow_client/docs/PoolApi.md +++ b/airflow_client/docs/PoolApi.md @@ -305,10 +305,6 @@ with client.ApiClient(configuration) as api_client: pool = Pool( name="name_example", slots=1, - occupied_slots=1, - used_slots=1, - queued_slots=1, - open_slots=1, ) # Pool | update_mask = [ "update_mask_example", @@ -406,10 +402,6 @@ with client.ApiClient(configuration) as api_client: pool = Pool( name="name_example", slots=1, - occupied_slots=1, - used_slots=1, - queued_slots=1, - open_slots=1, ) # Pool | # example passing only required values which don't have defaults set diff --git a/airflow_client/docs/TaskInstanceApi.md b/airflow_client/docs/TaskInstanceApi.md index fe2482a..25100dc 100644 --- a/airflow_client/docs/TaskInstanceApi.md +++ b/airflow_client/docs/TaskInstanceApi.md @@ -472,8 +472,12 @@ with client.ApiClient(configuration) as api_client: state=[ "state_example", ], - pool=[], - queue=[], + pool=[ + "pool_example", + ], + queue=[ + "queue_example", + ], ) # ListTaskInstanceForm | # example passing only required values which don't have defaults set
