chore: update openapi schema and swagger version (#29)
ci/woodpecker/push/govulncheck Pipeline was successful Details
ci/woodpecker/push/test Pipeline was successful Details

Reviewed-on: twhelp/corev3#29
This commit is contained in:
Dawid Wysokiński 2024-03-18 07:01:47 +00:00
parent 5fa98ce0b6
commit bc1e6617b9
40 changed files with 480 additions and 232 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@ bin/*
additional_envs.sh additional_envs.sh
.kpt-pipeline .kpt-pipeline
tmp tmp
api/domain-error-code.yml

View File

@ -450,6 +450,8 @@ linters-settings:
arguments: arguments:
- fmt.Printf - fmt.Printf
- fmt.Println - fmt.Println
- strings.Builder.*
- bytes.Buffer.*
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt # https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt
- name: unnecessary-stmt - name: unnecessary-stmt
severity: error severity: error

View File

@ -29,8 +29,13 @@ install-tools: install-golangci-lint install-oapi-codegen
.PHONY: install .PHONY: install
install: install-tools install-git-hooks install: install-tools install-git-hooks
.PHONY: generate-domain-error-codes
generate-domain-error-codes:
@echo "Generating error codes..."
@go run ./cmd/errorcodes > api/domain-error-code.yml
.PHONY: generate .PHONY: generate
generate: install-oapi-codegen generate: install-oapi-codegen generate-domain-error-codes
@echo "Running go generate..." @echo "Running go generate..."
go generate ./... go generate ./...

View File

@ -443,6 +443,8 @@ paths:
$ref: "#/components/responses/ErrorResponse" $ref: "#/components/responses/ErrorResponse"
components: components:
schemas: schemas:
DomainErrorCode:
$ref: ./domain-error-code.yml
Error: Error:
type: object type: object
required: required:
@ -451,8 +453,15 @@ components:
additionalProperties: false additionalProperties: false
properties: properties:
code: code:
type: string example: invalid-param-format
example: length-out-of-range allOf:
- $ref: "#/components/schemas/DomainErrorCode"
- type: string
enum:
- method-not-allowed
- route-not-found
- internal-server-error
- invalid-param-format
message: message:
type: string type: string
path: path:
@ -470,6 +479,7 @@ components:
type: string type: string
minLength: 2 minLength: 2
maxLength: 2 maxLength: 2
example: en
Version: Version:
type: object type: object
required: required:
@ -486,14 +496,15 @@ components:
example: www.tribalwars.net example: www.tribalwars.net
name: name:
type: string type: string
example: Poland example: International
timezone: timezone:
type: string type: string
example: Europe/Warsaw example: Europe/London
ServerKey: ServerKey:
type: string type: string
minLength: 1 minLength: 1
maxLength: 10 maxLength: 10
example: en138
Server: Server:
type: object type: object
required: required:
@ -515,7 +526,7 @@ components:
url: url:
type: string type: string
format: uri format: uri
example: https://pl151.plemiona.pl example: https://en138.tribalwars.net
numPlayers: numPlayers:
type: integer type: integer
playerDataSyncedAt: playerDataSyncedAt:
@ -1168,6 +1179,7 @@ components:
profileUrl: profileUrl:
type: string type: string
format: uri format: uri
example: https://en138.tribalwars.net/game.php?screen=info_ally&id=13
points: points:
type: integer type: integer
allPoints: allPoints:
@ -1221,7 +1233,28 @@ components:
profileUrl: profileUrl:
type: string type: string
format: uri format: uri
example: https://en138.tribalwars.net/game.php?screen=info_ally&id=13
NullTribeMeta:
nullable: true
# swagger ui has problems with displaying examples for schemas with allOf
example:
id: 1
name: string
tag: string
profileUrl: https://en138.tribalwars.net/game.php?screen=info_ally&id=13
allOf:
- $ref: "#/components/schemas/TribeMeta"
PlayerOpponentsDefeated: PlayerOpponentsDefeated:
# swagger ui has problems with displaying examples for schemas with allOf
example:
rankAtt: 0,
rankDef: 0,
rankTotal: 0,
scoreAtt: 0,
scoreDef: 0,
scoreTotal: 0
rankSup: 0
scoreSup: 0
allOf: allOf:
- $ref: "#/components/schemas/TribeOpponentsDefeated" - $ref: "#/components/schemas/TribeOpponentsDefeated"
- type: object - type: object
@ -1242,6 +1275,7 @@ components:
- points - points
- numVillages - numVillages
- profileUrl - profileUrl
- tribe
- lastActivityAt - lastActivityAt
- bestRank - bestRank
- bestRankAt - bestRankAt
@ -1265,8 +1299,9 @@ components:
profileUrl: profileUrl:
type: string type: string
format: uri format: uri
example: https://en138.tribalwars.net/game.php?screen=info_player&id=11518097
tribe: tribe:
$ref: "#/components/schemas/TribeMeta" $ref: "#/components/schemas/NullTribeMeta"
lastActivityAt: lastActivityAt:
type: string type: string
format: date-time format: date-time
@ -1299,6 +1334,7 @@ components:
- id - id
- name - name
- profileUrl - profileUrl
- tribe
properties: properties:
id: id:
$ref: "#/components/schemas/IntId" $ref: "#/components/schemas/IntId"
@ -1307,8 +1343,23 @@ components:
profileUrl: profileUrl:
type: string type: string
format: uri format: uri
example: https://en138.tribalwars.net/game.php?screen=info_player&id=11518097
tribe: tribe:
$ref: "#/components/schemas/TribeMeta" $ref: "#/components/schemas/NullTribeMeta"
NullPlayerMeta:
nullable: true
# swagger ui has problems with displaying examples for schemas with allOf
example:
id: 1,
name: string,
profileUrl: https://en138.tribalwars.net/game.php?screen=info_player&id=11518097,
tribe:
id: 1,
name: string,
profileUrl: https://en138.tribalwars.net/game.php?screen=info_ally&id=13,
tag: string
allOf:
- $ref: "#/components/schemas/PlayerMeta"
Village: Village:
type: object type: object
required: required:
@ -1322,6 +1373,7 @@ components:
- continent - continent
- bonus - bonus
- createdAt - createdAt
- player
properties: properties:
id: id:
$ref: "#/components/schemas/IntId" $ref: "#/components/schemas/IntId"
@ -1342,6 +1394,7 @@ components:
profileUrl: profileUrl:
type: string type: string
format: uri format: uri
example: https://en138.tribalwars.net/game.php?screen=info_village&id=57198
continent: continent:
type: string type: string
example: K44 example: K44
@ -1362,7 +1415,7 @@ components:
type: string type: string
format: date-time format: date-time
player: player:
$ref: "#/components/schemas/PlayerMeta" $ref: "#/components/schemas/NullPlayerMeta"
VillageMeta: VillageMeta:
type: object type: object
required: required:
@ -1372,6 +1425,7 @@ components:
- y - y
- profileUrl - profileUrl
- continent - continent
- player
properties: properties:
id: id:
$ref: "#/components/schemas/IntId" $ref: "#/components/schemas/IntId"
@ -1387,16 +1441,18 @@ components:
profileUrl: profileUrl:
type: string type: string
format: uri format: uri
example: https://en138.tribalwars.net/game.php?screen=info_village&id=57198
continent: continent:
type: string type: string
example: K44 example: K44
player: player:
$ref: "#/components/schemas/PlayerMeta" $ref: "#/components/schemas/NullPlayerMeta"
Ennoblement: Ennoblement:
type: object type: object
required: required:
- id - id
- points - points
- newOwner
- village - village
- createdAt - createdAt
properties: properties:
@ -1416,6 +1472,7 @@ components:
required: required:
- id - id
- player - player
- newTribe
- createdAt - createdAt
properties: properties:
id: id:
@ -1423,26 +1480,29 @@ components:
player: player:
$ref: "#/components/schemas/PlayerMeta" $ref: "#/components/schemas/PlayerMeta"
newTribe: newTribe:
$ref: "#/components/schemas/TribeMeta" $ref: "#/components/schemas/NullTribeMeta"
createdAt: createdAt:
type: string type: string
format: date-time format: date-time
CursorString:
type: string
minLength: 1
maxLength: 1000
example: aWQ9NTU3LHNlcnZlcktleT1wbDE5Mw==
Cursor: Cursor:
type: object type: object
x-go-type-skip-optional-pointer: true x-go-type-skip-optional-pointer: true
properties: properties:
self: self:
description: Cursor pointing to the current page. description: Cursor pointing to the current page.
type: string
minLength: 1
maxLength: 1000
x-go-type-skip-optional-pointer: true x-go-type-skip-optional-pointer: true
allOf:
- $ref: "#/components/schemas/CursorString"
next: next:
description: Cursor pointing to the next page. description: Cursor pointing to the next page.
type: string
minLength: 1
maxLength: 1000
x-go-type-skip-optional-pointer: true x-go-type-skip-optional-pointer: true
allOf:
- $ref: "#/components/schemas/CursorString"
PaginationResponse: PaginationResponse:
type: object type: object
properties: properties:
@ -1453,9 +1513,7 @@ components:
in: query in: query
name: cursor name: cursor
schema: schema:
type: string $ref: "#/components/schemas/CursorString"
minLength: 1
maxLength: 1000
required: false required: false
LimitQueryParam: LimitQueryParam:
in: query in: query

149
cmd/errorcodes/main.go Normal file
View File

@ -0,0 +1,149 @@
package main
import (
"errors"
"go/ast"
"go/constant"
"go/importer"
"go/parser"
"go/token"
"go/types"
"io/fs"
"log"
"os"
"strings"
"gopkg.in/yaml.v3"
)
func main() {
if _, err := os.Stat("./go.mod"); errors.Is(err, os.ErrNotExist) {
log.Fatalln("go.mod not found")
}
if err := generateYAML("./internal/domain"); err != nil {
log.Fatalln(err)
}
}
func generateYAML(root string) error {
m, err := getErrorCodesFromFolder(root)
if err != nil {
return err
}
var description strings.Builder
enum := make([]string, 0, len(m))
for c, d := range m {
if d != "" {
if description.Len() > 0 {
description.WriteRune('\n')
}
description.WriteString("* `")
description.WriteString(c)
description.WriteString("` - ")
description.WriteString(d)
}
enum = append(enum, c)
}
return yaml.NewEncoder(os.Stdout).Encode(struct {
Type string `yaml:"type"`
Description string `yaml:"description"`
Enum []string `yaml:"enum"`
}{
Type: "string",
Description: description.String(),
Enum: enum,
})
}
//nolint:gocyclo
func getErrorCodesFromFolder(root string) (map[string]string, error) {
fset := token.NewFileSet()
astDomainPkg, err := parseDomainPackage(fset, root)
if err != nil {
return nil, err
}
conf := types.Config{Importer: importer.Default()}
files := make([]*ast.File, 0, len(astDomainPkg.Files))
for _, f := range astDomainPkg.Files {
files = append(files, f)
}
domainPkg, err := conf.Check(astDomainPkg.Name, fset, files, nil)
if err != nil {
return nil, err
}
scope := domainPkg.Scope()
m := make(map[string]string)
for _, n := range scope.Names() {
if !strings.HasPrefix(n, "errorCode") {
continue
}
obj := scope.Lookup(n)
c, ok := obj.(*types.Const)
if !ok || c.Val().Kind() != constant.String {
continue
}
f := astDomainPkg.Files[fset.File(c.Pos()).Name()]
position := fset.Position(c.Pos())
commentMap := ast.NewCommentMap(fset, f, f.Comments)
var desc string
for _, decl := range f.Decls {
declPosition := fset.Position(decl.Pos())
if declPosition.Filename != position.Filename || declPosition.Line != position.Line {
continue
}
if comments := commentMap.Filter(decl).Comments(); len(comments) > 0 {
desc = strings.TrimSpace(comments[0].Text())
}
break
}
if strings.Contains(desc, "ignorecode") {
continue
}
m[constant.StringVal(c.Val())] = desc
}
return m, nil
}
func parseDomainPackage(fset *token.FileSet, root string) (*ast.Package, error) {
pkgs, err := parser.ParseDir(fset, root, func(info fs.FileInfo) bool {
if info.IsDir() && info.Name() != root {
return false
}
if info.IsDir() || strings.HasSuffix(info.Name(), "_test.go") {
return false
}
return true
}, parser.AllErrors|parser.ParseComments)
if err != nil {
return nil, err
}
astDomainPkg, ok := pkgs["domain"]
if !ok {
return nil, errors.New("domain pkg not found")
}
return astDomainPkg, nil
}

2
go.mod
View File

@ -28,6 +28,7 @@ require (
github.com/uptrace/bun/extra/bundebug v1.1.17 github.com/uptrace/bun/extra/bundebug v1.1.17
github.com/urfave/cli/v2 v2.27.1 github.com/urfave/cli/v2 v2.27.1
golang.org/x/sync v0.6.0 golang.org/x/sync v0.6.0
gopkg.in/yaml.v3 v3.0.1
) )
require ( require (
@ -89,7 +90,6 @@ require (
golang.org/x/sys v0.16.0 // indirect golang.org/x/sys v0.16.0 // indirect
golang.org/x/tools v0.16.1 // indirect golang.org/x/tools v0.16.1 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/uint128 v1.3.0 // indirect lukechampine.com/uint128 v1.3.0 // indirect
mellium.im/sasl v0.3.1 // indirect mellium.im/sasl v0.3.1 // indirect
modernc.org/cc/v3 v3.41.0 // indirect modernc.org/cc/v3 v3.41.0 // indirect

View File

@ -608,8 +608,7 @@ func testEnnoblementRepository(t *testing.T, newRepos func(t *testing.T) reposit
for i, e := range resWithRelations.Ennoblements() { for i, e := range resWithRelations.Ennoblements() {
assert.Equal(t, res.Ennoblements()[i], e.Ennoblement()) assert.Equal(t, res.Ennoblements()[i], e.Ennoblement())
assert.Equal(t, e.Ennoblement().VillageID(), e.Village().ID()) assert.Equal(t, e.Ennoblement().VillageID(), e.Village().ID())
assert.Equal(t, e.Ennoblement().NewOwnerID(), e.NewOwner().V.ID()) assert.Equal(t, e.Ennoblement().NewOwnerID(), e.NewOwner().ID())
assert.Equal(t, e.Ennoblement().NewOwnerID() != 0, e.NewOwner().Valid)
assert.Equal(t, e.Ennoblement().NewTribeID(), e.NewTribe().V.ID()) assert.Equal(t, e.Ennoblement().NewTribeID(), e.NewTribe().V.ID())
assert.Equal(t, e.Ennoblement().NewTribeID() != 0, e.NewTribe().Valid) assert.Equal(t, e.Ennoblement().NewTribeID() != 0, e.NewTribe().Valid)
assert.Equal(t, e.Ennoblement().OldOwnerID(), e.OldOwner().V.ID()) assert.Equal(t, e.Ennoblement().OldOwnerID(), e.OldOwner().V.ID())

View File

@ -67,10 +67,10 @@ func (e Ennoblement) ToDomainWithRelations() (domain.EnnoblementWithRelations, e
} }
} }
var newOwner domain.NullPlayerMeta // in some cases there is no corresponding player in the db (for example, for old ennoblements)
var newOwner domain.PlayerMeta
if e.NewOwner.ID > 0 { if e.NewOwner.ID > 0 {
newOwner.Valid = true newOwner, err = e.NewOwner.ToMeta()
newOwner.V, err = e.NewOwner.ToMeta()
if err != nil { if err != nil {
return domain.EnnoblementWithRelations{}, err return domain.EnnoblementWithRelations{}, err
} }

View File

@ -163,10 +163,7 @@ func NewEnnoblementWithRelations(
return e.WithRelations( return e.WithRelations(
village, village,
domain.NullPlayerMeta{ newOwner,
V: newOwner,
Valid: !newOwner.IsZero(),
},
domain.NullTribeMeta{ domain.NullTribeMeta{
V: newTribe, V: newTribe,
Valid: !newTribe.IsZero(), Valid: !newTribe.IsZero(),

View File

@ -102,7 +102,7 @@ func (e Ennoblement) CreatedAt() time.Time {
func (e Ennoblement) WithRelations( func (e Ennoblement) WithRelations(
village VillageMeta, village VillageMeta,
newOwner NullPlayerMeta, newOwner PlayerMeta,
newTribe NullTribeMeta, newTribe NullTribeMeta,
oldOwner NullPlayerMeta, oldOwner NullPlayerMeta,
oldTribe NullTribeMeta, oldTribe NullTribeMeta,
@ -142,7 +142,7 @@ type Ennoblements []Ennoblement
type EnnoblementWithRelations struct { type EnnoblementWithRelations struct {
ennoblement Ennoblement ennoblement Ennoblement
village VillageMeta village VillageMeta
newOwner NullPlayerMeta newOwner PlayerMeta
newTribe NullTribeMeta newTribe NullTribeMeta
oldOwner NullPlayerMeta oldOwner NullPlayerMeta
oldTribe NullTribeMeta oldTribe NullTribeMeta
@ -156,7 +156,7 @@ func (e EnnoblementWithRelations) Village() VillageMeta {
return e.village return e.village
} }
func (e EnnoblementWithRelations) NewOwner() NullPlayerMeta { func (e EnnoblementWithRelations) NewOwner() PlayerMeta {
return e.newOwner return e.newOwner
} }

View File

@ -1151,8 +1151,10 @@ func (e PlayerNotFoundError) Type() ErrorType {
return ErrorTypeNotFound return ErrorTypeNotFound
} }
const errorCodePlayerNotFound = "player-not-found"
func (e PlayerNotFoundError) Code() string { func (e PlayerNotFoundError) Code() string {
return "player-not-found" return errorCodePlayerNotFound
} }
func (e PlayerNotFoundError) Params() map[string]any { func (e PlayerNotFoundError) Params() map[string]any {

View File

@ -847,8 +847,10 @@ func (e ServerNotFoundError) Type() ErrorType {
return ErrorTypeNotFound return ErrorTypeNotFound
} }
const errorCodeServerNotFound = "server-not-found"
func (e ServerNotFoundError) Code() string { func (e ServerNotFoundError) Code() string {
return "server-not-found" return errorCodeServerNotFound
} }
func (e ServerNotFoundError) Params() map[string]any { func (e ServerNotFoundError) Params() map[string]any {

View File

@ -984,8 +984,10 @@ func (e TribeNotFoundError) Type() ErrorType {
return ErrorTypeNotFound return ErrorTypeNotFound
} }
const errorCodeTribeNotFound = "tribe-not-found"
func (e TribeNotFoundError) Code() string { func (e TribeNotFoundError) Code() string {
return "tribe-not-found" return errorCodeTribeNotFound
} }
func (e TribeNotFoundError) Params() map[string]any { func (e TribeNotFoundError) Params() map[string]any {

View File

@ -70,12 +70,12 @@ func encodeCursor(kvps []keyValuePair) string {
for i, kvp := range kvps { for i, kvp := range kvps {
if b.Len() > 0 { if b.Len() > 0 {
_, _ = b.WriteString(cursorSeparator) b.WriteString(cursorSeparator)
} }
_, _ = b.WriteString(kvp.key) b.WriteString(kvp.key)
_, _ = b.WriteString(cursorKeyValueSeparator) b.WriteString(cursorKeyValueSeparator)
_, _ = b.WriteString(values[i]) b.WriteString(values[i])
} }
return base64.StdEncoding.EncodeToString(b.Bytes()) return base64.StdEncoding.EncodeToString(b.Bytes())

View File

@ -40,12 +40,15 @@ func (e ValidationError) Type() ErrorType {
return ErrorTypeIncorrectInput return ErrorTypeIncorrectInput
} }
// ignorecode
const errorCodeValidationFailed = "validation-failed"
func (e ValidationError) Code() string { func (e ValidationError) Code() string {
var domainErr Error var domainErr Error
if errors.As(e.Err, &domainErr) { if errors.As(e.Err, &domainErr) {
return domainErr.Code() return domainErr.Code()
} }
return "validation-failed" return errorCodeValidationFailed
} }
func (e ValidationError) Params() map[string]any { func (e ValidationError) Params() map[string]any {
@ -96,12 +99,15 @@ func (e SliceElementValidationError) Type() ErrorType {
return ErrorTypeIncorrectInput return ErrorTypeIncorrectInput
} }
// ignorecode
const errorCodeSliceElementValidationFailed = "slice-element-validation-failed"
func (e SliceElementValidationError) Code() string { func (e SliceElementValidationError) Code() string {
var domainErr Error var domainErr Error
if errors.As(e.Err, &domainErr) { if errors.As(e.Err, &domainErr) {
return domainErr.Code() return domainErr.Code()
} }
return "slice-element-validation-failed" return errorCodeSliceElementValidationFailed
} }
func (e SliceElementValidationError) Params() map[string]any { func (e SliceElementValidationError) Params() map[string]any {
@ -131,8 +137,10 @@ func (e MinGreaterEqualError) Type() ErrorType {
return ErrorTypeIncorrectInput return ErrorTypeIncorrectInput
} }
const errorCodeMinGreaterEqual = "min-greater-equal"
func (e MinGreaterEqualError) Code() string { func (e MinGreaterEqualError) Code() string {
return "min-greater-equal" return errorCodeMinGreaterEqual
} }
func (e MinGreaterEqualError) Params() map[string]any { func (e MinGreaterEqualError) Params() map[string]any {
@ -157,8 +165,10 @@ func (e MaxLessEqualError) Type() ErrorType {
return ErrorTypeIncorrectInput return ErrorTypeIncorrectInput
} }
const errorCodeMaxLessEqual = "max-less-equal"
func (e MaxLessEqualError) Code() string { func (e MaxLessEqualError) Code() string {
return "max-less-equal" return errorCodeMaxLessEqual
} }
func (e MaxLessEqualError) Params() map[string]any { func (e MaxLessEqualError) Params() map[string]any {
@ -184,8 +194,10 @@ func (e LenOutOfRangeError) Type() ErrorType {
return ErrorTypeIncorrectInput return ErrorTypeIncorrectInput
} }
const errorCodeLenOutOfRange = "length-out-of-range"
func (e LenOutOfRangeError) Code() string { func (e LenOutOfRangeError) Code() string {
return "length-out-of-range" return errorCodeLenOutOfRange
} }
func (e LenOutOfRangeError) Params() map[string]any { func (e LenOutOfRangeError) Params() map[string]any {
@ -210,8 +222,10 @@ func (e InvalidURLError) Type() ErrorType {
return ErrorTypeIncorrectInput return ErrorTypeIncorrectInput
} }
const errorCodeInvalidURL = "invalid-url"
func (e InvalidURLError) Code() string { func (e InvalidURLError) Code() string {
return "invalid-url" return errorCodeInvalidURL
} }
func (e InvalidURLError) Params() map[string]any { func (e InvalidURLError) Params() map[string]any {
@ -234,8 +248,10 @@ func (e UnsupportedSortStringError) Type() ErrorType {
return ErrorTypeIncorrectInput return ErrorTypeIncorrectInput
} }
const errorCodeUnsupportedSortString = "unsupported-sort-string"
func (e UnsupportedSortStringError) Code() string { func (e UnsupportedSortStringError) Code() string {
return "unsupported-sort-string" return errorCodeUnsupportedSortString
} }
func (e UnsupportedSortStringError) Params() map[string]any { func (e UnsupportedSortStringError) Params() map[string]any {
@ -258,8 +274,10 @@ func (e SortConflictError) Type() ErrorType {
return ErrorTypeIncorrectInput return ErrorTypeIncorrectInput
} }
const errorCodeSortConflict = "sort-conflict"
func (e SortConflictError) Code() string { func (e SortConflictError) Code() string {
return "sort-conflict" return errorCodeSortConflict
} }
func (e SortConflictError) Params() map[string]any { func (e SortConflictError) Params() map[string]any {
@ -268,23 +286,32 @@ func (e SortConflictError) Params() map[string]any {
} }
} }
// This error code is returned when a value can't be blank.
const errorCodeRequired = "required"
var ErrRequired error = simpleError{ var ErrRequired error = simpleError{
msg: "can't be blank", msg: "can't be blank",
typ: ErrorTypeIncorrectInput, typ: ErrorTypeIncorrectInput,
code: "required", code: errorCodeRequired,
} }
// This error code is returned when a value can't be nil.
const errorCodeNil = "nil"
var ErrNil error = simpleError{ var ErrNil error = simpleError{
msg: "must not be nil", msg: "must not be nil",
typ: ErrorTypeIncorrectInput, typ: ErrorTypeIncorrectInput,
code: "nil", code: errorCodeNil,
} }
// This error code is returned when a cursor can't be decoded (e.g. is malformed).
const errorCodeInvalidCursor = "invalid-cursor"
// ErrInvalidCursor is an error that is returned when a cursor can't be decoded (e.g. is malformed). // ErrInvalidCursor is an error that is returned when a cursor can't be decoded (e.g. is malformed).
var ErrInvalidCursor error = simpleError{ var ErrInvalidCursor error = simpleError{
msg: "invalid cursor", msg: "invalid cursor",
typ: ErrorTypeIncorrectInput, typ: ErrorTypeIncorrectInput,
code: "invalid-cursor", code: errorCodeInvalidCursor,
} }
func validateSliceLen[S ~[]E, E any](s S, min, max int) error { func validateSliceLen[S ~[]E, E any](s S, min, max int) error {

View File

@ -345,8 +345,10 @@ func (e VersionNotFoundError) Type() ErrorType {
return ErrorTypeNotFound return ErrorTypeNotFound
} }
const errorCodeVersionNotFound = "version-not-found"
func (e VersionNotFoundError) Code() string { func (e VersionNotFoundError) Code() string {
return "version-not-found" return errorCodeVersionNotFound
} }
func (e VersionNotFoundError) Params() map[string]any { func (e VersionNotFoundError) Params() map[string]any {

View File

@ -838,8 +838,10 @@ func (e VillageNotFoundError) Type() ErrorType {
return ErrorTypeNotFound return ErrorTypeNotFound
} }
const errorCodeVillageNotFound = "village-not-found"
func (e VillageNotFoundError) Code() string { func (e VillageNotFoundError) Code() string {
return "village-not-found" return errorCodeVillageNotFound
} }
func (e VillageNotFoundError) Params() map[string]any { func (e VillageNotFoundError) Params() map[string]any {

View File

@ -96,7 +96,7 @@ func NewAPIHTTPHandler(
func (h *apiHTTPHandler) handleNotFound(w http.ResponseWriter, r *http.Request) { func (h *apiHTTPHandler) handleNotFound(w http.ResponseWriter, r *http.Request) {
h.errorRenderer.render(w, r, apiError{ h.errorRenderer.render(w, r, apiError{
status: http.StatusNotFound, status: http.StatusNotFound,
code: "route-not-found", code: apimodel.ErrorCodeRouteNotFound,
message: "route not found", message: "route not found",
}) })
} }
@ -104,7 +104,7 @@ func (h *apiHTTPHandler) handleNotFound(w http.ResponseWriter, r *http.Request)
func (h *apiHTTPHandler) handleMethodNotAllowed(w http.ResponseWriter, r *http.Request) { func (h *apiHTTPHandler) handleMethodNotAllowed(w http.ResponseWriter, r *http.Request) {
h.errorRenderer.render(w, r, apiError{ h.errorRenderer.render(w, r, apiError{
status: http.StatusMethodNotAllowed, status: http.StatusMethodNotAllowed,
code: "method-not-allowed", code: apimodel.ErrorCodeMethodNotAllowed,
message: "method not allowed", message: "method not allowed",
}) })
} }

View File

@ -265,7 +265,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -301,7 +301,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -336,7 +336,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -372,7 +372,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -405,7 +405,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -438,7 +438,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -472,7 +472,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -510,7 +510,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -602,7 +602,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -633,7 +633,7 @@ func TestListEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -912,7 +912,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -948,7 +948,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -983,7 +983,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1019,7 +1019,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1052,7 +1052,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -1085,7 +1085,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1119,7 +1119,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -1157,7 +1157,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -1254,7 +1254,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -1290,7 +1290,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -1329,7 +1329,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),
@ -1617,7 +1617,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1653,7 +1653,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1688,7 +1688,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1724,7 +1724,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1757,7 +1757,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -1790,7 +1790,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1824,7 +1824,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -1862,7 +1862,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -1954,7 +1954,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -1990,7 +1990,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -2029,7 +2029,7 @@ func TestListTribeEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),
@ -2309,7 +2309,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -2345,7 +2345,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -2380,7 +2380,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -2416,7 +2416,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -2449,7 +2449,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -2482,7 +2482,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -2516,7 +2516,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -2554,7 +2554,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -2651,7 +2651,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -2687,7 +2687,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -2726,7 +2726,7 @@ func TestListVillageEnnoblements(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),

View File

@ -12,7 +12,7 @@ import (
type apiError struct { type apiError struct {
status int status int
code string code apimodel.ErrorCode
path []string path []string
params map[string]any params map[string]any
message string message string
@ -83,7 +83,7 @@ func (re apiErrorRenderer) withErrorPathFormatter(formatter errorPathFormatter)
var errAPIInternalServerError = apiError{ var errAPIInternalServerError = apiError{
status: http.StatusInternalServerError, status: http.StatusInternalServerError,
code: "internal-server-error", code: apimodel.ErrorCodeInternalServerError,
message: "internal server error", message: "internal server error",
} }
@ -135,7 +135,7 @@ func (re apiErrorRenderer) invalidParamFormatErrorToAPIError(
return apiError{ return apiError{
status: http.StatusBadRequest, status: http.StatusBadRequest,
code: "invalid-param-format", code: apimodel.ErrorCodeInvalidParamFormat,
path: []string{location, paramFormatErr.ParamName}, path: []string{location, paramFormatErr.ParamName},
message: paramFormatErr.Err.Error(), message: paramFormatErr.Err.Error(),
} }
@ -192,7 +192,7 @@ func (re apiErrorRenderer) domainErrorToAPIError(domainErr domain.Error) apiErro
return apiError{ return apiError{
status: re.domainErrorTypeToStatusCode(domainErr.Type()), status: re.domainErrorTypeToStatusCode(domainErr.Type()),
code: domainErr.Code(), code: apimodel.ErrorCode(domainErr.Code()),
path: path, path: path,
params: cloned, params: cloned,
message: message, message: message,

View File

@ -308,7 +308,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -344,7 +344,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -379,7 +379,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -415,7 +415,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -448,7 +448,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -481,7 +481,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -516,7 +516,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -554,7 +554,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -590,7 +590,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -627,7 +627,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -664,7 +664,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -727,7 +727,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -758,7 +758,7 @@ func TestListPlayers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -967,7 +967,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1003,7 +1003,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1038,7 +1038,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1074,7 +1074,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1107,7 +1107,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -1140,7 +1140,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1175,7 +1175,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -1213,7 +1213,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -1245,7 +1245,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -1276,7 +1276,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -1310,7 +1310,7 @@ func TestListTribeMembers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),
@ -1397,7 +1397,7 @@ func TestGetPlayer(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"min": float64(domainErr.Min), "min": float64(domainErr.Min),
@ -1430,7 +1430,7 @@ func TestGetPlayer(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -1461,7 +1461,7 @@ func TestGetPlayer(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -1500,7 +1500,7 @@ func TestGetPlayer(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),

View File

@ -205,7 +205,7 @@ func TestListServers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -241,7 +241,7 @@ func TestListServers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -276,7 +276,7 @@ func TestListServers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -312,7 +312,7 @@ func TestListServers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -345,7 +345,7 @@ func TestListServers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -403,7 +403,7 @@ func TestListServers(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -483,7 +483,7 @@ func TestGetServer(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"min": float64(domainErr.Min), "min": float64(domainErr.Min),
@ -517,7 +517,7 @@ func TestGetServer(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -548,7 +548,7 @@ func TestGetServer(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -620,7 +620,7 @@ func TestGetServerConfig(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -651,7 +651,7 @@ func TestGetServerConfig(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -727,7 +727,7 @@ func TestGetServerUnitInfo(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -758,7 +758,7 @@ func TestGetServerUnitInfo(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -834,7 +834,7 @@ func TestGetServerBuildingInfo(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -865,7 +865,7 @@ func TestGetServerBuildingInfo(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,

View File

@ -280,7 +280,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -316,7 +316,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -351,7 +351,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -387,7 +387,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -420,7 +420,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -453,7 +453,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -487,7 +487,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -525,7 +525,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -622,7 +622,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -658,7 +658,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -697,7 +697,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),
@ -1011,7 +1011,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1047,7 +1047,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1082,7 +1082,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1118,7 +1118,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1151,7 +1151,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -1184,7 +1184,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1218,7 +1218,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -1256,7 +1256,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -1348,7 +1348,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -1384,7 +1384,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -1423,7 +1423,7 @@ func TestListTribeTribeChanges(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),

View File

@ -308,7 +308,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -344,7 +344,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -379,7 +379,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -415,7 +415,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -448,7 +448,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -481,7 +481,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -516,7 +516,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": domainErr.Sort, "sort": domainErr.Sort,
@ -554,7 +554,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"sort": paramSort, "sort": paramSort,
@ -590,7 +590,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -653,7 +653,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -684,7 +684,7 @@ func TestListTribes(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -770,7 +770,7 @@ func TestGetTribe(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"min": float64(domainErr.Min), "min": float64(domainErr.Min),
@ -803,7 +803,7 @@ func TestGetTribe(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -834,7 +834,7 @@ func TestGetTribe(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -873,7 +873,7 @@ func TestGetTribe(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),

View File

@ -153,7 +153,7 @@ func TestListVersions(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -189,7 +189,7 @@ func TestListVersions(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -224,7 +224,7 @@ func TestListVersions(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -260,7 +260,7 @@ func TestListVersions(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -293,7 +293,7 @@ func TestListVersions(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -367,7 +367,7 @@ func TestGetVersion(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"min": float64(domainErr.Min), "min": float64(domainErr.Min),
@ -401,7 +401,7 @@ func TestGetVersion(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,

View File

@ -192,7 +192,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -228,7 +228,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -263,7 +263,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -299,7 +299,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -332,7 +332,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -365,7 +365,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -398,7 +398,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "coords", "0"}, Path: []string{"$query", "coords", "0"},
}, },
@ -427,7 +427,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -458,7 +458,7 @@ func TestListVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -636,7 +636,7 @@ func TestListPlayerVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -672,7 +672,7 @@ func TestListPlayerVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -707,7 +707,7 @@ func TestListPlayerVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -743,7 +743,7 @@ func TestListPlayerVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -776,7 +776,7 @@ func TestListPlayerVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -805,7 +805,7 @@ func TestListPlayerVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -836,7 +836,7 @@ func TestListPlayerVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -870,7 +870,7 @@ func TestListPlayerVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"serverKey": domainErr.ServerKey, "serverKey": domainErr.ServerKey,
@ -1049,7 +1049,7 @@ func TestListTribeVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1085,7 +1085,7 @@ func TestListTribeVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1120,7 +1120,7 @@ func TestListTribeVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1156,7 +1156,7 @@ func TestListTribeVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"current": float64(domainErr.Current), "current": float64(domainErr.Current),
@ -1189,7 +1189,7 @@ func TestListTribeVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Path: []string{"$query", "cursor"}, Path: []string{"$query", "cursor"},
}, },
@ -1218,7 +1218,7 @@ func TestListTribeVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -1249,7 +1249,7 @@ func TestListTribeVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -1283,7 +1283,7 @@ func TestListTribeVillages(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"serverKey": domainErr.ServerKey, "serverKey": domainErr.ServerKey,
@ -1370,7 +1370,7 @@ func TestGetVillage(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"min": float64(domainErr.Min), "min": float64(domainErr.Min),
@ -1403,7 +1403,7 @@ func TestGetVillage(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"code": domainErr.VersionCode, "code": domainErr.VersionCode,
@ -1434,7 +1434,7 @@ func TestGetVillage(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"key": domainErr.Key, "key": domainErr.Key,
@ -1473,7 +1473,7 @@ func TestGetVillage(t *testing.T) {
assert.Equal(t, apimodel.ErrorResponse{ assert.Equal(t, apimodel.ErrorResponse{
Errors: []apimodel.Error{ Errors: []apimodel.Error{
{ {
Code: domainErr.Code(), Code: apimodel.ErrorCode(domainErr.Code()),
Message: domainErr.Error(), Message: domainErr.Error(),
Params: map[string]any{ Params: map[string]any{
"id": float64(domainErr.ID), "id": float64(domainErr.ID),

View File

@ -13,7 +13,7 @@ func NewEnnoblement(withRelations domain.EnnoblementWithRelations) Ennoblement {
Village: NewVillageMeta( Village: NewVillageMeta(
withRelations.Village().WithRelations(withRelations.OldOwner().WithRelations(withRelations.OldTribe())), withRelations.Village().WithRelations(withRelations.OldOwner().WithRelations(withRelations.OldTribe())),
), ),
NewOwner: NewNullPlayerMeta(withRelations.NewOwner().WithRelations(withRelations.NewTribe())), NewOwner: NewPlayerMeta(withRelations.NewOwner().WithRelations(withRelations.NewTribe())),
} }
} }

View File

@ -5,7 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Swagger UI</title> <title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" /> <link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="./index.css" /> <link rel="stylesheet" type="text/css" href="index.css" />
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" /> <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" /> <link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
</head> </head>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long