<commit_before>const fs = require('fs')
const util = require('util')
const parser = require('json-schema-parser')
const immutable = require('immutable')

const buf = fs.readFileSync('./docs/schema/schema.json')
// console.log(JSON.stringify({}, null, 2))
const schemaDef = immutable.fromJS(parser.parse(JSON.parse(buf.toString())))

const printRecursive = (obj, depth, parentKey) => {
  obj.map((v, k) => {
    if (typeof(v) === 'object') {
      if (parentKey === 'properties' && !(depth === 1 && k === 'error')) {
        console.log(`[${depth}]${k} ${v.getIn(['type', 0])}`)
      }
      if (k !== 'definitions') {
        printRecursive(v, parentKey === 'properties' ? depth + 1 : depth, k)
      }
    }
  })
}

// console.log(JSON.stringify(schemaDef.toJS(), null, 2))

printRecursive(schemaDef, 1)

// console.log(JSON.stringify(schemaDef.get('properties').toJS(), null, 2))<commit_msg>再起するときのみ型チェックするようにした<commit_after>const fs = require('fs')
const util = require('util')
const parser = require('json-schema-parser')
const immutable = require('immutable')

const buf = fs.readFileSync('./docs/schema/schema.json')
// console.log(JSON.stringify({}, null, 2))
const schemaDef = immutable.fromJS(parser.parse(JSON.parse(buf.toString())))

const printRecursive = (obj, depth, parentKey) => {
  obj.map((v, k) => {
    if (parentKey === 'properties' && !(depth === 1 && k === 'error')) {
      console.log(`[${depth}]${k} ${v.getIn(['type', 0])}`)
    }
    if (k !== 'definitions' && typeof(v) === 'object') {
      printRecursive(v, parentKey === 'properties' ? depth + 1 : depth, k)
    }
  })
}

// console.log(JSON.stringify(schemaDef.toJS(), null, 2))

printRecursive(schemaDef, 1)

// console.log(JSON.stringify(schemaDef.get('properties').toJS(), null, 2))
{'fraction_non_alphanumeric': 0.2182023742227247, 'fraction_numerical': 0.00791407574901074, 'mean_word_length': 4.2835820895522385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '914510', 'n_tokens_mistral': 627, 'n_tokens_neox': 611, 'n_words': 116}