/**
  * Gets the map of service descriptors by service ID->descriptor.
  *
  * @return the service descriptor mapping.
  */
 private Map<String, ServiceDescriptor> getServiceDescriptors() {
   Map<String, ServiceDescriptor> descriptors = new HashMap<>();
   for (ServiceDescriptor descriptor : serviceDescriptors.listDescriptors(Locale.getDefault())) {
     descriptors.put(descriptor.getServiceId(), descriptor);
   }
   return descriptors;
 }
  private void validateParam(CatalogServiceCommonParam input, CatalogService existing) {

    ServiceDescriptor descriptor =
        catalogServiceManager.getServiceDescriptor(input.getBaseService());

    if (descriptor == null) {
      throw APIException.badRequests.baseServiceNotFound(input.getBaseService());
    }

    for (CatalogServiceFieldParam field : input.getCatalogServiceFields()) {
      if (!field.getOverride()) {
        continue;
      }
      String fieldName = field.getName();
      String fieldValue = field.getValue();

      ServiceField descriptorField = descriptor.getField(fieldName);
      if (descriptorField != null) {
        ValidationUtils.validateField(input.getMaxSize(), descriptorField, fieldValue);
      }
    }
  }