Skip to content

Commit 9394449

Browse files
committed
#3: Fixed inheritance for Base classes
1 parent bff1807 commit 9394449

13 files changed

+142
-16
lines changed

influxdb2/domain/check.py

+34-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.check_base import CheckBase
1718

1819

19-
class Check(object):
20+
class Check(CheckBase):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -31,13 +32,44 @@ class Check(object):
3132
and the value is json key in definition.
3233
"""
3334
openapi_types = {
35+
'id': 'str',
36+
'name': 'str',
37+
'org_id': 'str',
38+
'authorization_id': 'str',
39+
'created_at': 'datetime',
40+
'updated_at': 'datetime',
41+
'query': 'DashboardQuery',
42+
'status': 'TaskStatusType',
43+
'every': 'str',
44+
'offset': 'str',
45+
'cron': 'str',
46+
'tags': 'list[CheckBaseTags]',
47+
'description': 'str',
48+
'status_message_template': 'str',
49+
'labels': 'list[Label]'
3450
}
3551

3652
attribute_map = {
53+
'id': 'id',
54+
'name': 'name',
55+
'org_id': 'orgID',
56+
'authorization_id': 'authorizationID',
57+
'created_at': 'createdAt',
58+
'updated_at': 'updatedAt',
59+
'query': 'query',
60+
'status': 'status',
61+
'every': 'every',
62+
'offset': 'offset',
63+
'cron': 'cron',
64+
'tags': 'tags',
65+
'description': 'description',
66+
'status_message_template': 'statusMessageTemplate',
67+
'labels': 'labels'
3768
}
3869

39-
def __init__(self): # noqa: E501
70+
def __init__(self, id=None, name=None, org_id=None, authorization_id=None, created_at=None, updated_at=None, query=None, status=None, every=None, offset=None, cron=None, tags=None, description=None, status_message_template=None, labels=None): # noqa: E501
4071
"""Check - a model defined in OpenAPI""" # noqa: E501
72+
CheckBase.__init__(self, id=id, name=name, org_id=org_id, authorization_id=authorization_id, created_at=created_at, updated_at=updated_at, query=query, status=status, every=every, offset=offset, cron=cron, tags=tags, description=description, status_message_template=status_message_template, labels=labels)
4173
self.discriminator = None
4274

4375
def to_dict(self):

influxdb2/domain/check_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class CheckViewProperties(object):
20+
class CheckViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -50,6 +51,7 @@ class CheckViewProperties(object):
5051

5152
def __init__(self, type=None, shape=None, check_id=None, check=None, queries=None, colors=None): # noqa: E501
5253
"""CheckViewProperties - a model defined in OpenAPI""" # noqa: E501
54+
ViewProperties.__init__(self)
5355

5456
self._type = None
5557
self._shape = None

influxdb2/domain/gauge_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class GaugeViewProperties(object):
20+
class GaugeViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -58,6 +59,7 @@ class GaugeViewProperties(object):
5859

5960
def __init__(self, type=None, queries=None, colors=None, shape=None, note=None, show_note_when_empty=None, prefix=None, suffix=None, legend=None, decimal_places=None): # noqa: E501
6061
"""GaugeViewProperties - a model defined in OpenAPI""" # noqa: E501
62+
ViewProperties.__init__(self)
6163

6264
self._type = None
6365
self._queries = None

influxdb2/domain/heatmap_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class HeatmapViewProperties(object):
20+
class HeatmapViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -72,6 +73,7 @@ class HeatmapViewProperties(object):
7273

7374
def __init__(self, type=None, queries=None, colors=None, shape=None, note=None, show_note_when_empty=None, x_column=None, y_column=None, x_domain=None, y_domain=None, x_axis_label=None, y_axis_label=None, x_prefix=None, x_suffix=None, y_prefix=None, y_suffix=None, bin_size=None): # noqa: E501
7475
"""HeatmapViewProperties - a model defined in OpenAPI""" # noqa: E501
76+
ViewProperties.__init__(self)
7577

7678
self._type = None
7779
self._queries = None

influxdb2/domain/histogram_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class HistogramViewProperties(object):
20+
class HistogramViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -62,6 +63,7 @@ class HistogramViewProperties(object):
6263

6364
def __init__(self, type=None, queries=None, colors=None, shape=None, note=None, show_note_when_empty=None, x_column=None, fill_columns=None, x_domain=None, x_axis_label=None, position=None, bin_count=None): # noqa: E501
6465
"""HistogramViewProperties - a model defined in OpenAPI""" # noqa: E501
66+
ViewProperties.__init__(self)
6567

6668
self._type = None
6769
self._queries = None

influxdb2/domain/markdown_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class MarkdownViewProperties(object):
20+
class MarkdownViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -44,6 +45,7 @@ class MarkdownViewProperties(object):
4445

4546
def __init__(self, type=None, shape=None, note=None): # noqa: E501
4647
"""MarkdownViewProperties - a model defined in OpenAPI""" # noqa: E501
48+
ViewProperties.__init__(self)
4749

4850
self._type = None
4951
self._shape = None

influxdb2/domain/notification_endpoint.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.notification_endpoint_base import NotificationEndpointBase
1718

1819

19-
class NotificationEndpoint(object):
20+
class NotificationEndpoint(NotificationEndpointBase):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -31,13 +32,30 @@ class NotificationEndpoint(object):
3132
and the value is json key in definition.
3233
"""
3334
openapi_types = {
35+
'id': 'str',
36+
'org_id': 'str',
37+
'user_id': 'str',
38+
'created_at': 'datetime',
39+
'updated_at': 'datetime',
40+
'description': 'str',
41+
'status': 'str',
42+
'labels': 'list[Label]'
3443
}
3544

3645
attribute_map = {
46+
'id': 'id',
47+
'org_id': 'orgID',
48+
'user_id': 'userID',
49+
'created_at': 'createdAt',
50+
'updated_at': 'updatedAt',
51+
'description': 'description',
52+
'status': 'status',
53+
'labels': 'labels'
3754
}
3855

39-
def __init__(self): # noqa: E501
56+
def __init__(self, id=None, org_id=None, user_id=None, created_at=None, updated_at=None, description=None, status='active', labels=None): # noqa: E501
4057
"""NotificationEndpoint - a model defined in OpenAPI""" # noqa: E501
58+
NotificationEndpointBase.__init__(self, id=id, org_id=org_id, user_id=user_id, created_at=created_at, updated_at=updated_at, description=description, status=status, labels=labels)
4159
self.discriminator = None
4260

4361
def to_dict(self):

influxdb2/domain/notification_rule.py

+42-2
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.notification_rule_base import NotificationRuleBase
1718

1819

19-
class NotificationRule(object):
20+
class NotificationRule(NotificationRuleBase):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -31,13 +32,52 @@ class NotificationRule(object):
3132
and the value is json key in definition.
3233
"""
3334
openapi_types = {
35+
'id': 'str',
36+
'notify_endpoint_id': 'str',
37+
'org_id': 'str',
38+
'authorization_id': 'str',
39+
'created_at': 'datetime',
40+
'updated_at': 'datetime',
41+
'status': 'TaskStatusType',
42+
'name': 'str',
43+
'sleep_until': 'str',
44+
'every': 'str',
45+
'offset': 'str',
46+
'cron': 'str',
47+
'runbook_link': 'str',
48+
'limit_every': 'int',
49+
'limit': 'int',
50+
'tag_rules': 'list[TagRule]',
51+
'description': 'str',
52+
'status_rules': 'list[StatusRule]',
53+
'labels': 'list[Label]'
3454
}
3555

3656
attribute_map = {
57+
'id': 'id',
58+
'notify_endpoint_id': 'notifyEndpointID',
59+
'org_id': 'orgID',
60+
'authorization_id': 'authorizationID',
61+
'created_at': 'createdAt',
62+
'updated_at': 'updatedAt',
63+
'status': 'status',
64+
'name': 'name',
65+
'sleep_until': 'sleepUntil',
66+
'every': 'every',
67+
'offset': 'offset',
68+
'cron': 'cron',
69+
'runbook_link': 'runbookLink',
70+
'limit_every': 'limitEvery',
71+
'limit': 'limit',
72+
'tag_rules': 'tagRules',
73+
'description': 'description',
74+
'status_rules': 'statusRules',
75+
'labels': 'labels'
3776
}
3877

39-
def __init__(self): # noqa: E501
78+
def __init__(self, id=None, notify_endpoint_id=None, org_id=None, authorization_id=None, created_at=None, updated_at=None, status=None, name=None, sleep_until=None, every=None, offset=None, cron=None, runbook_link=None, limit_every=None, limit=None, tag_rules=None, description=None, status_rules=None, labels=None): # noqa: E501
4079
"""NotificationRule - a model defined in OpenAPI""" # noqa: E501
80+
NotificationRuleBase.__init__(self, id=id, notify_endpoint_id=notify_endpoint_id, org_id=org_id, authorization_id=authorization_id, created_at=created_at, updated_at=updated_at, status=status, name=name, sleep_until=sleep_until, every=every, offset=offset, cron=cron, runbook_link=runbook_link, limit_every=limit_every, limit=limit, tag_rules=tag_rules, description=description, status_rules=status_rules, labels=labels)
4181
self.discriminator = None
4282

4383
def to_dict(self):

influxdb2/domain/scatter_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class ScatterViewProperties(object):
20+
class ScatterViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -74,6 +75,7 @@ class ScatterViewProperties(object):
7475

7576
def __init__(self, type=None, queries=None, colors=None, shape=None, note=None, show_note_when_empty=None, x_column=None, y_column=None, fill_columns=None, symbol_columns=None, x_domain=None, y_domain=None, x_axis_label=None, y_axis_label=None, x_prefix=None, x_suffix=None, y_prefix=None, y_suffix=None): # noqa: E501
7677
"""ScatterViewProperties - a model defined in OpenAPI""" # noqa: E501
78+
ViewProperties.__init__(self)
7779

7880
self._type = None
7981
self._queries = None

influxdb2/domain/single_stat_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class SingleStatViewProperties(object):
20+
class SingleStatViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -58,6 +59,7 @@ class SingleStatViewProperties(object):
5859

5960
def __init__(self, type=None, queries=None, colors=None, shape=None, note=None, show_note_when_empty=None, prefix=None, suffix=None, legend=None, decimal_places=None): # noqa: E501
6061
"""SingleStatViewProperties - a model defined in OpenAPI""" # noqa: E501
62+
ViewProperties.__init__(self)
6163

6264
self._type = None
6365
self._queries = None

influxdb2/domain/table_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class TableViewProperties(object):
20+
class TableViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -58,6 +59,7 @@ class TableViewProperties(object):
5859

5960
def __init__(self, type=None, queries=None, colors=None, shape=None, note=None, show_note_when_empty=None, table_options=None, field_options=None, time_format=None, decimal_places=None): # noqa: E501
6061
"""TableViewProperties - a model defined in OpenAPI""" # noqa: E501
62+
ViewProperties.__init__(self)
6163

6264
self._type = None
6365
self._queries = None

influxdb2/domain/xy_view_properties.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
import re # noqa: F401
1515

1616
import six
17+
from influxdb2.domain.view_properties import ViewProperties
1718

1819

19-
class XYViewProperties(object):
20+
class XYViewProperties(ViewProperties):
2021
"""NOTE: This class is auto generated by OpenAPI Generator.
2122
Ref: https://openapi-generator.tech
2223
@@ -62,6 +63,7 @@ class XYViewProperties(object):
6263

6364
def __init__(self, type=None, queries=None, colors=None, shape=None, note=None, show_note_when_empty=None, axes=None, legend=None, x_column=None, y_column=None, shade_below=None, geom=None): # noqa: E501
6465
"""XYViewProperties - a model defined in OpenAPI""" # noqa: E501
66+
ViewProperties.__init__(self)
6567

6668
self._type = None
6769
self._queries = None

openapi-generator/src/main/java/org/influxdata/codegen/InfluxPythonGenerator.java

+19-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,24 @@ public void processOpts() {
6464
public CodegenModel fromModel(final String name, final Schema model, final Map<String, Schema> allDefinitions) {
6565
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
6666

67+
if (name.endsWith("ViewProperties") && !name.equals("ViewProperties"))
68+
{
69+
codegenModel.setParent("ViewProperties");
70+
codegenModel.setParentSchema("ViewProperties");
71+
}
72+
73+
if (allDefinitions.containsKey(name + "Base")) {
74+
codegenModel.setParent(name + "Base");
75+
codegenModel.setParentSchema(name + "Base");
76+
}
77+
78+
if (name.equals("ViewProperties")) {
79+
codegenModel.setReadWriteVars(new ArrayList<>());
80+
codegenModel.setRequiredVars(new ArrayList<>());
81+
codegenModel.hasOnlyReadOnly = true;
82+
codegenModel.hasRequired = false;
83+
}
84+
6785
return codegenModel;
6886
}
6987

@@ -82,7 +100,7 @@ public Map<String, Object> postProcessAllModels(final Map<String, Object> models
82100
if (model.getParent() != null) {
83101
CodegenModel parentModel = getModel((HashMap) allModels.get(model.getParent()));
84102
model.vendorExtensions.put("x-parent-classFilename", parentModel.getClassFilename());
85-
model.vendorExtensions.put("x-has-parent-vars", Boolean.TRUE);
103+
model.vendorExtensions.put("x-has-parent-vars", !parentModel.getVars().isEmpty());
86104
model.vendorExtensions.put("x-parent-vars", parentModel.getVars());
87105
}
88106
}

0 commit comments

Comments
 (0)