private void checkForServiceDependency(List<File> serviceSpecFiles,
                                           List<File> profileFiles, boolean strictProfile) throws HyscaleException {
        Set<String> serviceFromSpec = new HashSet<>();
        Set<String> serviceFromProfiles = new HashSet<String>();

        serviceFromSpec = serviceSpecFiles.stream().map(eachFile -> {
            try {
                return ServiceSpecUtil.getServiceName(eachFile);
            } catch (HyscaleException e) {
                return null;
            }
        }).collect(toSet());

        boolean multipleProfileOfSameService = false;
        Set<String> mismatchedFileAndProfileNameSet = new HashSet<>();
        Set<String> multipleProfilesServices = new HashSet<String>();
        for (File eachProfile : profileFiles) {
            String serviceName = ServiceProfileUtil.getServiceNameFromProfile(eachProfile);
            if (strictProfile) {
                String profileName = ServiceProfileUtil.getProfileName(eachProfile);
                String fileName = eachProfile.getName();
                if (!fileName.matches(profileLocator.getProfileNamePattern(profileName))) {
                    mismatchedFileAndProfileNameSet.add(fileName);
                }
            }
            multipleProfileOfSameService = serviceFromProfiles.add(serviceName);
            if (!multipleProfileOfSameService) {
                multipleProfilesServices.add(serviceName);
            }
        }

        if (!mismatchedFileAndProfileNameSet.isEmpty()) {
            throw new HyscaleException(ControllerErrorCodes.PROFILE_NAMES_MISMATCHED_WITH_FILES, mismatchedFileAndProfileNameSet.stream().collect(Collectors.joining(",")));
        }

        if (!multipleProfilesServices.isEmpty()) {
            throw new HyscaleException(ControllerErrorCodes.UNIQUE_PROFILE_REQUIRED, multipleProfilesServices.stream().collect(Collectors.joining(",")));
        }

        if (strictProfile) {
            serviceFromSpec.removeAll(serviceFromProfiles);
            if (!serviceFromSpec.isEmpty()) {
                throw new HyscaleException(ControllerErrorCodes.PROFILE_NOT_PROVIDED_FOR_SERVICES, serviceFromSpec.stream().collect(Collectors.joining(",")));
            }
        }
    }
Processes the profile arg , validates the profile schema
and validates service dependency on profiles like
multiple profiles or missing profiles
workflow-controller/controller-service/src/main/java/io/hyscale/controller/profile/ProfileSpecProcessor.java