Add json mapping for ID in client & app
This commit is contained in:
parent
c76dffdd61
commit
9d635b15a6
|
|
@ -113,7 +113,7 @@ func (s *TokenSuite) Test_CreateApplication_returnsApplicationWithID() {
|
|||
assert.Equal(s.T(), 200, s.recorder.Code)
|
||||
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
||||
|
||||
assert.Equal(s.T(), `{"ID":"APorrUa5b1IIK3y","name":"custom_name","description":""}`, string(bytes))
|
||||
assert.Equal(s.T(), `{"id":"APorrUa5b1IIK3y","name":"custom_name","description":""}`, string(bytes))
|
||||
}
|
||||
|
||||
func (s *TokenSuite) Test_CreateApplication_withExistingToken() {
|
||||
|
|
@ -145,7 +145,7 @@ func (s *TokenSuite) Test_GetApplications() {
|
|||
assert.Equal(s.T(), 200, s.recorder.Code)
|
||||
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
||||
|
||||
assert.Equal(s.T(), `[{"ID":"perfper","name":"first","description":"desc"},{"ID":"asdasd","name":"second","description":"desc2"}]`, string(bytes))
|
||||
assert.Equal(s.T(), `[{"id":"perfper","name":"first","description":"desc"},{"id":"asdasd","name":"second","description":"desc2"}]`, string(bytes))
|
||||
}
|
||||
|
||||
func (s *TokenSuite) Test_DeleteApplication_expectNotFound() {
|
||||
|
|
@ -228,7 +228,7 @@ func (s *TokenSuite) Test_CreateClient_returnsClientWithID() {
|
|||
assert.Equal(s.T(), 200, s.recorder.Code)
|
||||
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
||||
|
||||
assert.Equal(s.T(), `{"ID":"CPorrUa5b1IIK3y","name":"custom_name"}`, string(bytes))
|
||||
assert.Equal(s.T(), `{"id":"CPorrUa5b1IIK3y","name":"custom_name"}`, string(bytes))
|
||||
}
|
||||
|
||||
func (s *TokenSuite) Test_CreateClient_withExistingToken() {
|
||||
|
|
@ -260,7 +260,7 @@ func (s *TokenSuite) Test_GetClients() {
|
|||
assert.Equal(s.T(), 200, s.recorder.Code)
|
||||
bytes, _ := ioutil.ReadAll(s.recorder.Body)
|
||||
|
||||
assert.Equal(s.T(), `[{"ID":"perfper","name":"first"},{"ID":"asdasd","name":"second"}]`, string(bytes))
|
||||
assert.Equal(s.T(), `[{"id":"perfper","name":"first"},{"id":"asdasd","name":"second"}]`, string(bytes))
|
||||
}
|
||||
|
||||
func (s *TokenSuite) Test_DeleteClient_expectNotFound() {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1032,13 +1032,14 @@
|
|||
"type": "object",
|
||||
"title": "Application Model",
|
||||
"properties": {
|
||||
"ID": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"x-go-name": "Description"
|
||||
},
|
||||
"id": {
|
||||
"type": "string",
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
|
|
@ -1051,8 +1052,9 @@
|
|||
"type": "object",
|
||||
"title": "Client Model",
|
||||
"properties": {
|
||||
"ID": {
|
||||
"type": "string"
|
||||
"id": {
|
||||
"type": "string",
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ package model
|
|||
//
|
||||
// swagger:model Application
|
||||
type Application struct {
|
||||
ID string `gorm:"primary_key;unique_index"`
|
||||
ID string `gorm:"primary_key;unique_index" json:"id"`
|
||||
UserID uint `gorm:"index" json:"-"`
|
||||
Name string `form:"name" query:"name" json:"name" binding:"required"`
|
||||
Description string `form:"description" query:"description" json:"description"`
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ package model
|
|||
//
|
||||
// swagger:model Client
|
||||
type Client struct {
|
||||
ID string `gorm:"primary_key;unique_index"`
|
||||
ID string `gorm:"primary_key;unique_index" json:"id"`
|
||||
UserID uint `gorm:"index" json:"-"`
|
||||
Name string `form:"name" query:"name" json:"name" binding:"required"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue