<commit_before>module Setup
  module SchemaHandler

    def schema
      fail NotImplementedError
    end

    def object_schema?(schema)
      schema['type'] == 'object' && schema['properties']
    end

    def merged_schema(options = {})
      sch = merge_schema(schema, options)
      unless (base_sch = sch.delete('extends')).nil? || (base_sch = find_ref_schema(base_sch)).nil?
        sch = base_sch.deep_merge(sch) { |_, val1, val2| Cenit::Utility.array_hash_merge(val1, val2) }
      end
      check_id_property(sch)
      sch
    end

    def check_id_property(json_schema)
      return json_schema unless json_schema['type'] == 'object' && !(properties = json_schema['properties']).nil?
      _id, id = properties.delete('_id'), properties.delete('id')
      fail Exception, 'Defining both id and _id' if _id && id
      if _id ||= id
        naked_id = _id.reject { |k, _| %w(unique title description edi format example enum).include?(k) }
        type = naked_id.delete('type')<commit_msg>Allowing modifiers for ID specification<commit_after>module Setup
  module SchemaHandler

    def schema
      fail NotImplementedError
    end

    def object_schema?(schema)
      schema['type'] == 'object' && schema['properties']
    end

    def merged_schema(options = {})
      sch = merge_schema(schema, options)
      unless (base_sch = sch.delete('extends')).nil? || (base_sch = find_ref_schema(base_sch)).nil?
        sch = base_sch.deep_merge(sch) { |_, val1, val2| Cenit::Utility.array_hash_merge(val1, val2) }
      end
      check_id_property(sch)
      sch
    end

    def check_id_property(json_schema)
      return json_schema unless json_schema['type'] == 'object' && !(properties = json_schema['properties']).nil?
      _id, id = properties.delete('_id'), properties.delete('id')
      fail Exception, 'Defining both id and _id' if _id && id
      if _id ||= id
        naked_id = _id.reject { |k, _| %w(unique title description edi format example enum readOnly default).include?(k) }
        type = naked_id.delete('type')
{'fraction_non_alphanumeric': 0.1262848751835536, 'fraction_numerical': 0.003915810083210965, 'mean_word_length': 3.3768736616702357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2995200', 'n_tokens_mistral': 637, 'n_tokens_neox': 641, 'n_words': 151}