Skip to content

Commit 6df8e46

Browse files
Merge pull request #12 from oasdiff/cleanup/remove-dead-origin-code
cleanup: remove dead origin-stripping code now handled by extractOrigins
2 parents 9a1815e + d1f8901 commit 6df8e46

35 files changed

Lines changed: 535 additions & 269 deletions

openapi3/callback.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ func (callback *Callback) Validate(ctx context.Context, opts ...ValidationOption
5656

5757
// UnmarshalJSON sets Callbacks to a copy of data.
5858
func (callbacks *Callbacks) UnmarshalJSON(data []byte) (err error) {
59-
*callbacks, _, err = unmarshalStringMapP[CallbackRef](data)
59+
*callbacks, err = unmarshalStringMapP[CallbackRef](data)
6060
return
6161
}

openapi3/components.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ func (components *Components) UnmarshalJSON(data []byte) error {
9595
return unmarshalError(err)
9696
}
9797
_ = json.Unmarshal(data, &x.Extensions)
98-
delete(x.Extensions, originKey)
99-
stripExtensionsOrigin(x.Extensions)
10098
delete(x.Extensions, "schemas")
10199
delete(x.Extensions, "parameters")
102100
delete(x.Extensions, "headers")

openapi3/contact.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ func (contact *Contact) UnmarshalJSON(data []byte) error {
5252
}
5353
_ = json.Unmarshal(data, &x.Extensions)
5454

55-
delete(x.Extensions, originKey)
56-
stripExtensionsOrigin(x.Extensions)
5755
delete(x.Extensions, "name")
5856
delete(x.Extensions, "url")
5957
delete(x.Extensions, "email")

openapi3/content.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,6 @@ func (content Content) Validate(ctx context.Context, opts ...ValidationOption) e
125125

126126
// UnmarshalJSON sets Content to a copy of data.
127127
func (content *Content) UnmarshalJSON(data []byte) (err error) {
128-
*content, _, err = unmarshalStringMapP[MediaType](data)
128+
*content, err = unmarshalStringMapP[MediaType](data)
129129
return
130130
}

openapi3/discriminator.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ func (discriminator *Discriminator) UnmarshalJSON(data []byte) error {
6060
}
6161
_ = json.Unmarshal(data, &x.Extensions)
6262

63-
delete(x.Extensions, originKey)
64-
stripExtensionsOrigin(x.Extensions)
6563
delete(x.Extensions, "propertyName")
6664
delete(x.Extensions, "mapping")
6765
if len(x.Extensions) == 0 {

openapi3/encoding.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type Encodings map[string]*Encoding
2929

3030
// UnmarshalJSON sets Encodings to a copy of data, stripping __origin__ metadata.
3131
func (encodings *Encodings) UnmarshalJSON(data []byte) (err error) {
32-
*encodings, _, err = unmarshalStringMapP[Encoding](data)
32+
*encodings, err = unmarshalStringMapP[Encoding](data)
3333
return
3434
}
3535

@@ -91,8 +91,6 @@ func (encoding *Encoding) UnmarshalJSON(data []byte) error {
9191
}
9292
_ = json.Unmarshal(data, &x.Extensions)
9393

94-
delete(x.Extensions, originKey)
95-
stripExtensionsOrigin(x.Extensions)
9694
delete(x.Extensions, "contentType")
9795
delete(x.Extensions, "headers")
9896
delete(x.Extensions, "style")

openapi3/example.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ func (example *Example) UnmarshalJSON(data []byte) error {
6060
return unmarshalError(err)
6161
}
6262
_ = json.Unmarshal(data, &x.Extensions)
63-
delete(x.Extensions, originKey)
64-
stripExtensionsOrigin(x.Extensions)
6563
delete(x.Extensions, "summary")
6664
delete(x.Extensions, "description")
6765
delete(x.Extensions, "value")
@@ -70,7 +68,6 @@ func (example *Example) UnmarshalJSON(data []byte) error {
7068
x.Extensions = nil
7169
}
7270
*example = Example(x)
73-
example.Value = stripOriginFromAny(example.Value)
7471
return nil
7572
}
7673

@@ -90,6 +87,6 @@ func (example *Example) Validate(ctx context.Context, opts ...ValidationOption)
9087

9188
// UnmarshalJSON sets Examples to a copy of data.
9289
func (examples *Examples) UnmarshalJSON(data []byte) (err error) {
93-
*examples, _, err = unmarshalStringMapP[ExampleRef](data)
90+
*examples, err = unmarshalStringMapP[ExampleRef](data)
9491
return
9592
}

openapi3/external_docs.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ func (e *ExternalDocs) UnmarshalJSON(data []byte) error {
5050
return unmarshalError(err)
5151
}
5252
_ = json.Unmarshal(data, &x.Extensions)
53-
delete(x.Extensions, originKey)
54-
stripExtensionsOrigin(x.Extensions)
5553
delete(x.Extensions, "description")
5654
delete(x.Extensions, "url")
5755
if len(x.Extensions) == 0 {

openapi3/header.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ func (header *Header) Validate(ctx context.Context, opts ...ValidationOption) er
9797

9898
// UnmarshalJSON sets Headers to a copy of data.
9999
func (headers *Headers) UnmarshalJSON(data []byte) (err error) {
100-
*headers, _, err = unmarshalStringMapP[HeaderRef](data)
100+
*headers, err = unmarshalStringMapP[HeaderRef](data)
101101
return
102102
}

openapi3/info.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ func (info *Info) UnmarshalJSON(data []byte) error {
6363
return unmarshalError(err)
6464
}
6565
_ = json.Unmarshal(data, &x.Extensions)
66-
delete(x.Extensions, originKey)
67-
stripExtensionsOrigin(x.Extensions)
6866
delete(x.Extensions, "title")
6967
delete(x.Extensions, "description")
7068
delete(x.Extensions, "termsOfService")

0 commit comments

Comments
 (0)