Skip to content

Commit 65aeb0a

Browse files
authored
fix: make courier.TemplateType an enum (#2875)
1 parent 705f7b1 commit 65aeb0a

File tree

4 files changed

+48
-13
lines changed

4 files changed

+48
-13
lines changed

courier/email_templates.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ import (
1212
)
1313

1414
type (
15-
TemplateType string
16-
1715
EmailTemplate interface {
1816
json.Marshaler
1917
EmailSubject(context.Context) (string, error)
@@ -23,6 +21,11 @@ type (
2321
}
2422
)
2523

24+
// A Template's type
25+
//
26+
// swagger:enum TemplateType
27+
type TemplateType string
28+
2629
const (
2730
TypeRecoveryInvalid TemplateType = "recovery_invalid"
2831
TypeRecoveryValid TemplateType = "recovery_valid"

internal/httpclient/api/openapi.yaml

+19-3
Original file line numberDiff line numberDiff line change
@@ -3649,8 +3649,6 @@ components:
36493649
title: RecoveryAddressType must not exceed 16 characters as that is the limitation
36503650
in the SQL Schema.
36513651
type: string
3652-
TemplateType:
3653-
type: string
36543652
Time:
36553653
format: date-time
36563654
type: string
@@ -4297,7 +4295,7 @@ components:
42974295
recipient: recipient
42984296
created_at: 2000-01-23T04:56:07.000+00:00
42994297
send_count: 0
4300-
template_type: template_type
4298+
template_type: recovery_invalid
43014299
id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
43024300
body: body
43034301
properties:
@@ -4320,7 +4318,25 @@ components:
43204318
subject:
43214319
type: string
43224320
template_type:
4321+
enum:
4322+
- recovery_invalid
4323+
- recovery_valid
4324+
- recovery_code_invalid
4325+
- recovery_code_valid
4326+
- verification_invalid
4327+
- verification_valid
4328+
- otp
4329+
- stub
43234330
type: string
4331+
x-go-enum-desc: |-
4332+
recovery_invalid TypeRecoveryInvalid
4333+
recovery_valid TypeRecoveryValid
4334+
recovery_code_invalid TypeRecoveryCodeInvalid
4335+
recovery_code_valid TypeRecoveryCodeValid
4336+
verification_invalid TypeVerificationInvalid
4337+
verification_valid TypeVerificationValid
4338+
otp TypeOTP
4339+
stub TypeTestStub
43244340
type:
43254341
$ref: '#/components/schemas/courierMessageType'
43264342
updated_at:

spec/api.json

+12-4
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,6 @@
330330
"title": "RecoveryAddressType must not exceed 16 characters as that is the limitation in the SQL Schema.",
331331
"type": "string"
332332
},
333-
"TemplateType": {
334-
"type": "string"
335-
},
336333
"Time": {
337334
"format": "date-time",
338335
"type": "string"
@@ -940,7 +937,18 @@
940937
"type": "string"
941938
},
942939
"template_type": {
943-
"$ref": "#/components/schemas/TemplateType"
940+
"enum": [
941+
"recovery_invalid",
942+
"recovery_valid",
943+
"recovery_code_invalid",
944+
"recovery_code_valid",
945+
"verification_invalid",
946+
"verification_valid",
947+
"otp",
948+
"stub"
949+
],
950+
"type": "string",
951+
"x-go-enum-desc": "recovery_invalid TypeRecoveryInvalid\nrecovery_valid TypeRecoveryValid\nrecovery_code_invalid TypeRecoveryCodeInvalid\nrecovery_code_valid TypeRecoveryCodeValid\nverification_invalid TypeVerificationInvalid\nverification_valid TypeVerificationValid\notp TypeOTP\nstub TypeTestStub"
944952
},
945953
"type": {
946954
"$ref": "#/components/schemas/courierMessageType"

spec/swagger.json

+12-4
Original file line numberDiff line numberDiff line change
@@ -3059,9 +3059,6 @@
30593059
"type": "string",
30603060
"title": "RecoveryAddressType must not exceed 16 characters as that is the limitation in the SQL Schema."
30613061
},
3062-
"TemplateType": {
3063-
"type": "string"
3064-
},
30653062
"UUID": {"type": "string", "format": "uuid4"},
30663063
"adminCreateIdentityBody": {
30673064
"type": "object",
@@ -3641,7 +3638,18 @@
36413638
"type": "string"
36423639
},
36433640
"template_type": {
3644-
"$ref": "#/definitions/TemplateType"
3641+
"type": "string",
3642+
"enum": [
3643+
"recovery_invalid",
3644+
"recovery_valid",
3645+
"recovery_code_invalid",
3646+
"recovery_code_valid",
3647+
"verification_invalid",
3648+
"verification_valid",
3649+
"otp",
3650+
"stub"
3651+
],
3652+
"x-go-enum-desc": "recovery_invalid TypeRecoveryInvalid\nrecovery_valid TypeRecoveryValid\nrecovery_code_invalid TypeRecoveryCodeInvalid\nrecovery_code_valid TypeRecoveryCodeValid\nverification_invalid TypeVerificationInvalid\nverification_valid TypeVerificationValid\notp TypeOTP\nstub TypeTestStub"
36453653
},
36463654
"type": {
36473655
"$ref": "#/definitions/courierMessageType"

0 commit comments

Comments
 (0)