locking: update schemas correctly
This commit is contained in:
parent
40f02da57c
commit
2e1cae8ee6
@ -22,7 +22,7 @@ type lockRef struct {
|
|||||||
type lockRequest struct {
|
type lockRequest struct {
|
||||||
// Path is the path that the client would like to obtain a lock against.
|
// Path is the path that the client would like to obtain a lock against.
|
||||||
Path string `json:"path"`
|
Path string `json:"path"`
|
||||||
Ref *lockRef `json:"ref"`
|
Ref *lockRef `json:"ref,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// LockResponse encapsulates the information sent over the API in response to
|
// LockResponse encapsulates the information sent over the API in response to
|
||||||
@ -72,7 +72,7 @@ type unlockRequest struct {
|
|||||||
// unlocked; that is to say whether or not a given individual should be
|
// unlocked; that is to say whether or not a given individual should be
|
||||||
// able to break a different individual's lock.
|
// able to break a different individual's lock.
|
||||||
Force bool `json:"force"`
|
Force bool `json:"force"`
|
||||||
Ref *lockRef `json:"ref"`
|
Ref *lockRef `json:"ref,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnlockResponse is the result sent back from the API when asked to remove a
|
// UnlockResponse is the result sent back from the API when asked to remove a
|
||||||
@ -208,7 +208,7 @@ func (c *lockClient) Search(remote string, searchReq *lockSearchRequest) (*lockL
|
|||||||
// lockVerifiableRequest encapsulates the request sent to the server when the
|
// lockVerifiableRequest encapsulates the request sent to the server when the
|
||||||
// client would like a list of locks to verify a Git push.
|
// client would like a list of locks to verify a Git push.
|
||||||
type lockVerifiableRequest struct {
|
type lockVerifiableRequest struct {
|
||||||
Ref *lockRef `json:"ref"`
|
Ref *lockRef `json:"ref,omitempty"`
|
||||||
|
|
||||||
// Cursor is an optional field used to tell the server which lock was
|
// Cursor is an optional field used to tell the server which lock was
|
||||||
// seen last, if scanning through multiple pages of results.
|
// seen last, if scanning through multiple pages of results.
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/git-lfs/git-lfs/git"
|
||||||
"github.com/git-lfs/git-lfs/lfsapi"
|
"github.com/git-lfs/git-lfs/lfsapi"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
@ -107,7 +108,11 @@ func TestAPIUnlock(t *testing.T) {
|
|||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
|
||||||
lc := &lockClient{Client: c}
|
lc := &lockClient{Client: c}
|
||||||
unlockRes, res, err := lc.Unlock(nil, "", "123", true)
|
unlockRes, res, err := lc.Unlock(&git.Ref{
|
||||||
|
Name: "master",
|
||||||
|
Sha: "6161616161616161616161616161616161616161",
|
||||||
|
Type: git.RefTypeLocalBranch,
|
||||||
|
}, "", "123", true)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
assert.Equal(t, 200, res.StatusCode)
|
assert.Equal(t, 200, res.StatusCode)
|
||||||
assert.Equal(t, "123", unlockRes.Lock.Id)
|
assert.Equal(t, "123", unlockRes.Lock.Id)
|
||||||
|
@ -7,7 +7,13 @@
|
|||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"ref": {
|
"ref": {
|
||||||
"type": "string"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["name"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": ["path"]
|
"required": ["path"]
|
||||||
|
@ -7,7 +7,13 @@
|
|||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"ref": {
|
"ref": {
|
||||||
"type": "string"
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["name"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user