From 6ab6b49940d0863cd3e3f134910c06e56a0bf854 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 25 Aug 2025 07:32:21 -0300 Subject: [PATCH] nip11: omitempty all the things. --- nip11/fetch.go | 2 +- nip11/types.go | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nip11/fetch.go b/nip11/fetch.go index dfdc2f5..7a31d7b 100644 --- a/nip11/fetch.go +++ b/nip11/fetch.go @@ -6,8 +6,8 @@ import ( "net/http" "time" - jsoniter "github.com/json-iterator/go" "fiatjaf.com/nostr" + jsoniter "github.com/json-iterator/go" ) // Fetch fetches the NIP-11 metadata for a relay. diff --git a/nip11/types.go b/nip11/types.go index 03ade51..4c81885 100644 --- a/nip11/types.go +++ b/nip11/types.go @@ -9,13 +9,13 @@ import ( type RelayInformationDocument struct { URL string `json:"-"` - Name string `json:"name"` - Description string `json:"description"` - PubKey nostr.PubKey `json:"pubkey"` - Contact string `json:"contact"` - SupportedNIPs []any `json:"supported_nips"` - Software string `json:"software"` - Version string `json:"version"` + Name string `json:"name,omitempty"` + Description string `json:"description,omitempty"` + PubKey *nostr.PubKey `json:"pubkey,omitempty"` + Contact string `json:"contact,omitempty"` + SupportedNIPs []any `json:"supported_nips,omitempty"` + Software string `json:"software,omitempty"` + Version string `json:"version,omitempty"` Limitation *RelayLimitationDocument `json:"limitation,omitempty"` RelayCountries []string `json:"relay_countries,omitempty"` @@ -25,8 +25,8 @@ type RelayInformationDocument struct { PaymentsURL string `json:"payments_url,omitempty"` Fees *RelayFeesDocument `json:"fees,omitempty"` Retention []*RelayRetentionDocument `json:"retention,omitempty"` - Icon string `json:"icon"` - Banner string `json:"banner"` + Icon string `json:"icon,omitempty"` + Banner string `json:"banner,omitempty"` } func (info *RelayInformationDocument) AddSupportedNIP(number int) {