Refactor check earlier registration
[nonrtric/plt/sme.git] / capifcore / internal / publishserviceapi / typevalidation.go
index ad19324..287a07d 100644 (file)
@@ -32,6 +32,9 @@ func (sd ServiceAPIDescription) Validate() error {
        return nil
 }
 
-func (sd ServiceAPIDescription) IsPublished(otherService ServiceAPIDescription) bool {
-       return sd.ApiName == otherService.ApiName
+func (sd ServiceAPIDescription) ValidateAlreadyPublished(otherService ServiceAPIDescription) error {
+       if sd.ApiName == otherService.ApiName {
+               return errors.New("service with identical apiName is already published")
+       }
+       return nil
 }