mirror of https://github.com/databricks/cli.git
Use IsJsonOnly
This commit is contained in:
parent
74a2f40f54
commit
724cd8237f
|
@ -58,7 +58,7 @@ func init() {
|
||||||
{{if .Request}}// TODO: short flags
|
{{if .Request}}// TODO: short flags
|
||||||
{{.CamelName}}Cmd.Flags().Var(&{{.CamelName}}Json, "json", `either inline JSON string or @path/to/file.json with request body`)
|
{{.CamelName}}Cmd.Flags().Var(&{{.CamelName}}Json, "json", `either inline JSON string or @path/to/file.json with request body`)
|
||||||
{{$method := .}}
|
{{$method := .}}
|
||||||
{{ if not .JsonOnly }}
|
{{ if not .IsJsonOnly }}
|
||||||
{{range .Request.Fields -}}
|
{{range .Request.Fields -}}
|
||||||
{{- if not .Required -}}
|
{{- if not .Required -}}
|
||||||
{{if .Entity.IsObject }}// TODO: complex arg: {{.Name}}
|
{{if .Entity.IsObject }}// TODO: complex arg: {{.Name}}
|
||||||
|
@ -135,7 +135,7 @@ var {{.CamelName}}Cmd = &cobra.Command{
|
||||||
}
|
}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{$method := .}}
|
{{$method := .}}
|
||||||
{{- if and .Request.IsAllRequiredFieldsPrimitive (not .JsonOnly) -}}
|
{{- if and .Request.IsAllRequiredFieldsPrimitive (not .IsJsonOnly) -}}
|
||||||
{{- range $arg, $field := .Request.RequiredFields}}
|
{{- range $arg, $field := .Request.RequiredFields}}
|
||||||
{{if not $field.Entity.IsString -}}
|
{{if not $field.Entity.IsString -}}
|
||||||
_, err = fmt.Sscan(args[{{$arg}}], &{{$method.CamelName}}Req.{{$field.PascalName}})
|
_, err = fmt.Sscan(args[{{$arg}}], &{{$method.CamelName}}Req.{{$field.PascalName}})
|
||||||
|
|
Loading…
Reference in New Issue