Skip to content

Commit

Permalink
skip inline when targeting local
Browse files Browse the repository at this point in the history
  • Loading branch information
rucciva committed Jun 19, 2024
1 parent 720c9ad commit 02e2edb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/util/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,18 @@ func (c Components) copyComponents(docv3 *libopenapi.DocumentModel[v3.Document],
}

if !exist {
if refExp := strings.Split(ref.FullDefinition, "#/"); len(refExp) == 2 &&
(refExp[0] == ref.Index.GetSpecAbsolutePath() || refExp[0] == "") &&
ref.Index == docv3.Index {
// reference to root document. skip inline
continue
}

ref.Node.Content = idx.GetMappedReferences()[ref.FullDefinition].Node.Content
} else {
LocalizeReference(ref, prefix)
continue
}

LocalizeReference(ref, prefix)
}
}

Expand Down

0 comments on commit 02e2edb

Please sign in to comment.