Update datasource to not require type.

pull/10616/head
Chris Goller 2016-09-23 17:19:19 -07:00
parent a4eff95677
commit dd547e792a
3 changed files with 6 additions and 10 deletions

View File

@ -25,7 +25,6 @@ func NewHandler() Handler {
func sampleSource() *models.Source {
name := "muh name"
influxType := "influx-enterprise"
url := "http://localhost:8086"
return &models.Source{
@ -35,7 +34,7 @@ func sampleSource() *models.Source {
Proxy: "/chronograf/v1/sources/1/proxy",
},
Name: &name,
Type: &influxType,
Type: "influx-enterprise",
Username: "HOWDY!",
Password: "changeme",
URL: &url,

View File

@ -40,10 +40,8 @@ type Source struct {
Password string `json:"password,omitempty"`
/* Format of the data source
Required: true
*/
Type *string `json:"type"`
*/
Type string `json:"type,omitempty"`
/* URL for the time series data source backend (e.g. http://localhost:8086)
@ -132,12 +130,12 @@ func (m *Source) validateTypeEnum(path, location string, value string) error {
func (m *Source) validateType(formats strfmt.Registry) error {
if err := validate.Required("type", "body", m.Type); err != nil {
return err
if swag.IsZero(m.Type) { // not required
return nil
}
// value enum
if err := m.validateTypeEnum("type", "body", *m.Type); err != nil {
if err := m.validateTypeEnum("type", "body", m.Type); err != nil {
return err
}

View File

@ -738,7 +738,6 @@ definitions:
Source:
type: object
required:
- type
- name
- url
properties: