<commit_before>import JSONUtilities

public struct ObjectSchema {
    public let requiredProperties: [Property]
    public let optionalProperties: [Property]
    public let properties: [Property]
    public let minProperties: Int?
    public let maxProperties: Int?
    public let additionalProperties: Schema?
    public let abstract: Bool
    public let discriminator: Discriminator?
}

public struct Property {
    public let name: String
    public let required: Bool
    public let schema: Schema
}

extension ObjectSchema: JSONObjectConvertible {

    public init(jsonDictionary: JSONDictionary) throws {
        let requiredPropertyNames: [String] = (jsonDictionary.json(atKeyPath: "required")) ?? []
        let propertiesByName: [String: Schema] = (jsonDictionary.json(atKeyPath: "properties")) ?? [:]

        requiredProperties = requiredPropertyNames.compactMap { name in
            if let schema = propertiesByName[name] {
                return Property(name: name, required: true, schema: schema)
            }
            return nil
        }<commit_msg>add public init for ObjectSchema<commit_after>import JSONUtilities

public struct ObjectSchema {
    public let requiredProperties: [Property]
    public let optionalProperties: [Property]
    public let properties: [Property]
    public let minProperties: Int?
    public let maxProperties: Int?
    public let additionalProperties: Schema?
    public let abstract: Bool
    public let discriminator: Discriminator?

    public init(requiredProperties: [Property],
                optionalProperties: [Property],
                properties: [Property],
                minProperties: Int? = nil,
                maxProperties: Int? = nil,
                additionalProperties: Schema? = nil,
                abstract: Bool = false,
                discriminator: Discriminator? = nil) {
        self.requiredProperties = requiredProperties
        self.optionalProperties = optionalProperties
        self.properties = properties
        self.minProperties = minProperties
        self.maxProperties = maxProperties
        self.additionalProperties = additionalProperties
        self.abstract = abstract
        self.discriminator = discriminator
    }
}

public struct Property {
    public let name: String
    public let required: Bool
    public let schema: Schema
}

extension ObjectSchema: JSONObjectConvertible {

    public init(jsonDictionary: JSONDictionary) throws {
        let requiredPropertyNames: [String] = (jsonDictionary.json(atKeyPath: "required")) ?? []
        let propertiesByName: [String: Schema] = (jsonDictionary.json(atKeyPath: "properties")) ?? [:]

        requiredProperties = requiredPropertyNames.compactMap { name in
            if let schema = propertiesByName[name] {
                return Property(name: name, required: true, schema: schema)
            }
            return nil
        }
{'fraction_non_alphanumeric': 0.07517241379310345, 'fraction_numerical': 0.0, 'mean_word_length': 2.925575101488498, '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': '2545186', 'n_tokens_mistral': 687, 'n_tokens_neox': 668, 'n_words': 216}