Skip to content

Commit

Permalink
drop discriminator enum
Browse files Browse the repository at this point in the history
  • Loading branch information
tokuhirom committed Oct 27, 2023
1 parent dab09d3 commit ac8e394
Show file tree
Hide file tree
Showing 100 changed files with 82 additions and 289 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ private String type(CodegenModel model, CodegenProperty var) {
return var.datatypeWithEnum + "Interface";
} else if (var.isModel) {
return "*" + var.datatypeWithEnum;
} else if (model.parentModel != null && Objects.equals(model.parentModel.discriminator.getPropertyName(), var.name)) {
return model.parentModel.classname + model.parentModel.discriminator.getPropertyName();
} else {
return var.datatypeWithEnum;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ import (
"errors"
)

{# Following enum is required??? maybe not used anymore. #}
// {{ model.classname }}{{ model.discriminator.propertyName }} type
type {{ model.classname }}{{ model.discriminator.propertyName }} string

// {{ model.classname }}{{ model.discriminator.propertyName }} constants
const (
{% for mm in model.discriminator.mappedModels -%}
{{ model.classname }}{{ model.discriminator.propertyName }}{{ mm.mappingName | capitalize }} {{ model.classname }}{{ model.discriminator.propertyName }} = "{{mm.modelName}}"
{% endfor %}
)

{# e.g. MessageInterface #}
type {{ model.classname }}Interface interface {
Get{{ model.discriminator.propertyName }}() string
Expand Down
15 changes: 0 additions & 15 deletions linebot/messaging_api/model_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,6 @@ import (
"log"
)

// ActionType type
type ActionType string

// ActionType constants
const (
ActionTypeCamera ActionType = "CameraAction"
ActionTypeCameraRoll ActionType = "CameraRollAction"
ActionTypeDatetimepicker ActionType = "DatetimePickerAction"
ActionTypeLocation ActionType = "LocationAction"
ActionTypeMessage ActionType = "MessageAction"
ActionTypePostback ActionType = "PostbackAction"
ActionTypeRichmenuswitch ActionType = "RichMenuSwitchAction"
ActionTypeUri ActionType = "UriAction"
)

type ActionInterface interface {
GetType() string
}
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_age_demographic_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (r *AgeDemographicFilter) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type DemographicFilterType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_app_type_demographic_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *AppTypeDemographicFilter) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type DemographicFilterType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_area_demographic_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *AreaDemographicFilter) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type DemographicFilterType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_audience_recipient.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *AudienceRecipient) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type RecipientType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_audio_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (r *AudioMessage) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type MessageType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_buttons_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (r *ButtonsTemplate) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type TemplateType `json:"type"`
Type string `json:"type"`

Actions []ActionInterface `json:"actions"`
}{
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_camera_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *CameraAction) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type ActionType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_camera_roll_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *CameraRollAction) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type ActionType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_carousel_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (r *CarouselTemplate) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type TemplateType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_confirm_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (r *ConfirmTemplate) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type TemplateType `json:"type"`
Type string `json:"type"`

Actions []ActionInterface `json:"actions"`
}{
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_datetime_picker_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (r *DatetimePickerAction) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type ActionType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
13 changes: 0 additions & 13 deletions linebot/messaging_api/model_demographic_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ import (
"log"
)

// DemographicFilterType type
type DemographicFilterType string

// DemographicFilterType constants
const (
DemographicFilterTypeAge DemographicFilterType = "AgeDemographicFilter"
DemographicFilterTypeAppType DemographicFilterType = "AppTypeDemographicFilter"
DemographicFilterTypeArea DemographicFilterType = "AreaDemographicFilter"
DemographicFilterTypeGender DemographicFilterType = "GenderDemographicFilter"
DemographicFilterTypeOperator DemographicFilterType = "OperatorDemographicFilter"
DemographicFilterTypeSubscriptionPeriod DemographicFilterType = "SubscriptionPeriodDemographicFilter"
)

type DemographicFilterInterface interface {
GetType() string
}
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func (r *FlexBox) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`

Contents []FlexComponentInterface `json:"contents"`
}{
Expand Down
8 changes: 0 additions & 8 deletions linebot/messaging_api/model_flex_box_background.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ import (
"log"
)

// FlexBoxBackgroundType type
type FlexBoxBackgroundType string

// FlexBoxBackgroundType constants
const (
FlexBoxBackgroundTypeLinearGradient FlexBoxBackgroundType = "FlexBoxLinearGradient"
)

type FlexBoxBackgroundInterface interface {
GetType() string
}
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_box_linear_gradient.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (r *FlexBoxLinearGradient) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexBoxBackgroundType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_bubble.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (r *FlexBubble) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexContainerType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_button.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func (r *FlexButton) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_carousel.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r *FlexCarousel) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexContainerType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
16 changes: 0 additions & 16 deletions linebot/messaging_api/model_flex_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,6 @@ import (
"log"
)

// FlexComponentType type
type FlexComponentType string

// FlexComponentType constants
const (
FlexComponentTypeBox FlexComponentType = "FlexBox"
FlexComponentTypeButton FlexComponentType = "FlexButton"
FlexComponentTypeFiller FlexComponentType = "FlexFiller"
FlexComponentTypeIcon FlexComponentType = "FlexIcon"
FlexComponentTypeImage FlexComponentType = "FlexImage"
FlexComponentTypeSeparator FlexComponentType = "FlexSeparator"
FlexComponentTypeSpan FlexComponentType = "FlexSpan"
FlexComponentTypeText FlexComponentType = "FlexText"
FlexComponentTypeVideo FlexComponentType = "FlexVideo"
)

type FlexComponentInterface interface {
GetType() string
}
Expand Down
9 changes: 0 additions & 9 deletions linebot/messaging_api/model_flex_container.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ import (
"log"
)

// FlexContainerType type
type FlexContainerType string

// FlexContainerType constants
const (
FlexContainerTypeBubble FlexContainerType = "FlexBubble"
FlexContainerTypeCarousel FlexContainerType = "FlexCarousel"
)

type FlexContainerInterface interface {
GetType() string
}
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_filler.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *FlexFiller) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_icon.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (r *FlexIcon) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (r *FlexImage) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (r *FlexMessage) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type MessageType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_separator.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (r *FlexSeparator) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_span.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (r *FlexSpan) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (r *FlexText) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_flex_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func (r *FlexVideo) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type FlexComponentType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_gender_demographic_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *GenderDemographicFilter) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type DemographicFilterType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_image_carousel_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r *ImageCarouselTemplate) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type TemplateType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_image_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (r *ImageMessage) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type MessageType `json:"type"`
Type string `json:"type"`
}{
Alias: (*Alias)(r),

Expand Down
9 changes: 0 additions & 9 deletions linebot/messaging_api/model_imagemap_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ import (
"log"
)

// ImagemapActionType type
type ImagemapActionType string

// ImagemapActionType constants
const (
ImagemapActionTypeMessage ImagemapActionType = "MessageImagemapAction"
ImagemapActionTypeUri ImagemapActionType = "UriImagemapAction"
)

type ImagemapActionInterface interface {
GetType() string
}
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_imagemap_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (r *ImagemapMessage) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type MessageType `json:"type"`
Type string `json:"type"`

Actions []ImagemapActionInterface `json:"actions"`
}{
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_location_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *LocationAction) MarshalJSON() ([]byte, error) {
return json.Marshal(&struct {
*Alias

Type ActionType `json:"type,omitempty"`
Type string `json:"type,omitempty"`
}{
Alias: (*Alias)(r),

Expand Down
Loading

0 comments on commit ac8e394

Please sign in to comment.