Update swagger and mock to have optional URL field for data source
parent
7fe02063d3
commit
f4a69f137d
|
@ -1,5 +1,4 @@
|
|||
dist/*.js
|
||||
dist/*.html
|
||||
dist/dist_gen.go
|
||||
.pull-request
|
||||
node_modules
|
||||
mrfusion
|
||||
|
|
3
Makefile
3
Makefile
|
@ -65,6 +65,9 @@ run: ${BINARY}
|
|||
run-dev: ${BINARY}
|
||||
./mrfusion -d --port 8888
|
||||
|
||||
swagger: swagger.yaml
|
||||
swagger generate server -f swagger.yaml --with-context
|
||||
|
||||
clean:
|
||||
if [ -f ${BINARY} ] ; then rm ${BINARY} ; fi
|
||||
cd ui && npm run clean
|
||||
|
|
|
@ -26,6 +26,7 @@ func NewHandler() Handler {
|
|||
func sampleSource() *models.Source {
|
||||
name := "muh name"
|
||||
influxType := "influx-enterprise"
|
||||
url := "http://localhost:8086"
|
||||
|
||||
return &models.Source{
|
||||
ID: "1",
|
||||
|
@ -37,8 +38,8 @@ func sampleSource() *models.Source {
|
|||
Type: &influxType,
|
||||
Username: "HOWDY!",
|
||||
Password: "changeme",
|
||||
URL: &url,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (m *Handler) NewSource(ctx context.Context, params op.PostSourcesParams) middleware.Responder {
|
||||
|
|
|
@ -45,6 +45,12 @@ type Source struct {
|
|||
*/
|
||||
Type *string `json:"type"`
|
||||
|
||||
/* URL for the time series data source backend (e.g. http://localhost:8086)
|
||||
|
||||
Required: true
|
||||
*/
|
||||
URL *string `json:"url"`
|
||||
|
||||
/* Username for authentication to data source
|
||||
*/
|
||||
Username string `json:"username,omitempty"`
|
||||
|
@ -69,6 +75,11 @@ func (m *Source) Validate(formats strfmt.Registry) error {
|
|||
res = append(res, err)
|
||||
}
|
||||
|
||||
if err := m.validateURL(formats); err != nil {
|
||||
// prop
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
|
@ -133,6 +144,15 @@ func (m *Source) validateType(formats strfmt.Registry) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (m *Source) validateURL(formats strfmt.Registry) error {
|
||||
|
||||
if err := validate.Required("url", "body", m.URL); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
/*SourceLinks source links
|
||||
|
||||
swagger:model SourceLinks
|
||||
|
|
|
@ -740,6 +740,7 @@ definitions:
|
|||
required:
|
||||
- type
|
||||
- name
|
||||
- url
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
|
@ -760,6 +761,10 @@ definitions:
|
|||
password:
|
||||
type: string
|
||||
description: Password in cleartext!
|
||||
url:
|
||||
type: string
|
||||
format: url
|
||||
description: URL for the time series data source backend (e.g. http://localhost:8086)
|
||||
links:
|
||||
type: object
|
||||
properties:
|
||||
|
|
Loading…
Reference in New Issue