public String build() throws HyscaleException {

        validate(serviceSpec, profile);

        if (this.serviceInputType == ServiceInputType.YAML) {
            // convert to JSON
            serviceSpec = DataFormatConverter.yamlToJson(serviceSpec);
            profile = DataFormatConverter.yamlToJson(profile);
        }

        // Remove unrequired fields from the profile
        profile = ServiceSpecBuilderUtil.updateProfile(profile);

        return StrategicPatch.apply(serviceSpec, profile, fieldMetaDataProvider);

    }
Builder to create effective service spec by merging service spec and service profile
@author tushar
service-spec/service-spec-commons/src/main/java/io/hyscale/servicespec/commons/builder/EffectiveServiceSpecBuilder.java