Skip to content

Commit 0cf4031

Browse files
authored
Merge pull request #17 from Nkmol/swagger-spec-patch-poc
2 parents ba64dcb + 25d714e commit 0cf4031

File tree

6 files changed

+66
-37
lines changed

6 files changed

+66
-37
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,5 @@ _testmain.go
2323
*.test
2424
*.prof
2525
vendor/
26+
27+
swagger.output.json

.vscode/settings.json

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
11
{
2-
"go.inferGopath": false
2+
"go.inferGopath": false,
3+
"files.associations": {
4+
"*.json-patch": "json"
5+
},
6+
"json.schemas": [
7+
{
8+
"fileMatch": [
9+
"*.json-patch"
10+
],
11+
"url": "https://json.schemastore.org/json-patch"
12+
}
13+
]
314
}

GNUmakefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
default: generate fmt build
1+
default: patch generate fmt build
22

33
fmt:
44
go fmt
55

66
build:
77
go build
88

9+
patch:
10+
go install github.com/evanphx/json-patch/cmd/json-patch@v5
11+
wget -q --output-document - https://api.bitbucket.org/swagger.json | "$$(go env GOPATH)/bin/json-patch" -p api/swagger.json-patch > api/swagger.output.json
12+
913
generate:
10-
swagger-codegen generate -i https://api.bitbucket.org/swagger.json -l go -c swagger.conf --additional-properties packageName=bitbucket
14+
swagger-codegen generate -i api/swagger.output.json -l go -c swagger.conf --additional-properties packageName=bitbucket

api/swagger.json-patch

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[
2+
{
3+
"op": "add",
4+
"path": "/definitions/repository/allOf/1/properties/slug",
5+
"value": {
6+
"type": "string",
7+
"description": "Slugified name, the same string that is used in Bitbucket URLs."
8+
}
9+
}
10+
]

docs/Repository.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,25 @@
44
Name | Type | Description | Notes
55
------------ | ------------- | ------------- | -------------
66
**Type_** | **string** | | [default to null]
7-
**Links** | [***RepositoryLinks**](repository_links.md) | | [optional] [default to null]
8-
**Uuid** | **string** | The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user. | [optional] [default to null]
7+
**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null]
8+
**Description** | **string** | | [optional] [default to null]
9+
**ForkPolicy** | **string** | Controls the rules for forking this repository. * **allow_forks**: unrestricted forking * **no_public_forks**: restrict forking to private forks (forks cannot be made public later) * **no_forks**: deny all forking | [optional] [default to null]
910
**FullName** | **string** | The concatenation of the repository owner's username and the slugified name, e.g. \"evzijst/interruptingcow\". This is the same string used in Bitbucket URLs. | [optional] [default to null]
11+
**HasIssues** | **bool** | | [optional] [default to null]
12+
**HasWiki** | **bool** | | [optional] [default to null]
1013
**IsPrivate** | **bool** | | [optional] [default to null]
14+
**Language** | **string** | | [optional] [default to null]
15+
**Links** | [***RepositoryLinks**](repository_links.md) | | [optional] [default to null]
16+
**Mainbranch** | [***Branch**](branch.md) | | [optional] [default to null]
17+
**Name** | **string** | | [optional] [default to null]
18+
**Owner** | [***Account**](account.md) | | [optional] [default to null]
1119
**Parent** | [***Repository**](repository.md) | | [optional] [default to null]
20+
**Project** | [***Project**](project.md) | | [optional] [default to null]
1221
**Scm** | **string** | | [optional] [default to null]
13-
**Owner** | [***Account**](account.md) | | [optional] [default to null]
14-
**Name** | **string** | | [optional] [default to null]
15-
**Description** | **string** | | [optional] [default to null]
16-
**CreatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null]
17-
**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null]
1822
**Size** | **int32** | | [optional] [default to null]
19-
**Language** | **string** | | [optional] [default to null]
20-
**HasIssues** | **bool** | | [optional] [default to null]
21-
**HasWiki** | **bool** | | [optional] [default to null]
22-
**ForkPolicy** | **string** | Controls the rules for forking this repository. * **allow_forks**: unrestricted forking * **no_public_forks**: restrict forking to private forks (forks cannot be made public later) * **no_forks**: deny all forking | [optional] [default to null]
23-
**Project** | [***Project**](project.md) | | [optional] [default to null]
24-
**Mainbranch** | [***Branch**](branch.md) | | [optional] [default to null]
23+
**Slug** | **string** | Slugified name, the same string that is used in Bitbucket URLs. | [optional] [default to null]
24+
**UpdatedOn** | [**time.Time**](time.Time.md) | | [optional] [default to null]
25+
**Uuid** | **string** | The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user. | [optional] [default to null]
2526

2627
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
2728

model_repository.go

+22-21
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,28 @@ import (
1414
)
1515

1616
type Repository struct {
17-
Type_ string `json:"type"`
18-
Links *RepositoryLinks `json:"links,omitempty"`
17+
Type_ string `json:"type"`
18+
CreatedOn time.Time `json:"created_on,omitempty"`
19+
Description string `json:"description,omitempty"`
20+
// Controls the rules for forking this repository. * **allow_forks**: unrestricted forking * **no_public_forks**: restrict forking to private forks (forks cannot be made public later) * **no_forks**: deny all forking
21+
ForkPolicy string `json:"fork_policy,omitempty"`
22+
// The concatenation of the repository owner's username and the slugified name, e.g. \"evzijst/interruptingcow\". This is the same string used in Bitbucket URLs.
23+
FullName string `json:"full_name,omitempty"`
24+
HasIssues bool `json:"has_issues,omitempty"`
25+
HasWiki bool `json:"has_wiki,omitempty"`
26+
IsPrivate bool `json:"is_private,omitempty"`
27+
Language string `json:"language,omitempty"`
28+
Links *RepositoryLinks `json:"links,omitempty"`
29+
Mainbranch *Branch `json:"mainbranch,omitempty"`
30+
Name string `json:"name,omitempty"`
31+
Owner *Account `json:"owner,omitempty"`
32+
Parent *Repository `json:"parent,omitempty"`
33+
Project *Project `json:"project,omitempty"`
34+
Scm string `json:"scm,omitempty"`
35+
Size int32 `json:"size,omitempty"`
36+
// Slugified name, the same string that is used in Bitbucket URLs.
37+
Slug string `json:"slug,omitempty"`
38+
UpdatedOn time.Time `json:"updated_on,omitempty"`
1939
// The repository's immutable id. This can be used as a substitute for the slug segment in URLs. Doing this guarantees your URLs will survive renaming of the repository by its owner, or even transfer of the repository to a different user.
2040
Uuid string `json:"uuid,omitempty"`
21-
// The concatenation of the repository owner's username and the slugified name, e.g. \"evzijst/interruptingcow\". This is the same string used in Bitbucket URLs.
22-
FullName string `json:"full_name,omitempty"`
23-
IsPrivate bool `json:"is_private,omitempty"`
24-
Parent *Repository `json:"parent,omitempty"`
25-
Scm string `json:"scm,omitempty"`
26-
Owner *Account `json:"owner,omitempty"`
27-
Name string `json:"name,omitempty"`
28-
Slug string `json:"slug,omitempty"`
29-
Description string `json:"description,omitempty"`
30-
CreatedOn time.Time `json:"created_on,omitempty"`
31-
UpdatedOn time.Time `json:"updated_on,omitempty"`
32-
Size int32 `json:"size,omitempty"`
33-
Language string `json:"language,omitempty"`
34-
HasIssues bool `json:"has_issues,omitempty"`
35-
HasWiki bool `json:"has_wiki,omitempty"`
36-
// Controls the rules for forking this repository. * **allow_forks**: unrestricted forking * **no_public_forks**: restrict forking to private forks (forks cannot be made public later) * **no_forks**: deny all forking
37-
ForkPolicy string `json:"fork_policy,omitempty"`
38-
Project *Project `json:"project,omitempty"`
39-
Mainbranch *Branch `json:"mainbranch,omitempty"`
4041
}

0 commit comments

Comments
 (0)