<commit_before>use inflector::Inflector;
use linked_hash_map::LinkedHashMap;
use serde_json::{json, Value};

use crate::options::Options;
use crate::shape::{self, Shape};

#[allow(dead_code)]
pub struct Ctxt {
    options: Options,
}

pub type Ident = String;
pub type Code = String;

pub fn json_schema(name: &str, shape: &Shape, options: Options) -> (Ident, Option<Code>) {
    let mut ctxt = Ctxt { options };

    let ident = "".to_string();
    let value = type_from_shape(&mut ctxt, name, shape);

    let mut schema = json!({
        "$schema": "http://json-schema.org/schema#",
        "title": name
    });

    if let Value::Object(map) = value {
        for (key, val) in map.into_iter() {
            schema[key] = val;
        }<commit_msg>shared: Use actual JSON Schema version.<commit_after>use inflector::Inflector;
use linked_hash_map::LinkedHashMap;
use serde_json::{json, Value};

use crate::options::Options;
use crate::shape::{self, Shape};

#[allow(dead_code)]
pub struct Ctxt {
    options: Options,
}

pub type Ident = String;
pub type Code = String;

pub fn json_schema(name: &str, shape: &Shape, options: Options) -> (Ident, Option<Code>) {
    let mut ctxt = Ctxt { options };

    let ident = "".to_string();
    let value = type_from_shape(&mut ctxt, name, shape);

    let mut schema = json!({
        "$schema": "http://json-schema.org/draft-07/schema#",
        "title": format!("Generated schema for {}", name)
    });

    if let Value::Object(map) = value {
        for (key, val) in map.into_iter() {
            schema[key] = val;
        }
{'fraction_non_alphanumeric': 0.15726062143310082, 'fraction_numerical': 0.0012682308180088776, 'mean_word_length': 3.395543175487465, 'pattern_counts': {'":': 4, '<': 5, '<?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': '7052602', 'n_tokens_mistral': 513, 'n_tokens_neox': 518, 'n_words': 146}