@@ -40,7 +40,7 @@ const fileScheme = "file"
4040//
4141// The base path argument is assumed to be canonicalized (e.g. using normalizeBase()).
4242func normalizeURI (refPath , base string ) string {
43- refURL , err := url . Parse (refPath )
43+ refURL , err := parseURL (refPath )
4444 if err != nil {
4545 specLogger .Printf ("warning: invalid URI in $ref %q: %v" , refPath , err )
4646 refURL , refPath = repairURI (refPath )
@@ -58,7 +58,7 @@ func normalizeURI(refPath, base string) string {
5858 return refURL .String ()
5959 }
6060
61- baseURL , _ := url . Parse (base )
61+ baseURL , _ := parseURL (base )
6262 if path .IsAbs (refURL .Path ) {
6363 baseURL .Path = refURL .Path
6464 } else if refURL .Path != "" {
@@ -84,7 +84,6 @@ func normalizeURI(refPath, base string) string {
8484// There is a special case for schemas that are anchored with an "id":
8585// in that case, the rebasing is performed // against the id only if this is an anchor for the initial root document.
8686// All other intermediate "id"'s found along the way are ignored for the purpose of rebasing.
87- //
8887func denormalizeRef (ref * Ref , originalRelativeBase , id string ) Ref {
8988 debugLog ("denormalizeRef called:\n $ref: %q\n original: %s\n root ID:%s" , ref .String (), originalRelativeBase , id )
9089
@@ -94,7 +93,7 @@ func denormalizeRef(ref *Ref, originalRelativeBase, id string) Ref {
9493 }
9594
9695 if id != "" {
97- idBaseURL , err := url . Parse (id )
96+ idBaseURL , err := parseURL (id )
9897 if err == nil { // if the schema id is not usable as a URI, ignore it
9998 if ref , ok := rebase (ref , idBaseURL , true ); ok { // rebase, but keep references to root unchaged (do not want $ref: "")
10099 // $ref relative to the ID of the schema in the root document
@@ -103,7 +102,7 @@ func denormalizeRef(ref *Ref, originalRelativeBase, id string) Ref {
103102 }
104103 }
105104
106- originalRelativeBaseURL , _ := url . Parse (originalRelativeBase )
105+ originalRelativeBaseURL , _ := parseURL (originalRelativeBase )
107106
108107 r , _ := rebase (ref , originalRelativeBaseURL , false )
109108
@@ -168,7 +167,7 @@ func normalizeRef(ref *Ref, relativeBase string) *Ref {
168167//
169168// See also: https://en.wikipedia.org/wiki/File_URI_scheme
170169func normalizeBase (in string ) string {
171- u , err := url . Parse (in )
170+ u , err := parseURL (in )
172171 if err != nil {
173172 specLogger .Printf ("warning: invalid URI in RelativeBase %q: %v" , in , err )
174173 u , in = repairURI (in )
0 commit comments