Skip to content

Commit

Permalink
Merge pull request #2 from yury-palyanitsa/zerolint
Browse files Browse the repository at this point in the history
Fix unwrap
  • Loading branch information
viatoriche authored Sep 26, 2024
2 parents 6d194b6 + 9206aec commit d7a5d1d
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions unwrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,7 @@ func (r *RAML) unwrapUnionShape(base *BaseShape, unionShape *UnionShape, history
return nil
}

func (r *RAML) unwrapSourceIfObj(src *Shape, history []Shape) (Shape, error) {
if src == nil {
return nil, fmt.Errorf("source is nil")
}
srcShape := *src
base, isObjShape := srcShape.(*ObjectShape)
if !isObjShape {
return srcShape, nil
}
func (r *RAML) unwrapSource(base *BaseShape, history []Shape) (Shape, error) {
var source Shape
switch {
case base.Alias != nil:
Expand Down Expand Up @@ -432,7 +424,7 @@ func (r *RAML) UnwrapShape(s *Shape, history []Shape) (Shape, error) {
}
history = append(history, target)

source, err := r.unwrapSourceIfObj(s, history)
source, err := r.unwrapSource(base, history)
if err != nil {
return nil, StacktraceNewWrapped("unwrap source if obj", err, base.Location,
stacktrace.WithPosition(&base.Position), stacktrace.WithType(stacktrace.TypeUnwrapping))
Expand Down

0 comments on commit d7a5d1d

Please sign in to comment.