<commit_before>angularAPP.controller('NewSubjectCtrl', function ($scope, $route, $rootScope, $http, $log, $q, $location, UtilsFactory, SchemaRegistryFactory, toastFactory, env) {
  $log.debug("NewSubjectCtrl - initiating");

  $scope.$on('$routeChangeSuccess', function() {
       $scope.cluster = env.getSelectedCluster().NAME;//$routeParams.cluster;
  })

  $scope.noSubjectName = true;
  $rootScope.listChanges = false;
  toastFactory.hideToast();

  $scope.showSimpleToast = function (message) {
    toastFactory.showSimpleToast(message)
  };
  $scope.showSimpleToastToTop = function (message) {
    toastFactory.showSimpleToastToTop(message);
  };

  $scope.hideToast = function () {
    toastFactory.hide();
  };

  $scope.$watch(function () {
    return $scope.text;
  }, function (a) {
    $scope.allowCreateOrEvolution =false;
    updateCurl();
  }, true);

  $scope.$watch(function () {
    return $scope.newAvroString;
  }, function (a) {
    $scope.allowCreateOrEvolution =false;
    updateCurl();
  }, true);


  /**
   * Create filter function for a query string
   */
  function createFilterFor(query) {
    var lowercaseQuery = angular.lowercase(query);
    return function filterFn(state) {
      return (state.value.indexOf(lowercaseQuery) === 0);
    };
  }

  /**
   * Possibilities
   * 1. no-subject-name -> User has not filled-in the subjectName
   * 2. not-json        -> Schema is invalid Json
   * 3. new-schema      -> Schema is Json + subject does not exist
   */
  $scope.allowCreateOrEvolution = false;
  var validTypes = ["null","double","string","record","int","float","long", "array"]
  var i =0;var j =0;var x =0;
  function testCompatibility(subject, newAvroString) {
    var jsonToArray = {}
    angular.copy(newAvroString, jsonToArray);
    var arr = Object.values(jsonToArray);

    for (i = 0; i < arr.length; i++){
     if(angular.isDefined(arr[i])) {
       for (j = 0; j < arr[i].length; j++){
       if( arr[i][j] && angular.isDefined(arr[i][j].type)) {
          if(typeof arr[i][j].type == "object"){
            for (x = 0; x < arr[i][j].type.length; x++){
              if(validTypes.indexOf(arr[i][j].type[x]) < 0 && arr[i][j].type[x].type != 'array') {
                $scope.notValidType = true;<commit_msg>more valid types<commit_after>angularAPP.controller('NewSubjectCtrl', function ($scope, $route, $rootScope, $http, $log, $q, $location, UtilsFactory, SchemaRegistryFactory, toastFactory, env) {
  $log.debug("NewSubjectCtrl - initiating");

  $scope.$on('$routeChangeSuccess', function() {
       $scope.cluster = env.getSelectedCluster().NAME;//$routeParams.cluster;
  })

  $scope.noSubjectName = true;
  $rootScope.listChanges = false;
  toastFactory.hideToast();

  $scope.showSimpleToast = function (message) {
    toastFactory.showSimpleToast(message)
  };
  $scope.showSimpleToastToTop = function (message) {
    toastFactory.showSimpleToastToTop(message);
  };

  $scope.hideToast = function () {
    toastFactory.hide();
  };

  $scope.$watch(function () {
    return $scope.text;
  }, function (a) {
    $scope.allowCreateOrEvolution =false;
    updateCurl();
  }, true);

  $scope.$watch(function () {
    return $scope.newAvroString;
  }, function (a) {
    $scope.allowCreateOrEvolution =false;
    updateCurl();
  }, true);


  /**
   * Create filter function for a query string
   */
  function createFilterFor(query) {
    var lowercaseQuery = angular.lowercase(query);
    return function filterFn(state) {
      return (state.value.indexOf(lowercaseQuery) === 0);
    };
  }

  /**
   * Possibilities
   * 1. no-subject-name -> User has not filled-in the subjectName
   * 2. not-json        -> Schema is invalid Json
   * 3. new-schema      -> Schema is Json + subject does not exist
   */
  $scope.allowCreateOrEvolution = false;
  var validTypes = ["null","double","string","record","int","float","long", "array", "boolean", "enum","map","fixed","bytes"]
  var i =0;var j =0;var x =0;
  function testCompatibility(subject, newAvroString) {
    var jsonToArray = {}
    angular.copy(newAvroString, jsonToArray);
    var arr = Object.values(jsonToArray);

    for (i = 0; i < arr.length; i++){
     if(angular.isDefined(arr[i])) {
       for (j = 0; j < arr[i].length; j++){
       if( arr[i][j] && angular.isDefined(arr[i][j].type)) {
          if(typeof arr[i][j].type == "object"){
            for (x = 0; x < arr[i][j].type.length; x++){
              if(validTypes.indexOf(arr[i][j].type[x]) < 0 && arr[i][j].type[x].type != 'array') {
                $scope.notValidType = true;
{'fraction_non_alphanumeric': 0.1673979815708644, 'fraction_numerical': 0.004826678367705134, 'mean_word_length': 3.3878729547641964, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7237385', 'n_tokens_mistral': 1517, 'n_tokens_neox': 1481, 'n_words': 301}