Change URI to IRI after finding validation pattern
This commit is contained in:
6
id.go
6
id.go
@@ -9,18 +9,18 @@ import (
|
||||
|
||||
type ID struct {
|
||||
*CommonAttributes
|
||||
URI URI `xml:"uri"`
|
||||
URI IRI `xml:"uri"`
|
||||
}
|
||||
|
||||
func NewID() *ID {
|
||||
return &ID{URI: URI(fmt.Sprint("urn:uuid:", uuid.New()))}
|
||||
return &ID{URI: IRI(fmt.Sprint("urn:uuid:", uuid.New()))}
|
||||
}
|
||||
|
||||
func (i *ID) Check() error {
|
||||
if i.URI == "" {
|
||||
return errors.New("uri element of id empty")
|
||||
} else {
|
||||
if !isValidURI(i.URI) {
|
||||
if !isValidIRI(i.URI) {
|
||||
return fmt.Errorf("uri element %v of id not correctly formatted", i.URI)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user