Skip to content

Commit

Permalink
#3: Fixed inheritance for Base classes
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar committed Aug 12, 2019
1 parent bff1807 commit 9394449
Show file tree
Hide file tree
Showing 13 changed files with 142 additions and 16 deletions.
36 changes: 34 additions & 2 deletions influxdb2/domain/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.check_base import CheckBase


class Check(object):
class Check(CheckBase):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand All @@ -31,13 +32,44 @@ class Check(object):
and the value is json key in definition.
"""
openapi_types = {
'id': 'str',
'name': 'str',
'org_id': 'str',
'authorization_id': 'str',
'created_at': 'datetime',
'updated_at': 'datetime',
'query': 'DashboardQuery',
'status': 'TaskStatusType',
'every': 'str',
'offset': 'str',
'cron': 'str',
'tags': 'list[CheckBaseTags]',
'description': 'str',
'status_message_template': 'str',
'labels': 'list[Label]'
}

attribute_map = {
'id': 'id',
'name': 'name',
'org_id': 'orgID',
'authorization_id': 'authorizationID',
'created_at': 'createdAt',
'updated_at': 'updatedAt',
'query': 'query',
'status': 'status',
'every': 'every',
'offset': 'offset',
'cron': 'cron',
'tags': 'tags',
'description': 'description',
'status_message_template': 'statusMessageTemplate',
'labels': 'labels'
}

def __init__(self): # noqa: E501
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
"""Check - a model defined in OpenAPI""" # noqa: E501
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)
self.discriminator = None

def to_dict(self):
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/check_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class CheckViewProperties(object):
class CheckViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -50,6 +51,7 @@ class CheckViewProperties(object):

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

self._type = None
self._shape = None
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/gauge_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class GaugeViewProperties(object):
class GaugeViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -58,6 +59,7 @@ class GaugeViewProperties(object):

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
"""GaugeViewProperties - a model defined in OpenAPI""" # noqa: E501
ViewProperties.__init__(self)

self._type = None
self._queries = None
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/heatmap_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class HeatmapViewProperties(object):
class HeatmapViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -72,6 +73,7 @@ class HeatmapViewProperties(object):

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
"""HeatmapViewProperties - a model defined in OpenAPI""" # noqa: E501
ViewProperties.__init__(self)

self._type = None
self._queries = None
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/histogram_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class HistogramViewProperties(object):
class HistogramViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -62,6 +63,7 @@ class HistogramViewProperties(object):

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
"""HistogramViewProperties - a model defined in OpenAPI""" # noqa: E501
ViewProperties.__init__(self)

self._type = None
self._queries = None
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/markdown_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class MarkdownViewProperties(object):
class MarkdownViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -44,6 +45,7 @@ class MarkdownViewProperties(object):

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

self._type = None
self._shape = None
Expand Down
22 changes: 20 additions & 2 deletions influxdb2/domain/notification_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.notification_endpoint_base import NotificationEndpointBase


class NotificationEndpoint(object):
class NotificationEndpoint(NotificationEndpointBase):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand All @@ -31,13 +32,30 @@ class NotificationEndpoint(object):
and the value is json key in definition.
"""
openapi_types = {
'id': 'str',
'org_id': 'str',
'user_id': 'str',
'created_at': 'datetime',
'updated_at': 'datetime',
'description': 'str',
'status': 'str',
'labels': 'list[Label]'
}

attribute_map = {
'id': 'id',
'org_id': 'orgID',
'user_id': 'userID',
'created_at': 'createdAt',
'updated_at': 'updatedAt',
'description': 'description',
'status': 'status',
'labels': 'labels'
}

def __init__(self): # noqa: E501
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
"""NotificationEndpoint - a model defined in OpenAPI""" # noqa: E501
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)
self.discriminator = None

def to_dict(self):
Expand Down
44 changes: 42 additions & 2 deletions influxdb2/domain/notification_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.notification_rule_base import NotificationRuleBase


class NotificationRule(object):
class NotificationRule(NotificationRuleBase):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand All @@ -31,13 +32,52 @@ class NotificationRule(object):
and the value is json key in definition.
"""
openapi_types = {
'id': 'str',
'notify_endpoint_id': 'str',
'org_id': 'str',
'authorization_id': 'str',
'created_at': 'datetime',
'updated_at': 'datetime',
'status': 'TaskStatusType',
'name': 'str',
'sleep_until': 'str',
'every': 'str',
'offset': 'str',
'cron': 'str',
'runbook_link': 'str',
'limit_every': 'int',
'limit': 'int',
'tag_rules': 'list[TagRule]',
'description': 'str',
'status_rules': 'list[StatusRule]',
'labels': 'list[Label]'
}

attribute_map = {
'id': 'id',
'notify_endpoint_id': 'notifyEndpointID',
'org_id': 'orgID',
'authorization_id': 'authorizationID',
'created_at': 'createdAt',
'updated_at': 'updatedAt',
'status': 'status',
'name': 'name',
'sleep_until': 'sleepUntil',
'every': 'every',
'offset': 'offset',
'cron': 'cron',
'runbook_link': 'runbookLink',
'limit_every': 'limitEvery',
'limit': 'limit',
'tag_rules': 'tagRules',
'description': 'description',
'status_rules': 'statusRules',
'labels': 'labels'
}

def __init__(self): # noqa: E501
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
"""NotificationRule - a model defined in OpenAPI""" # noqa: E501
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)
self.discriminator = None

def to_dict(self):
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/scatter_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class ScatterViewProperties(object):
class ScatterViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -74,6 +75,7 @@ class ScatterViewProperties(object):

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
"""ScatterViewProperties - a model defined in OpenAPI""" # noqa: E501
ViewProperties.__init__(self)

self._type = None
self._queries = None
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/single_stat_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class SingleStatViewProperties(object):
class SingleStatViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -58,6 +59,7 @@ class SingleStatViewProperties(object):

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
"""SingleStatViewProperties - a model defined in OpenAPI""" # noqa: E501
ViewProperties.__init__(self)

self._type = None
self._queries = None
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/table_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class TableViewProperties(object):
class TableViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -58,6 +59,7 @@ class TableViewProperties(object):

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
"""TableViewProperties - a model defined in OpenAPI""" # noqa: E501
ViewProperties.__init__(self)

self._type = None
self._queries = None
Expand Down
4 changes: 3 additions & 1 deletion influxdb2/domain/xy_view_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
import re # noqa: F401

import six
from influxdb2.domain.view_properties import ViewProperties


class XYViewProperties(object):
class XYViewProperties(ViewProperties):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Expand Down Expand Up @@ -62,6 +63,7 @@ class XYViewProperties(object):

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
"""XYViewProperties - a model defined in OpenAPI""" # noqa: E501
ViewProperties.__init__(self)

self._type = None
self._queries = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,24 @@ public void processOpts() {
public CodegenModel fromModel(final String name, final Schema model, final Map<String, Schema> allDefinitions) {
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);

if (name.endsWith("ViewProperties") && !name.equals("ViewProperties"))
{
codegenModel.setParent("ViewProperties");
codegenModel.setParentSchema("ViewProperties");
}

if (allDefinitions.containsKey(name + "Base")) {
codegenModel.setParent(name + "Base");
codegenModel.setParentSchema(name + "Base");
}

if (name.equals("ViewProperties")) {
codegenModel.setReadWriteVars(new ArrayList<>());
codegenModel.setRequiredVars(new ArrayList<>());
codegenModel.hasOnlyReadOnly = true;
codegenModel.hasRequired = false;
}

return codegenModel;
}

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

0 comments on commit 9394449

Please sign in to comment.