diff --git a/cmd/accumulated/run/types_gen.go b/cmd/accumulated/run/types_gen.go index f0360a9d8..525bae0b2 100644 --- a/cmd/accumulated/run/types_gen.go +++ b/cmd/accumulated/run/types_gen.go @@ -2689,13 +2689,13 @@ func (v *Config) UnmarshalJSON(data []byte) error { v.Logging = u.Logging v.Instrumentation = u.Instrumentation v.P2P = u.P2P - if u.Configurations.Value != nil { + if u.Configurations != nil && u.Configurations.Value != nil { v.Configurations = make([]Configuration, len(u.Configurations.Value)) for i, x := range u.Configurations.Value { v.Configurations[i] = x } } - if u.Services.Value != nil { + if u.Services != nil && u.Services.Value != nil { v.Services = make([]Service, len(u.Services.Value)) for i, x := range u.Services.Value { v.Services[i] = x @@ -2740,7 +2740,7 @@ func (v *ConsensusService) UnmarshalJSON(data []byte) error { v.Listen = u.Listen.Value } - if u.BootstrapPeers.Value != nil { + if u.BootstrapPeers != nil && u.BootstrapPeers.Value != nil { v.BootstrapPeers = make([]p2p.Multiaddr, len(u.BootstrapPeers.Value)) for i, x := range u.BootstrapPeers.Value { v.BootstrapPeers[i] = x @@ -2831,13 +2831,13 @@ func (v *CoreValidatorConfiguration) UnmarshalJSON(data []byte) error { v.DnGenesis = u.DnGenesis v.BvnGenesis = u.BvnGenesis - if u.DnBootstrapPeers.Value != nil { + if u.DnBootstrapPeers != nil && u.DnBootstrapPeers.Value != nil { v.DnBootstrapPeers = make([]p2p.Multiaddr, len(u.DnBootstrapPeers.Value)) for i, x := range u.DnBootstrapPeers.Value { v.DnBootstrapPeers[i] = x } } - if u.BvnBootstrapPeers.Value != nil { + if u.BvnBootstrapPeers != nil && u.BvnBootstrapPeers.Value != nil { v.BvnBootstrapPeers = make([]p2p.Multiaddr, len(u.BvnBootstrapPeers.Value)) for i, x := range u.BvnBootstrapPeers.Value { v.BvnBootstrapPeers[i] = x @@ -2990,7 +2990,7 @@ func (v *HttpListener) UnmarshalJSON(data []byte) error { if err != nil { return err } - if u.Listen.Value != nil { + if u.Listen != nil && u.Listen.Value != nil { v.Listen = make([]p2p.Multiaddr, len(u.Listen.Value)) for i, x := range u.Listen.Value { v.Listen[i] = x @@ -3028,7 +3028,7 @@ func (v *HttpPeerMapEntry) UnmarshalJSON(data []byte) error { } v.Partitions = u.Partitions - if u.Addresses.Value != nil { + if u.Addresses != nil && u.Addresses.Value != nil { v.Addresses = make([]p2p.Multiaddr, len(u.Addresses.Value)) for i, x := range u.Addresses.Value { v.Addresses[i] = x @@ -3075,7 +3075,7 @@ func (v *HttpService) UnmarshalJSON(data []byte) error { if !(v.Type() == u.Type) { return fmt.Errorf("field Type: not equal: want %v, got %v", v.Type(), u.Type) } - if u.Listen.Value != nil { + if u.Listen != nil && u.Listen.Value != nil { v.HttpListener.Listen = make([]p2p.Multiaddr, len(u.Listen.Value)) for i, x := range u.Listen.Value { v.HttpListener.Listen[i] = x @@ -3120,7 +3120,7 @@ func (v *Instrumentation) UnmarshalJSON(data []byte) error { if err != nil { return err } - if u.Listen.Value != nil { + if u.Listen != nil && u.Listen.Value != nil { v.HttpListener.Listen = make([]p2p.Multiaddr, len(u.Listen.Value)) for i, x := range u.Listen.Value { v.HttpListener.Listen[i] = x @@ -3298,13 +3298,13 @@ func (v *P2P) UnmarshalJSON(data []byte) error { if err != nil { return err } - if u.Listen.Value != nil { + if u.Listen != nil && u.Listen.Value != nil { v.Listen = make([]p2p.Multiaddr, len(u.Listen.Value)) for i, x := range u.Listen.Value { v.Listen[i] = x } } - if u.BootstrapPeers.Value != nil { + if u.BootstrapPeers != nil && u.BootstrapPeers.Value != nil { v.BootstrapPeers = make([]p2p.Multiaddr, len(u.BootstrapPeers.Value)) for i, x := range u.BootstrapPeers.Value { v.BootstrapPeers[i] = x @@ -3491,7 +3491,7 @@ func (v *SubnodeService) UnmarshalJSON(data []byte) error { v.NodeKey = u.NodeKey.Value } - if u.Services.Value != nil { + if u.Services != nil && u.Services.Value != nil { v.Services = make([]Service, len(u.Services.Value)) for i, x := range u.Services.Value { v.Services[i] = x diff --git a/internal/api/v2/types_gen.go b/internal/api/v2/types_gen.go index 06ea2bdf5..e2a45a4fb 100644 --- a/internal/api/v2/types_gen.go +++ b/internal/api/v2/types_gen.go @@ -4742,7 +4742,7 @@ func (v *SignaturePage) UnmarshalJSON(data []byte) error { return err } v.Signer = u.Signer - if u.Signatures.Value != nil { + if u.Signatures != nil && u.Signatures.Value != nil { v.Signatures = make([]protocol.Signature, len(u.Signatures.Value)) for i, x := range u.Signatures.Value { v.Signatures[i] = x @@ -4950,7 +4950,7 @@ func (v *TransactionQueryResponse) UnmarshalJSON(data []byte) error { } v.Txid = u.Txid v.Transaction = u.Transaction - if u.Signatures.Value != nil { + if u.Signatures != nil && u.Signatures.Value != nil { v.Signatures = make([]protocol.Signature, len(u.Signatures.Value)) for i, x := range u.Signatures.Value { v.Signatures[i] = x diff --git a/internal/core/healing/types_gen.go b/internal/core/healing/types_gen.go index c14341334..b82118c5c 100644 --- a/internal/core/healing/types_gen.go +++ b/internal/core/healing/types_gen.go @@ -128,7 +128,7 @@ func (v *PeerInfo) UnmarshalJSON(data []byte) error { v.Key = *x } v.Status = u.Status - if u.Addresses.Value != nil { + if u.Addresses != nil && u.Addresses.Value != nil { v.Addresses = make([]p2p.Multiaddr, len(u.Addresses.Value)) for i, x := range u.Addresses.Value { v.Addresses[i] = x diff --git a/internal/node/config/types_gen.go b/internal/node/config/types_gen.go index be9b44012..ae08cccde 100644 --- a/internal/node/config/types_gen.go +++ b/internal/node/config/types_gen.go @@ -774,13 +774,13 @@ func (v *P2P) UnmarshalJSON(data []byte) error { if err != nil { return err } - if u.Listen.Value != nil { + if u.Listen != nil && u.Listen.Value != nil { v.Listen = make([]p2p.Multiaddr, len(u.Listen.Value)) for i, x := range u.Listen.Value { v.Listen[i] = x } } - if u.BootstrapPeers.Value != nil { + if u.BootstrapPeers != nil && u.BootstrapPeers.Value != nil { v.BootstrapPeers = make([]p2p.Multiaddr, len(u.BootstrapPeers.Value)) for i, x := range u.BootstrapPeers.Value { v.BootstrapPeers[i] = x diff --git a/pkg/api/v3/message/types_gen.go b/pkg/api/v3/message/types_gen.go index 4a4e58dc3..a82384d26 100644 --- a/pkg/api/v3/message/types_gen.go +++ b/pkg/api/v3/message/types_gen.go @@ -3609,7 +3609,7 @@ func (v *EventMessage) UnmarshalJSON(data []byte) error { if !(v.Type() == u.Type) { return fmt.Errorf("field Type: not equal: want %v, got %v", v.Type(), u.Type) } - if u.Value.Value != nil { + if u.Value != nil && u.Value.Value != nil { v.Value = make([]api.Event, len(u.Value.Value)) for i, x := range u.Value.Value { v.Value[i] = x diff --git a/pkg/api/v3/types_gen.go b/pkg/api/v3/types_gen.go index 7d80e1202..bb1a78965 100644 --- a/pkg/api/v3/types_gen.go +++ b/pkg/api/v3/types_gen.go @@ -8836,7 +8836,7 @@ func (v *FindServiceResult) UnmarshalJSON(data []byte) error { } v.Status = u.Status - if u.Addresses.Value != nil { + if u.Addresses != nil && u.Addresses.Value != nil { v.Addresses = make([]p2p.Multiaddr, len(u.Addresses.Value)) for i, x := range u.Addresses.Value { v.Addresses[i] = x @@ -9383,7 +9383,7 @@ func (v *RecordRange[T]) UnmarshalJSON(data []byte) error { if !(v.RecordType() == u.RecordType) { return fmt.Errorf("field RecordType: not equal: want %v, got %v", v.RecordType(), u.RecordType) } - if u.Records.Value != nil { + if u.Records != nil && u.Records.Value != nil { v.Records = make([]T, len(u.Records.Value)) for i, x := range u.Records.Value { v.Records[i] = x diff --git a/pkg/types/messaging/types_gen.go b/pkg/types/messaging/types_gen.go index ba2b62954..a83654ba5 100644 --- a/pkg/types/messaging/types_gen.go +++ b/pkg/types/messaging/types_gen.go @@ -2942,7 +2942,7 @@ func (v *Envelope) UnmarshalJSON(data []byte) error { if err != nil { return err } - if u.Signatures.Value != nil { + if u.Signatures != nil && u.Signatures.Value != nil { v.Signatures = make([]protocol.Signature, len(u.Signatures.Value)) for i, x := range u.Signatures.Value { v.Signatures[i] = x @@ -2954,7 +2954,7 @@ func (v *Envelope) UnmarshalJSON(data []byte) error { v.TxHash = x } v.Transaction = u.Transaction - if u.Messages.Value != nil { + if u.Messages != nil && u.Messages.Value != nil { v.Messages = make([]Message, len(u.Messages.Value)) for i, x := range u.Messages.Value { v.Messages[i] = x diff --git a/protocol/types_gen.go b/protocol/types_gen.go index ae881c441..991902aca 100644 --- a/protocol/types_gen.go +++ b/protocol/types_gen.go @@ -22758,7 +22758,7 @@ func (v *NetworkMaintenance) UnmarshalJSON(data []byte) error { if !(v.Type() == u.Type) { return fmt.Errorf("field Type: not equal: want %v, got %v", v.Type(), u.Type) } - if u.Operations.Value != nil { + if u.Operations != nil && u.Operations.Value != nil { v.Operations = make([]NetworkMaintenanceOperation, len(u.Operations.Value)) for i, x := range u.Operations.Value { v.Operations[i] = x @@ -23352,7 +23352,7 @@ func (v *SignatureSet) UnmarshalJSON(data []byte) error { } else { v.TransactionHash = *x } - if u.Signatures.Value != nil { + if u.Signatures != nil && u.Signatures.Value != nil { v.Signatures = make([]Signature, len(u.Signatures.Value)) for i, x := range u.Signatures.Value { v.Signatures[i] = x @@ -23439,7 +23439,7 @@ func (v *SyntheticCreateIdentity) UnmarshalJSON(data []byte) error { v.SyntheticOrigin.Initiator = u.Initiator v.SyntheticOrigin.FeeRefund = u.FeeRefund v.SyntheticOrigin.Index = u.Index - if u.Accounts.Value != nil { + if u.Accounts != nil && u.Accounts.Value != nil { v.Accounts = make([]Account, len(u.Accounts.Value)) for i, x := range u.Accounts.Value { v.Accounts[i] = x @@ -23998,7 +23998,7 @@ func (v *TransactionStatus) UnmarshalJSON(data []byte) error { v.Received = u.Received v.Initiator = u.Initiator - if u.Signers.Value != nil { + if u.Signers != nil && u.Signers.Value != nil { v.Signers = make([]Signer, len(u.Signers.Value)) for i, x := range u.Signers.Value { v.Signers[i] = x @@ -24129,7 +24129,7 @@ func (v *UpdateAccountAuth) UnmarshalJSON(data []byte) error { if !(v.Type() == u.Type) { return fmt.Errorf("field Type: not equal: want %v, got %v", v.Type(), u.Type) } - if u.Operations.Value != nil { + if u.Operations != nil && u.Operations.Value != nil { v.Operations = make([]AccountAuthOperation, len(u.Operations.Value)) for i, x := range u.Operations.Value { v.Operations[i] = x @@ -24236,7 +24236,7 @@ func (v *UpdateKeyPage) UnmarshalJSON(data []byte) error { if !(v.Type() == u.Type) { return fmt.Errorf("field Type: not equal: want %v, got %v", v.Type(), u.Type) } - if u.Operation.Value != nil { + if u.Operation != nil && u.Operation.Value != nil { v.Operation = make([]KeyPageOperation, len(u.Operation.Value)) for i, x := range u.Operation.Value { v.Operation[i] = x diff --git a/test/simulator/recorder_types_gen.go b/test/simulator/recorder_types_gen.go index 3894f21c0..cd195b8d2 100644 --- a/test/simulator/recorder_types_gen.go +++ b/test/simulator/recorder_types_gen.go @@ -768,7 +768,7 @@ func (v *recordMessages) UnmarshalJSON(data []byte) error { if err != nil { return err } - if u.Messages.Value != nil { + if u.Messages != nil && u.Messages.Value != nil { v.Messages = make([]consensus.Message, len(u.Messages.Value)) for i, x := range u.Messages.Value { v.Messages[i] = x diff --git a/tools/cmd/debug/types_gen.go b/tools/cmd/debug/types_gen.go index 9e9e34db2..627ed504b 100644 --- a/tools/cmd/debug/types_gen.go +++ b/tools/cmd/debug/types_gen.go @@ -585,7 +585,7 @@ func (v *DbPatch) UnmarshalJSON(data []byte) error { if err != nil { return err } - if u.Operations.Value != nil { + if u.Operations != nil && u.Operations.Value != nil { v.Operations = make([]DbPatchOp, len(u.Operations.Value)) for i, x := range u.Operations.Value { v.Operations[i] = x diff --git a/tools/cmd/gen-types/go.go b/tools/cmd/gen-types/go.go index 0de385579..3e7179fa6 100644 --- a/tools/cmd/gen-types/go.go +++ b/tools/cmd/gen-types/go.go @@ -689,7 +689,7 @@ func GoValueFromJson(field *Field, tgtName, srcName, errName string, errArgs ... return fmt.Sprintf("\tif %s != nil { %s = %[1]s.Value }\n", srcName, tgtName), nil } return fmt.Sprintf( - " if %[3]s.Value != nil {\n"+ + " if %[3]s != nil && %[3]s.Value != nil {\n"+ " %[1]s = make(%s, len(%s.Value));\n"+ " for i, x := range %[3]s.Value {\n"+ " %[1]s[i] = x\n"+ diff --git a/tools/internal/typegen/types_gen.go b/tools/internal/typegen/types_gen.go index a433d7f46..df4e99058 100644 --- a/tools/internal/typegen/types_gen.go +++ b/tools/internal/typegen/types_gen.go @@ -624,7 +624,7 @@ func (v *EntityRecord) UnmarshalJSON(data []byte) error { v.ValueStore = u.ValueStore v.Root = u.Root v.Interface = u.Interface - if u.Attributes.Value != nil { + if u.Attributes != nil && u.Attributes.Value != nil { v.Attributes = make([]Record, len(u.Attributes.Value)) for i, x := range u.Attributes.Value { v.Attributes[i] = x