Skip to content

Commit 56d2c87

Browse files
committed
minor refactor
1 parent d462f6b commit 56d2c87

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

interface.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func (f Interface) goPkg() string {
5555
func (f Interface) toSchema() *Schema {
5656
var s = NewSchema()
5757
s.setType(f.Type)
58-
s.Nullable = f.Nullable
58+
s.nullable = f.Nullable
5959

6060
// if it's a module loader, construct a special case (sub)schema
6161
if len(f.Loader) > 0 {
@@ -79,7 +79,7 @@ func (f Interface) toSchema() *Schema {
7979
cs.setType("array")
8080
cs.ArrayItems = NewSchema()
8181
cs.ArrayItems.setType(nest.Type)
82-
cs.ArrayItems.Nullable = nest.Nullable
82+
cs.ArrayItems.nullable = nest.Nullable
8383
cs.ArrayItems.Properties = props
8484

8585
// nested schema

schema.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ type Schema struct {
2727
Description string `json:"description,omitempty"`
2828
MarkdownDescription string `json:"markdownDescription,omitempty"`
2929
Type string `json:"type,omitempty"`
30-
Nullable bool `json:"-"`
3130
Ref string `json:"$ref,omitempty"`
3231

3332
ArrayItems *Schema `json:"items,omitempty"`
@@ -52,6 +51,7 @@ type Schema struct {
5251
goPkg string
5352
description string
5453
markdownDescription string
54+
nullable bool
5555
}
5656

5757
func godocLink(pkg string) string {
@@ -124,7 +124,7 @@ func (s *Schema) setRef(moduleID string) {
124124
// MarshalJSON allows to marshal Schema.Type as string or list
125125
func (s *Schema) MarshalJSON() ([]byte, error) {
126126
type Alias Schema
127-
if s.Nullable {
127+
if s.nullable {
128128
return json.Marshal(&struct {
129129
Type [2]string `json:"type"`
130130
*Alias

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy