chore: update openapi schema and swagger version (#29)
Reviewed-on: twhelp/corev3#29
This commit is contained in:
parent
5fa98ce0b6
commit
bc1e6617b9
|
@ -3,3 +3,4 @@ bin/*
|
|||
additional_envs.sh
|
||||
.kpt-pipeline
|
||||
tmp
|
||||
api/domain-error-code.yml
|
||||
|
|
|
@ -450,6 +450,8 @@ linters-settings:
|
|||
arguments:
|
||||
- fmt.Printf
|
||||
- fmt.Println
|
||||
- strings.Builder.*
|
||||
- bytes.Buffer.*
|
||||
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unnecessary-stmt
|
||||
- name: unnecessary-stmt
|
||||
severity: error
|
||||
|
|
7
Makefile
7
Makefile
|
@ -29,8 +29,13 @@ install-tools: install-golangci-lint install-oapi-codegen
|
|||
.PHONY: install
|
||||
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
|
||||
generate: install-oapi-codegen
|
||||
generate: install-oapi-codegen generate-domain-error-codes
|
||||
@echo "Running go generate..."
|
||||
go generate ./...
|
||||
|
||||
|
|
|
@ -443,6 +443,8 @@ paths:
|
|||
$ref: "#/components/responses/ErrorResponse"
|
||||
components:
|
||||
schemas:
|
||||
DomainErrorCode:
|
||||
$ref: ./domain-error-code.yml
|
||||
Error:
|
||||
type: object
|
||||
required:
|
||||
|
@ -451,8 +453,15 @@ components:
|
|||
additionalProperties: false
|
||||
properties:
|
||||
code:
|
||||
type: string
|
||||
example: length-out-of-range
|
||||
example: invalid-param-format
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/DomainErrorCode"
|
||||
- type: string
|
||||
enum:
|
||||
- method-not-allowed
|
||||
- route-not-found
|
||||
- internal-server-error
|
||||
- invalid-param-format
|
||||
message:
|
||||
type: string
|
||||
path:
|
||||
|
@ -470,6 +479,7 @@ components:
|
|||
type: string
|
||||
minLength: 2
|
||||
maxLength: 2
|
||||
example: en
|
||||
Version:
|
||||
type: object
|
||||
required:
|
||||
|
@ -486,14 +496,15 @@ components:
|
|||
example: www.tribalwars.net
|
||||
name:
|
||||
type: string
|
||||
example: Poland
|
||||
example: International
|
||||
timezone:
|
||||
type: string
|
||||
example: Europe/Warsaw
|
||||
example: Europe/London
|
||||
ServerKey:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 10
|
||||
example: en138
|
||||
Server:
|
||||
type: object
|
||||
required:
|
||||
|
@ -515,7 +526,7 @@ components:
|
|||
url:
|
||||
type: string
|
||||
format: uri
|
||||
example: https://pl151.plemiona.pl
|
||||
example: https://en138.tribalwars.net
|
||||
numPlayers:
|
||||
type: integer
|
||||
playerDataSyncedAt:
|
||||
|
@ -1168,6 +1179,7 @@ components:
|
|||
profileUrl:
|
||||
type: string
|
||||
format: uri
|
||||
example: https://en138.tribalwars.net/game.php?screen=info_ally&id=13
|
||||
points:
|
||||
type: integer
|
||||
allPoints:
|
||||
|
@ -1221,7 +1233,28 @@ components:
|
|||
profileUrl:
|
||||
type: string
|
||||
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:
|
||||
# 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:
|
||||
- $ref: "#/components/schemas/TribeOpponentsDefeated"
|
||||
- type: object
|
||||
|
@ -1242,6 +1275,7 @@ components:
|
|||
- points
|
||||
- numVillages
|
||||
- profileUrl
|
||||
- tribe
|
||||
- lastActivityAt
|
||||
- bestRank
|
||||
- bestRankAt
|
||||
|
@ -1265,8 +1299,9 @@ components:
|
|||
profileUrl:
|
||||
type: string
|
||||
format: uri
|
||||
example: https://en138.tribalwars.net/game.php?screen=info_player&id=11518097
|
||||
tribe:
|
||||
$ref: "#/components/schemas/TribeMeta"
|
||||
$ref: "#/components/schemas/NullTribeMeta"
|
||||
lastActivityAt:
|
||||
type: string
|
||||
format: date-time
|
||||
|
@ -1299,6 +1334,7 @@ components:
|
|||
- id
|
||||
- name
|
||||
- profileUrl
|
||||
- tribe
|
||||
properties:
|
||||
id:
|
||||
$ref: "#/components/schemas/IntId"
|
||||
|
@ -1307,8 +1343,23 @@ components:
|
|||
profileUrl:
|
||||
type: string
|
||||
format: uri
|
||||
example: https://en138.tribalwars.net/game.php?screen=info_player&id=11518097
|
||||
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:
|
||||
type: object
|
||||
required:
|
||||
|
@ -1322,6 +1373,7 @@ components:
|
|||
- continent
|
||||
- bonus
|
||||
- createdAt
|
||||
- player
|
||||
properties:
|
||||
id:
|
||||
$ref: "#/components/schemas/IntId"
|
||||
|
@ -1342,6 +1394,7 @@ components:
|
|||
profileUrl:
|
||||
type: string
|
||||
format: uri
|
||||
example: https://en138.tribalwars.net/game.php?screen=info_village&id=57198
|
||||
continent:
|
||||
type: string
|
||||
example: K44
|
||||
|
@ -1362,7 +1415,7 @@ components:
|
|||
type: string
|
||||
format: date-time
|
||||
player:
|
||||
$ref: "#/components/schemas/PlayerMeta"
|
||||
$ref: "#/components/schemas/NullPlayerMeta"
|
||||
VillageMeta:
|
||||
type: object
|
||||
required:
|
||||
|
@ -1372,6 +1425,7 @@ components:
|
|||
- y
|
||||
- profileUrl
|
||||
- continent
|
||||
- player
|
||||
properties:
|
||||
id:
|
||||
$ref: "#/components/schemas/IntId"
|
||||
|
@ -1387,16 +1441,18 @@ components:
|
|||
profileUrl:
|
||||
type: string
|
||||
format: uri
|
||||
example: https://en138.tribalwars.net/game.php?screen=info_village&id=57198
|
||||
continent:
|
||||
type: string
|
||||
example: K44
|
||||
player:
|
||||
$ref: "#/components/schemas/PlayerMeta"
|
||||
$ref: "#/components/schemas/NullPlayerMeta"
|
||||
Ennoblement:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- points
|
||||
- newOwner
|
||||
- village
|
||||
- createdAt
|
||||
properties:
|
||||
|
@ -1416,6 +1472,7 @@ components:
|
|||
required:
|
||||
- id
|
||||
- player
|
||||
- newTribe
|
||||
- createdAt
|
||||
properties:
|
||||
id:
|
||||
|
@ -1423,26 +1480,29 @@ components:
|
|||
player:
|
||||
$ref: "#/components/schemas/PlayerMeta"
|
||||
newTribe:
|
||||
$ref: "#/components/schemas/TribeMeta"
|
||||
$ref: "#/components/schemas/NullTribeMeta"
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
CursorString:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 1000
|
||||
example: aWQ9NTU3LHNlcnZlcktleT1wbDE5Mw==
|
||||
Cursor:
|
||||
type: object
|
||||
x-go-type-skip-optional-pointer: true
|
||||
properties:
|
||||
self:
|
||||
description: Cursor pointing to the current page.
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 1000
|
||||
x-go-type-skip-optional-pointer: true
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/CursorString"
|
||||
next:
|
||||
description: Cursor pointing to the next page.
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 1000
|
||||
x-go-type-skip-optional-pointer: true
|
||||
allOf:
|
||||
- $ref: "#/components/schemas/CursorString"
|
||||
PaginationResponse:
|
||||
type: object
|
||||
properties:
|
||||
|
@ -1453,9 +1513,7 @@ components:
|
|||
in: query
|
||||
name: cursor
|
||||
schema:
|
||||
type: string
|
||||
minLength: 1
|
||||
maxLength: 1000
|
||||
$ref: "#/components/schemas/CursorString"
|
||||
required: false
|
||||
LimitQueryParam:
|
||||
in: query
|
||||
|
|
|
@ -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
2
go.mod
|
@ -28,6 +28,7 @@ require (
|
|||
github.com/uptrace/bun/extra/bundebug v1.1.17
|
||||
github.com/urfave/cli/v2 v2.27.1
|
||||
golang.org/x/sync v0.6.0
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
)
|
||||
|
||||
require (
|
||||
|
@ -89,7 +90,6 @@ require (
|
|||
golang.org/x/sys v0.16.0 // indirect
|
||||
golang.org/x/tools v0.16.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.3.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
lukechampine.com/uint128 v1.3.0 // indirect
|
||||
mellium.im/sasl v0.3.1 // indirect
|
||||
modernc.org/cc/v3 v3.41.0 // indirect
|
||||
|
|
|
@ -608,8 +608,7 @@ func testEnnoblementRepository(t *testing.T, newRepos func(t *testing.T) reposit
|
|||
for i, e := range resWithRelations.Ennoblements() {
|
||||
assert.Equal(t, res.Ennoblements()[i], e.Ennoblement())
|
||||
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() != 0, e.NewOwner().Valid)
|
||||
assert.Equal(t, e.Ennoblement().NewOwnerID(), e.NewOwner().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().OldOwnerID(), e.OldOwner().V.ID())
|
||||
|
|
|
@ -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 {
|
||||
newOwner.Valid = true
|
||||
newOwner.V, err = e.NewOwner.ToMeta()
|
||||
newOwner, err = e.NewOwner.ToMeta()
|
||||
if err != nil {
|
||||
return domain.EnnoblementWithRelations{}, err
|
||||
}
|
||||
|
|
|
@ -163,10 +163,7 @@ func NewEnnoblementWithRelations(
|
|||
|
||||
return e.WithRelations(
|
||||
village,
|
||||
domain.NullPlayerMeta{
|
||||
V: newOwner,
|
||||
Valid: !newOwner.IsZero(),
|
||||
},
|
||||
newOwner,
|
||||
domain.NullTribeMeta{
|
||||
V: newTribe,
|
||||
Valid: !newTribe.IsZero(),
|
||||
|
|
|
@ -102,7 +102,7 @@ func (e Ennoblement) CreatedAt() time.Time {
|
|||
|
||||
func (e Ennoblement) WithRelations(
|
||||
village VillageMeta,
|
||||
newOwner NullPlayerMeta,
|
||||
newOwner PlayerMeta,
|
||||
newTribe NullTribeMeta,
|
||||
oldOwner NullPlayerMeta,
|
||||
oldTribe NullTribeMeta,
|
||||
|
@ -142,7 +142,7 @@ type Ennoblements []Ennoblement
|
|||
type EnnoblementWithRelations struct {
|
||||
ennoblement Ennoblement
|
||||
village VillageMeta
|
||||
newOwner NullPlayerMeta
|
||||
newOwner PlayerMeta
|
||||
newTribe NullTribeMeta
|
||||
oldOwner NullPlayerMeta
|
||||
oldTribe NullTribeMeta
|
||||
|
@ -156,7 +156,7 @@ func (e EnnoblementWithRelations) Village() VillageMeta {
|
|||
return e.village
|
||||
}
|
||||
|
||||
func (e EnnoblementWithRelations) NewOwner() NullPlayerMeta {
|
||||
func (e EnnoblementWithRelations) NewOwner() PlayerMeta {
|
||||
return e.newOwner
|
||||
}
|
||||
|
||||
|
|
|
@ -1151,8 +1151,10 @@ func (e PlayerNotFoundError) Type() ErrorType {
|
|||
return ErrorTypeNotFound
|
||||
}
|
||||
|
||||
const errorCodePlayerNotFound = "player-not-found"
|
||||
|
||||
func (e PlayerNotFoundError) Code() string {
|
||||
return "player-not-found"
|
||||
return errorCodePlayerNotFound
|
||||
}
|
||||
|
||||
func (e PlayerNotFoundError) Params() map[string]any {
|
||||
|
|
|
@ -847,8 +847,10 @@ func (e ServerNotFoundError) Type() ErrorType {
|
|||
return ErrorTypeNotFound
|
||||
}
|
||||
|
||||
const errorCodeServerNotFound = "server-not-found"
|
||||
|
||||
func (e ServerNotFoundError) Code() string {
|
||||
return "server-not-found"
|
||||
return errorCodeServerNotFound
|
||||
}
|
||||
|
||||
func (e ServerNotFoundError) Params() map[string]any {
|
||||
|
|
|
@ -984,8 +984,10 @@ func (e TribeNotFoundError) Type() ErrorType {
|
|||
return ErrorTypeNotFound
|
||||
}
|
||||
|
||||
const errorCodeTribeNotFound = "tribe-not-found"
|
||||
|
||||
func (e TribeNotFoundError) Code() string {
|
||||
return "tribe-not-found"
|
||||
return errorCodeTribeNotFound
|
||||
}
|
||||
|
||||
func (e TribeNotFoundError) Params() map[string]any {
|
||||
|
|
|
@ -70,12 +70,12 @@ func encodeCursor(kvps []keyValuePair) string {
|
|||
|
||||
for i, kvp := range kvps {
|
||||
if b.Len() > 0 {
|
||||
_, _ = b.WriteString(cursorSeparator)
|
||||
b.WriteString(cursorSeparator)
|
||||
}
|
||||
|
||||
_, _ = b.WriteString(kvp.key)
|
||||
_, _ = b.WriteString(cursorKeyValueSeparator)
|
||||
_, _ = b.WriteString(values[i])
|
||||
b.WriteString(kvp.key)
|
||||
b.WriteString(cursorKeyValueSeparator)
|
||||
b.WriteString(values[i])
|
||||
}
|
||||
|
||||
return base64.StdEncoding.EncodeToString(b.Bytes())
|
||||
|
|
|
@ -40,12 +40,15 @@ func (e ValidationError) Type() ErrorType {
|
|||
return ErrorTypeIncorrectInput
|
||||
}
|
||||
|
||||
// ignorecode
|
||||
const errorCodeValidationFailed = "validation-failed"
|
||||
|
||||
func (e ValidationError) Code() string {
|
||||
var domainErr Error
|
||||
if errors.As(e.Err, &domainErr) {
|
||||
return domainErr.Code()
|
||||
}
|
||||
return "validation-failed"
|
||||
return errorCodeValidationFailed
|
||||
}
|
||||
|
||||
func (e ValidationError) Params() map[string]any {
|
||||
|
@ -96,12 +99,15 @@ func (e SliceElementValidationError) Type() ErrorType {
|
|||
return ErrorTypeIncorrectInput
|
||||
}
|
||||
|
||||
// ignorecode
|
||||
const errorCodeSliceElementValidationFailed = "slice-element-validation-failed"
|
||||
|
||||
func (e SliceElementValidationError) Code() string {
|
||||
var domainErr Error
|
||||
if errors.As(e.Err, &domainErr) {
|
||||
return domainErr.Code()
|
||||
}
|
||||
return "slice-element-validation-failed"
|
||||
return errorCodeSliceElementValidationFailed
|
||||
}
|
||||
|
||||
func (e SliceElementValidationError) Params() map[string]any {
|
||||
|
@ -131,8 +137,10 @@ func (e MinGreaterEqualError) Type() ErrorType {
|
|||
return ErrorTypeIncorrectInput
|
||||
}
|
||||
|
||||
const errorCodeMinGreaterEqual = "min-greater-equal"
|
||||
|
||||
func (e MinGreaterEqualError) Code() string {
|
||||
return "min-greater-equal"
|
||||
return errorCodeMinGreaterEqual
|
||||
}
|
||||
|
||||
func (e MinGreaterEqualError) Params() map[string]any {
|
||||
|
@ -157,8 +165,10 @@ func (e MaxLessEqualError) Type() ErrorType {
|
|||
return ErrorTypeIncorrectInput
|
||||
}
|
||||
|
||||
const errorCodeMaxLessEqual = "max-less-equal"
|
||||
|
||||
func (e MaxLessEqualError) Code() string {
|
||||
return "max-less-equal"
|
||||
return errorCodeMaxLessEqual
|
||||
}
|
||||
|
||||
func (e MaxLessEqualError) Params() map[string]any {
|
||||
|
@ -184,8 +194,10 @@ func (e LenOutOfRangeError) Type() ErrorType {
|
|||
return ErrorTypeIncorrectInput
|
||||
}
|
||||
|
||||
const errorCodeLenOutOfRange = "length-out-of-range"
|
||||
|
||||
func (e LenOutOfRangeError) Code() string {
|
||||
return "length-out-of-range"
|
||||
return errorCodeLenOutOfRange
|
||||
}
|
||||
|
||||
func (e LenOutOfRangeError) Params() map[string]any {
|
||||
|
@ -210,8 +222,10 @@ func (e InvalidURLError) Type() ErrorType {
|
|||
return ErrorTypeIncorrectInput
|
||||
}
|
||||
|
||||
const errorCodeInvalidURL = "invalid-url"
|
||||
|
||||
func (e InvalidURLError) Code() string {
|
||||
return "invalid-url"
|
||||
return errorCodeInvalidURL
|
||||
}
|
||||
|
||||
func (e InvalidURLError) Params() map[string]any {
|
||||
|
@ -234,8 +248,10 @@ func (e UnsupportedSortStringError) Type() ErrorType {
|
|||
return ErrorTypeIncorrectInput
|
||||
}
|
||||
|
||||
const errorCodeUnsupportedSortString = "unsupported-sort-string"
|
||||
|
||||
func (e UnsupportedSortStringError) Code() string {
|
||||
return "unsupported-sort-string"
|
||||
return errorCodeUnsupportedSortString
|
||||
}
|
||||
|
||||
func (e UnsupportedSortStringError) Params() map[string]any {
|
||||
|
@ -258,8 +274,10 @@ func (e SortConflictError) Type() ErrorType {
|
|||
return ErrorTypeIncorrectInput
|
||||
}
|
||||
|
||||
const errorCodeSortConflict = "sort-conflict"
|
||||
|
||||
func (e SortConflictError) Code() string {
|
||||
return "sort-conflict"
|
||||
return errorCodeSortConflict
|
||||
}
|
||||
|
||||
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{
|
||||
msg: "can't be blank",
|
||||
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{
|
||||
msg: "must not be nil",
|
||||
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).
|
||||
var ErrInvalidCursor error = simpleError{
|
||||
msg: "invalid cursor",
|
||||
typ: ErrorTypeIncorrectInput,
|
||||
code: "invalid-cursor",
|
||||
code: errorCodeInvalidCursor,
|
||||
}
|
||||
|
||||
func validateSliceLen[S ~[]E, E any](s S, min, max int) error {
|
||||
|
|
|
@ -345,8 +345,10 @@ func (e VersionNotFoundError) Type() ErrorType {
|
|||
return ErrorTypeNotFound
|
||||
}
|
||||
|
||||
const errorCodeVersionNotFound = "version-not-found"
|
||||
|
||||
func (e VersionNotFoundError) Code() string {
|
||||
return "version-not-found"
|
||||
return errorCodeVersionNotFound
|
||||
}
|
||||
|
||||
func (e VersionNotFoundError) Params() map[string]any {
|
||||
|
|
|
@ -838,8 +838,10 @@ func (e VillageNotFoundError) Type() ErrorType {
|
|||
return ErrorTypeNotFound
|
||||
}
|
||||
|
||||
const errorCodeVillageNotFound = "village-not-found"
|
||||
|
||||
func (e VillageNotFoundError) Code() string {
|
||||
return "village-not-found"
|
||||
return errorCodeVillageNotFound
|
||||
}
|
||||
|
||||
func (e VillageNotFoundError) Params() map[string]any {
|
||||
|
|
|
@ -96,7 +96,7 @@ func NewAPIHTTPHandler(
|
|||
func (h *apiHTTPHandler) handleNotFound(w http.ResponseWriter, r *http.Request) {
|
||||
h.errorRenderer.render(w, r, apiError{
|
||||
status: http.StatusNotFound,
|
||||
code: "route-not-found",
|
||||
code: apimodel.ErrorCodeRouteNotFound,
|
||||
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) {
|
||||
h.errorRenderer.render(w, r, apiError{
|
||||
status: http.StatusMethodNotAllowed,
|
||||
code: "method-not-allowed",
|
||||
code: apimodel.ErrorCodeMethodNotAllowed,
|
||||
message: "method not allowed",
|
||||
})
|
||||
}
|
||||
|
|
|
@ -265,7 +265,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -301,7 +301,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -336,7 +336,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -372,7 +372,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -405,7 +405,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -438,7 +438,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -472,7 +472,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -510,7 +510,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -602,7 +602,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -633,7 +633,7 @@ func TestListEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -912,7 +912,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -948,7 +948,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -983,7 +983,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1019,7 +1019,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1052,7 +1052,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -1085,7 +1085,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1119,7 +1119,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -1157,7 +1157,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -1254,7 +1254,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -1290,7 +1290,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -1329,7 +1329,7 @@ func TestListPlayerEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
@ -1617,7 +1617,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1653,7 +1653,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1688,7 +1688,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1724,7 +1724,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1757,7 +1757,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -1790,7 +1790,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1824,7 +1824,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -1862,7 +1862,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -1954,7 +1954,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -1990,7 +1990,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -2029,7 +2029,7 @@ func TestListTribeEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
@ -2309,7 +2309,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -2345,7 +2345,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -2380,7 +2380,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -2416,7 +2416,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -2449,7 +2449,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -2482,7 +2482,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -2516,7 +2516,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -2554,7 +2554,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -2651,7 +2651,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -2687,7 +2687,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -2726,7 +2726,7 @@ func TestListVillageEnnoblements(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
|
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
type apiError struct {
|
||||
status int
|
||||
code string
|
||||
code apimodel.ErrorCode
|
||||
path []string
|
||||
params map[string]any
|
||||
message string
|
||||
|
@ -83,7 +83,7 @@ func (re apiErrorRenderer) withErrorPathFormatter(formatter errorPathFormatter)
|
|||
|
||||
var errAPIInternalServerError = apiError{
|
||||
status: http.StatusInternalServerError,
|
||||
code: "internal-server-error",
|
||||
code: apimodel.ErrorCodeInternalServerError,
|
||||
message: "internal server error",
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ func (re apiErrorRenderer) invalidParamFormatErrorToAPIError(
|
|||
|
||||
return apiError{
|
||||
status: http.StatusBadRequest,
|
||||
code: "invalid-param-format",
|
||||
code: apimodel.ErrorCodeInvalidParamFormat,
|
||||
path: []string{location, paramFormatErr.ParamName},
|
||||
message: paramFormatErr.Err.Error(),
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ func (re apiErrorRenderer) domainErrorToAPIError(domainErr domain.Error) apiErro
|
|||
|
||||
return apiError{
|
||||
status: re.domainErrorTypeToStatusCode(domainErr.Type()),
|
||||
code: domainErr.Code(),
|
||||
code: apimodel.ErrorCode(domainErr.Code()),
|
||||
path: path,
|
||||
params: cloned,
|
||||
message: message,
|
||||
|
|
|
@ -308,7 +308,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -344,7 +344,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -379,7 +379,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -415,7 +415,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -448,7 +448,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -481,7 +481,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -516,7 +516,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -554,7 +554,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -590,7 +590,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -627,7 +627,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -664,7 +664,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -727,7 +727,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -758,7 +758,7 @@ func TestListPlayers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -967,7 +967,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1003,7 +1003,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1038,7 +1038,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1074,7 +1074,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1107,7 +1107,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -1140,7 +1140,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1175,7 +1175,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -1213,7 +1213,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -1245,7 +1245,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -1276,7 +1276,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -1310,7 +1310,7 @@ func TestListTribeMembers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
@ -1397,7 +1397,7 @@ func TestGetPlayer(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"min": float64(domainErr.Min),
|
||||
|
@ -1430,7 +1430,7 @@ func TestGetPlayer(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -1461,7 +1461,7 @@ func TestGetPlayer(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -1500,7 +1500,7 @@ func TestGetPlayer(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
|
|
@ -205,7 +205,7 @@ func TestListServers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -241,7 +241,7 @@ func TestListServers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -276,7 +276,7 @@ func TestListServers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -312,7 +312,7 @@ func TestListServers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -345,7 +345,7 @@ func TestListServers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -403,7 +403,7 @@ func TestListServers(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -483,7 +483,7 @@ func TestGetServer(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"min": float64(domainErr.Min),
|
||||
|
@ -517,7 +517,7 @@ func TestGetServer(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -548,7 +548,7 @@ func TestGetServer(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -620,7 +620,7 @@ func TestGetServerConfig(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -651,7 +651,7 @@ func TestGetServerConfig(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -727,7 +727,7 @@ func TestGetServerUnitInfo(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -758,7 +758,7 @@ func TestGetServerUnitInfo(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -834,7 +834,7 @@ func TestGetServerBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -865,7 +865,7 @@ func TestGetServerBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
|
|
@ -280,7 +280,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -316,7 +316,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -351,7 +351,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -387,7 +387,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -420,7 +420,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -453,7 +453,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -487,7 +487,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -525,7 +525,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -622,7 +622,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -658,7 +658,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -697,7 +697,7 @@ func TestListPlayerTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
@ -1011,7 +1011,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1047,7 +1047,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1082,7 +1082,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1118,7 +1118,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1151,7 +1151,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -1184,7 +1184,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1218,7 +1218,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -1256,7 +1256,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -1348,7 +1348,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -1384,7 +1384,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -1423,7 +1423,7 @@ func TestListTribeTribeChanges(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
|
|
@ -308,7 +308,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -344,7 +344,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -379,7 +379,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -415,7 +415,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -448,7 +448,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -481,7 +481,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -516,7 +516,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": domainErr.Sort,
|
||||
|
@ -554,7 +554,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"sort": paramSort,
|
||||
|
@ -590,7 +590,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -653,7 +653,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -684,7 +684,7 @@ func TestListTribes(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -770,7 +770,7 @@ func TestGetTribe(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"min": float64(domainErr.Min),
|
||||
|
@ -803,7 +803,7 @@ func TestGetTribe(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -834,7 +834,7 @@ func TestGetTribe(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -873,7 +873,7 @@ func TestGetTribe(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
|
|
@ -153,7 +153,7 @@ func TestListVersions(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -189,7 +189,7 @@ func TestListVersions(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -224,7 +224,7 @@ func TestListVersions(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -260,7 +260,7 @@ func TestListVersions(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -293,7 +293,7 @@ func TestListVersions(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -367,7 +367,7 @@ func TestGetVersion(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"min": float64(domainErr.Min),
|
||||
|
@ -401,7 +401,7 @@ func TestGetVersion(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
|
|
@ -192,7 +192,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -228,7 +228,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -263,7 +263,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -299,7 +299,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -332,7 +332,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -365,7 +365,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -398,7 +398,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "coords", "0"},
|
||||
},
|
||||
|
@ -427,7 +427,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -458,7 +458,7 @@ func TestListVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -636,7 +636,7 @@ func TestListPlayerVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -672,7 +672,7 @@ func TestListPlayerVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -707,7 +707,7 @@ func TestListPlayerVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -743,7 +743,7 @@ func TestListPlayerVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -776,7 +776,7 @@ func TestListPlayerVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -805,7 +805,7 @@ func TestListPlayerVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -836,7 +836,7 @@ func TestListPlayerVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -870,7 +870,7 @@ func TestListPlayerVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"serverKey": domainErr.ServerKey,
|
||||
|
@ -1049,7 +1049,7 @@ func TestListTribeVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1085,7 +1085,7 @@ func TestListTribeVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1120,7 +1120,7 @@ func TestListTribeVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1156,7 +1156,7 @@ func TestListTribeVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"current": float64(domainErr.Current),
|
||||
|
@ -1189,7 +1189,7 @@ func TestListTribeVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Path: []string{"$query", "cursor"},
|
||||
},
|
||||
|
@ -1218,7 +1218,7 @@ func TestListTribeVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -1249,7 +1249,7 @@ func TestListTribeVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -1283,7 +1283,7 @@ func TestListTribeVillages(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"serverKey": domainErr.ServerKey,
|
||||
|
@ -1370,7 +1370,7 @@ func TestGetVillage(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"min": float64(domainErr.Min),
|
||||
|
@ -1403,7 +1403,7 @@ func TestGetVillage(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"code": domainErr.VersionCode,
|
||||
|
@ -1434,7 +1434,7 @@ func TestGetVillage(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"key": domainErr.Key,
|
||||
|
@ -1473,7 +1473,7 @@ func TestGetVillage(t *testing.T) {
|
|||
assert.Equal(t, apimodel.ErrorResponse{
|
||||
Errors: []apimodel.Error{
|
||||
{
|
||||
Code: domainErr.Code(),
|
||||
Code: apimodel.ErrorCode(domainErr.Code()),
|
||||
Message: domainErr.Error(),
|
||||
Params: map[string]any{
|
||||
"id": float64(domainErr.ID),
|
||||
|
|
|
@ -13,7 +13,7 @@ func NewEnnoblement(withRelations domain.EnnoblementWithRelations) Ennoblement {
|
|||
Village: NewVillageMeta(
|
||||
withRelations.Village().WithRelations(withRelations.OldOwner().WithRelations(withRelations.OldTribe())),
|
||||
),
|
||||
NewOwner: NewNullPlayerMeta(withRelations.NewOwner().WithRelations(withRelations.NewTribe())),
|
||||
NewOwner: NewPlayerMeta(withRelations.NewOwner().WithRelations(withRelations.NewTribe())),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<title>Swagger UI</title>
|
||||
<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-16x16.png" sizes="16x16" />
|
||||
</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
Loading…
Reference in New Issue