Skip to content

Commit ff5986a

Browse files
pthieudavidcheung
andauthored
Upgrade to openapi-generator@7 (#40)
* Upgrade to openapi-generator@7 * fixup! Upgrade to openapi-generator@7 --------- Co-authored-by: David Cheung <[email protected]>
1 parent d92c214 commit ff5986a

File tree

7 files changed

+15
-15
lines changed

7 files changed

+15
-15
lines changed

.github/workflows/build-and-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
2828
- name: Generate code
2929
run: |
30-
docker run --rm -v ${GITHUB_WORKSPACE}:/local openapitools/openapi-generator:cli-5.3.x generate -i /local/api/notification-service.yaml -g go-server -o /local/ -p sourceFolder=internal/server -p packageName=server --git-user-id=commitdev --git-repo-id=zero-notification-service
30+
docker run --rm -v ${GITHUB_WORKSPACE}:/local openapitools/openapi-generator-cli:v7.0.0 generate -i /local/api/notification-service.yaml -g go-server -o /local/ -p sourceFolder=internal/server -p packageName=server --git-user-id=commitdev --git-repo-id=zero-notification-service
3131
sudo chmod -R a+rw ${GITHUB_WORKSPACE}
3232
go install golang.org/x/tools/cmd/goimports@latest
3333
goimports -w ${GITHUB_WORKSPACE}/internal/server/

.openapi-generator/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.6.0
1+
7.0.0

cmd/server/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,16 @@ func main() {
4646
go heartbeat()
4747

4848
EmailApiService := service.NewEmailApiService(config)
49-
EmailApiController := server.NewEmailApiController(EmailApiService)
49+
EmailApiController := server.NewEmailAPIController(EmailApiService)
5050

5151
SmsApiService := service.NewSmsApiService(config)
52-
SmsApiController := server.NewSmsApiController(SmsApiService)
52+
SmsApiController := server.NewSmsAPIController(SmsApiService)
5353

5454
HealthApiService := service.NewHealthApiService(config)
55-
HealthApiController := server.NewHealthApiController(HealthApiService)
55+
HealthApiController := server.NewHealthAPIController(HealthApiService)
5656

5757
NotificationApiService := service.NewNotificationApiService(config)
58-
NotificationApiController := server.NewNotificationApiController(NotificationApiService)
58+
NotificationApiController := server.NewNotificationAPIController(NotificationApiService)
5959

6060
router := server.NewRouter(EmailApiController, SmsApiController, HealthApiController, NotificationApiController)
6161

internal/service/api_email_service.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type EmailApiService struct {
2020
}
2121

2222
// NewEmailApiService creates a default api service
23-
func NewEmailApiService(c *config.Config) server.EmailApiServicer {
23+
func NewEmailApiService(c *config.Config) server.EmailAPIServicer {
2424
return &EmailApiService{c}
2525
}
2626

@@ -82,19 +82,19 @@ func (s *EmailApiService) SendBulk(ctx context.Context, sendBulkMailRequest serv
8282

8383
mail.SendBulkMail(sendBulkMailRequest.ToAddresses, sendBulkMailRequest.FromAddress, sendBulkMailRequest.CcAddresses, sendBulkMailRequest.BccAddresses, sendBulkMailRequest.Headers, sendBulkMailRequest.Message, client, responseChannel)
8484

85-
var successful []server.SendBulkMailResponseSuccessful
86-
var failed []server.SendBulkMailResponseFailed
85+
var successful []server.SendBulkMailResponseSuccessfulInner
86+
var failed []server.SendBulkMailResponseFailedInner
8787

8888
// Read all the responses from the channel. This will block if responses aren't ready and the channel is not yet closed
8989
for r := range responseChannel {
9090
if r.Error != nil {
9191
zap.S().Errorf("Error sending bulk mail: %v", r.Error)
92-
failed = append(failed, server.SendBulkMailResponseFailed{EmailAddress: r.EmailAddress, Error: fmt.Sprintf("Unable to send email: %v\n", r.Error)})
92+
failed = append(failed, server.SendBulkMailResponseFailedInner{EmailAddress: r.EmailAddress, Error: fmt.Sprintf("Unable to send email: %v\n", r.Error)})
9393
} else if !(r.Response.StatusCode >= 200 && r.Response.StatusCode <= 299) {
9494
zap.S().Errorf("Failure from Sendgrid when sending bulk mail: %v", r.Response)
95-
failed = append(failed, server.SendBulkMailResponseFailed{EmailAddress: r.EmailAddress, Error: fmt.Sprintf("Unable to send email: %v from mail provider: %v\n", r.Response.StatusCode, r.Response.Body)})
95+
failed = append(failed, server.SendBulkMailResponseFailedInner{EmailAddress: r.EmailAddress, Error: fmt.Sprintf("Unable to send email: %v from mail provider: %v\n", r.Response.StatusCode, r.Response.Body)})
9696
} else {
97-
successful = append(successful, server.SendBulkMailResponseSuccessful{EmailAddress: r.EmailAddress, TrackingId: r.Response.Headers["X-Message-Id"][0]})
97+
successful = append(successful, server.SendBulkMailResponseSuccessfulInner{EmailAddress: r.EmailAddress, TrackingId: r.Response.Headers["X-Message-Id"][0]})
9898
}
9999
}
100100
responseCode := http.StatusOK

internal/service/api_health_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ type HealthApiService struct {
1616
}
1717

1818
// NewHealthApiService creates a default api service
19-
func NewHealthApiService(c *config.Config) server.HealthApiServicer {
19+
func NewHealthApiService(c *config.Config) server.HealthAPIServicer {
2020
return &HealthApiService{c}
2121
}
2222

internal/service/api_notification_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type NotificationApiService struct {
2020
}
2121

2222
// NewNotificationApiService creates a default api service
23-
func NewNotificationApiService(c *config.Config) server.NotificationApiServicer {
23+
func NewNotificationApiService(c *config.Config) server.NotificationAPIServicer {
2424
return &NotificationApiService{c}
2525
}
2626

internal/service/api_sms_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ type SmsApiService struct {
2121
}
2222

2323
// NewSmsApiService creates a default api service
24-
func NewSmsApiService(c *config.Config) server.SmsApiServicer {
24+
func NewSmsApiService(c *config.Config) server.SmsAPIServicer {
2525
return &SmsApiService{c}
2626
}
2727

0 commit comments

Comments
 (0)