Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pipeline_config): fix model template bool property #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ patch:
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

generate: patch
swagger-codegen generate -i api/swagger.output.json -l go -c swagger.conf --additional-properties packageName=bitbucket
swagger-codegen generate -i api/swagger.output.json -l go -c swagger.conf --additional-properties packageName=bitbucket --template-dir swagger-template
4 changes: 2 additions & 2 deletions model_pipelines_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
package bitbucket

type PipelinesConfig struct {
Type_ string `json:"type"`
// Whether Pipelines is enabled for the repository.
Enabled bool `json:"enabled,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Type_ string `json:"type"`
}
43 changes: 43 additions & 0 deletions swagger-template/model.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{{>partial_header}}
package {{packageName}}
{{#models}}
{{#imports}}
{{#@first}}
import (
{{/@first}}
"{{import}}"
{{#@last}}
)
{{/@last}}
{{/imports}}
{{#model}}{{#isEnum}}{{#description}}// {{{classname}}} : {{{description}}}{{/description}}
type {{{classname}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}}

// List of {{{name}}}
const (
{{#allowableValues}}
{{#enumVars}}
{{^@first}}
{{/@first}}
{{name}}_{{{classname}}} {{{classname}}} = "{{{value}}}"
{{/enumVars}}
{{/allowableValues}}
){{/isEnum}}{{^isEnum}}{{#description}}
// {{{description}}}{{/description}}
type {{classname}} struct {
{{#isComposedModel}}
{{#interfaceModels}}
{{classname}}
{{/interfaceModels}}
{{/isComposedModel}}
{{^isComposedModel}}
{{#vars}}
{{^@first}}
{{/@first}}
{{#description}}
// {{{description}}}
{{/description}}
{{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{#isBoolean}}*{{/isBoolean}}{{{datatype}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}"{{/withXml}}`
{{/vars}}
{{/isComposedModel}}
}{{/isEnum}}{{/model}}{{/models}}