diff --git a/go/models/repo_setup.go b/go/models/repo_info.go similarity index 57% rename from go/models/repo_setup.go rename to go/models/repo_info.go index dcfa6f76..8b5f7504 100644 --- a/go/models/repo_setup.go +++ b/go/models/repo_info.go @@ -12,17 +12,14 @@ import ( "github.com/go-openapi/swag" ) -// RepoSetup repo setup -// swagger:model repoSetup +// RepoInfo repo info +// swagger:model repoInfo -type RepoSetup struct { +type RepoInfo struct { // allowed branches AllowedBranches []string `json:"allowed_branches"` - // branch - Branch string `json:"branch,omitempty"` - // cmd Cmd string `json:"cmd,omitempty"` @@ -32,6 +29,9 @@ type RepoSetup struct { // dir Dir string `json:"dir,omitempty"` + // env + Env map[string]string `json:"env,omitempty"` + // id ID int64 `json:"id,omitempty"` @@ -46,30 +46,40 @@ type RepoSetup struct { // repo Repo string `json:"repo,omitempty"` + + // repo branch + RepoBranch string `json:"repo_branch,omitempty"` + + // repo url + RepoURL string `json:"repo_url,omitempty"` } -/* polymorph repoSetup allowed_branches false */ +/* polymorph repoInfo allowed_branches false */ + +/* polymorph repoInfo cmd false */ + +/* polymorph repoInfo deploy_key_id false */ -/* polymorph repoSetup branch false */ +/* polymorph repoInfo dir false */ -/* polymorph repoSetup cmd false */ +/* polymorph repoInfo env false */ -/* polymorph repoSetup deploy_key_id false */ +/* polymorph repoInfo id false */ -/* polymorph repoSetup dir false */ +/* polymorph repoInfo private_logs false */ -/* polymorph repoSetup id false */ +/* polymorph repoInfo provider false */ -/* polymorph repoSetup private_logs false */ +/* polymorph repoInfo public_repo false */ -/* polymorph repoSetup provider false */ +/* polymorph repoInfo repo false */ -/* polymorph repoSetup public_repo false */ +/* polymorph repoInfo repo_branch false */ -/* polymorph repoSetup repo false */ +/* polymorph repoInfo repo_url false */ -// Validate validates this repo setup -func (m *RepoSetup) Validate(formats strfmt.Registry) error { +// Validate validates this repo info +func (m *RepoInfo) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAllowedBranches(formats); err != nil { @@ -83,7 +93,7 @@ func (m *RepoSetup) Validate(formats strfmt.Registry) error { return nil } -func (m *RepoSetup) validateAllowedBranches(formats strfmt.Registry) error { +func (m *RepoInfo) validateAllowedBranches(formats strfmt.Registry) error { if swag.IsZero(m.AllowedBranches) { // not required return nil @@ -93,7 +103,7 @@ func (m *RepoSetup) validateAllowedBranches(formats strfmt.Registry) error { } // MarshalBinary interface implementation -func (m *RepoSetup) MarshalBinary() ([]byte, error) { +func (m *RepoInfo) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } @@ -101,8 +111,8 @@ func (m *RepoSetup) MarshalBinary() ([]byte, error) { } // UnmarshalBinary interface implementation -func (m *RepoSetup) UnmarshalBinary(b []byte) error { - var res RepoSetup +func (m *RepoInfo) UnmarshalBinary(b []byte) error { + var res RepoInfo if err := swag.ReadJSON(b, &res); err != nil { return err } diff --git a/go/models/site.go b/go/models/site.go index 46ed1144..515e19df 100644 --- a/go/models/site.go +++ b/go/models/site.go @@ -27,7 +27,7 @@ type Site struct { AdminURL string `json:"admin_url,omitempty"` // build settings - BuildSettings *SiteBuildSettings `json:"build_settings,omitempty"` + BuildSettings *RepoInfo `json:"build_settings,omitempty"` // capabilities Capabilities map[string]interface{} `json:"capabilities,omitempty"` @@ -272,74 +272,6 @@ func (m *Site) UnmarshalBinary(b []byte) error { return nil } -// SiteBuildSettings site build settings -// swagger:model SiteBuildSettings - -type SiteBuildSettings struct { - - // allowed branches - AllowedBranches []string `json:"allowed_branches"` - - // branch - Branch string `json:"branch,omitempty"` - - // cmd - Cmd string `json:"cmd,omitempty"` - - // dir - Dir string `json:"dir,omitempty"` -} - -/* polymorph SiteBuildSettings allowed_branches false */ - -/* polymorph SiteBuildSettings branch false */ - -/* polymorph SiteBuildSettings cmd false */ - -/* polymorph SiteBuildSettings dir false */ - -// Validate validates this site build settings -func (m *SiteBuildSettings) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAllowedBranches(formats); err != nil { - // prop - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *SiteBuildSettings) validateAllowedBranches(formats strfmt.Registry) error { - - if swag.IsZero(m.AllowedBranches) { // not required - return nil - } - - return nil -} - -// MarshalBinary interface implementation -func (m *SiteBuildSettings) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *SiteBuildSettings) UnmarshalBinary(b []byte) error { - var res SiteBuildSettings - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - // SiteProcessingSettings site processing settings // swagger:model SiteProcessingSettings diff --git a/go/models/site_setup.go b/go/models/site_setup.go index 19eb30ac..19514333 100644 --- a/go/models/site_setup.go +++ b/go/models/site_setup.go @@ -19,7 +19,7 @@ type SiteSetup struct { Site // repo - Repo *RepoSetup `json:"repo,omitempty"` + Repo *RepoInfo `json:"repo,omitempty"` } // UnmarshalJSON unmarshals this object from a JSON structure @@ -32,7 +32,7 @@ func (m *SiteSetup) UnmarshalJSON(raw []byte) error { m.Site = aO0 var data struct { - Repo *RepoSetup `json:"repo,omitempty"` + Repo *RepoInfo `json:"repo,omitempty"` } if err := swag.ReadJSON(raw, &data); err != nil { return err @@ -54,7 +54,7 @@ func (m SiteSetup) MarshalJSON() ([]byte, error) { _parts = append(_parts, aO0) var data struct { - Repo *RepoSetup `json:"repo,omitempty"` + Repo *RepoInfo `json:"repo,omitempty"` } data.Repo = m.Repo diff --git a/go/models/site_setup_all_of1.go b/go/models/site_setup_all_of1.go deleted file mode 100644 index 3177ff1b..00000000 --- a/go/models/site_setup_all_of1.go +++ /dev/null @@ -1,73 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - strfmt "github.com/go-openapi/strfmt" - - "github.com/go-openapi/errors" - "github.com/go-openapi/swag" -) - -// SiteSetupAllOf1 site setup all of1 -// swagger:model siteSetupAllOf1 -type SiteSetupAllOf1 struct { - - // repo - Repo *RepoSetup `json:"repo,omitempty"` -} - -// Validate validates this site setup all of1 -func (m *SiteSetupAllOf1) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateRepo(formats); err != nil { - // prop - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *SiteSetupAllOf1) validateRepo(formats strfmt.Registry) error { - - if swag.IsZero(m.Repo) { // not required - return nil - } - - if m.Repo != nil { - - if err := m.Repo.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("repo") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *SiteSetupAllOf1) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *SiteSetupAllOf1) UnmarshalBinary(b []byte) error { - var res SiteSetupAllOf1 - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/swagger.yml b/swagger.yml index 2ae88d6a..53d93c71 100644 --- a/swagger.yml +++ b/swagger.yml @@ -1406,25 +1406,14 @@ definitions: pretty_urls: type: boolean build_settings: - type: object - properties: - branch: - type: string - dir: - type: string - cmd: - type: string - allowed_branches: - type: array - items: - type: string + $ref: "#/definitions/repoInfo" siteSetup: allOf: - $ref: "#/definitions/site" - properties: repo: - $ref: "#/definitions/repoSetup" - repoSetup: + $ref: "#/definitions/repoInfo" + repoInfo: type: object properties: id: @@ -1435,7 +1424,7 @@ definitions: type: string repo: type: string - branch: + repo_branch: type: string dir: type: string @@ -1449,6 +1438,12 @@ definitions: type: boolean private_logs: type: boolean + repo_url: + type: string + env: + type: object + additionalProperties: + type: string submission: type: object properties: diff --git a/ui/swagger.json b/ui/swagger.json index ab194f30..06414d9b 100644 --- a/ui/swagger.json +++ b/ui/swagger.json @@ -2752,7 +2752,7 @@ } } }, - "repoSetup": { + "repoInfo": { "type": "object", "properties": { "allowed_branches": { @@ -2761,9 +2761,6 @@ "type": "string" } }, - "branch": { - "type": "string" - }, "cmd": { "type": "string" }, @@ -2773,6 +2770,12 @@ "dir": { "type": "string" }, + "env": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, "id": { "type": "integer" }, @@ -2787,6 +2790,12 @@ }, "repo": { "type": "string" + }, + "repo_branch": { + "type": "string" + }, + "repo_url": { + "type": "string" } } }, @@ -2803,24 +2812,7 @@ "type": "string" }, "build_settings": { - "type": "object", - "properties": { - "allowed_branches": { - "type": "array", - "items": { - "type": "string" - } - }, - "branch": { - "type": "string" - }, - "cmd": { - "type": "string" - }, - "dir": { - "type": "string" - } - } + "$ref": "#/definitions/repoInfo" }, "capabilities": { "type": "object", @@ -2939,7 +2931,7 @@ { "properties": { "repo": { - "$ref": "#/definitions/repoSetup" + "$ref": "#/definitions/repoInfo" } } }