Fix unmarshalling of tx_power
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
{{ .FieldName }} {{ if .IsArray }}[]{{end}}emptyStringInt `json:"{{ .JSONName }}{{ if .OmitEmpty }}{{ end }}"`{{ end }} {{- end }}
|
||||
{{ define "field-numberOrString" }}
|
||||
{{- /* this is kind of a hack, probably a better way to do this when looking at the normalized validation */ -}}
|
||||
{{- if and (eq .FieldType "string") (or (eq .JSONName "channel") (eq .JSONName "backup_channel")) }}
|
||||
{{- if and (eq .FieldType "string") (or (eq .JSONName "channel") (eq .JSONName "backup_channel") (eq .JSONName "tx_power")) }}
|
||||
{{ .FieldName }} {{ if .IsArray }}[]{{end}}numberOrString `json:"{{ .JSONName }}{{ if .OmitEmpty }}{{ end }}"`{{ end }} {{- end }}
|
||||
{{ define "typecast" }}
|
||||
{{- if eq .FieldType "int" }}{{- if .IsArray }}
|
||||
|
||||
@@ -121,6 +121,7 @@ func (dst *ChannelPlanRadioTable) UnmarshalJSON(b []byte) error {
|
||||
aux := &struct {
|
||||
BackupChannel numberOrString `json:"backup_channel"`
|
||||
Channel numberOrString `json:"channel"`
|
||||
TxPower numberOrString `json:"tx_power"`
|
||||
Width emptyStringInt `json:"width"`
|
||||
|
||||
*Alias
|
||||
|
||||
@@ -302,6 +302,7 @@ func (dst *DeviceRadioTable) UnmarshalJSON(b []byte) error {
|
||||
Maxsta emptyStringInt `json:"maxsta"`
|
||||
MinRssi emptyStringInt `json:"min_rssi"`
|
||||
SensLevel emptyStringInt `json:"sens_level"`
|
||||
TxPower numberOrString `json:"tx_power"`
|
||||
|
||||
*Alias
|
||||
}{
|
||||
|
||||
Reference in New Issue
Block a user