nixzhu / Baby

Create models from a JSON file, even a Baby can do it.
https://apps.apple.com/cn/app/ducky-model-editor/id1525505933
MIT License
222 stars 21 forks source link

crash with large data set, app will not reopen #12

Open rachebartmposs opened 6 years ago

rachebartmposs commented 6 years ago

Briefly describe your problem when use Baby. Loaded a large JSON URL, gave me results, then crashed. Will not restart. Bounces in Dock, then shows "Application Not Responding" when right-clicking App icon

URL used: https://netrunnerdb.com/api/2.0/public/cards

just deleted app and reinstalled. Working, but going to see if it happens again

nixzhu commented 6 years ago

Thanks for your report. I will investigate it.

nixzhu commented 6 years ago

I think it's because the JSON is way too large, syntax highlighting & parse takes too much time.

If you like, you could use the command line version Baby in this repo to avoid the performance issue.

Such as:

$ baby -i ./large.json --codable

Output:

struct MyModel: Codable {
    let imageUrlTemplate: String
    struct Data: Codable {
        let code: String
        let deckLimit: Int
        let factionCode: String
        let flavor: String?
        let illustrator: String?
        let influenceLimit: Int?
        let keywords: String?
        let minimumDeckSize: Int?
        let packCode: String
        let position: Int
        let quantity: Int
        let sideCode: String
        let text: String?
        let title: String
        let typeCode: String
        let uniqueness: Bool
        let baseLink: Int?
        let cost: Int?
        let factionCost: Int?
        let memoryCost: Int?
        let strength: Int?
        let advancementCost: Int?
        let agendaPoints: Int?
        let trashCost: Int?
        private enum CodingKeys: String, CodingKey {
            case code
            case deckLimit = "deck_limit"
            case factionCode = "faction_code"
            case flavor
            case illustrator
            case influenceLimit = "influence_limit"
            case keywords
            case minimumDeckSize = "minimum_deck_size"
            case packCode = "pack_code"
            case position
            case quantity
            case sideCode = "side_code"
            case text
            case title
            case typeCode = "type_code"
            case uniqueness
            case baseLink = "base_link"
            case cost
            case factionCost = "faction_cost"
            case memoryCost = "memory_cost"
            case strength
            case advancementCost = "advancement_cost"
            case agendaPoints = "agenda_points"
            case trashCost = "trash_cost"
        }
    }
    let data: [Data]
    let total: Int
    let success: Bool
    let versionNumber: String
    let lastUpdated: String
    private enum CodingKeys: String, CodingKey {
        case imageUrlTemplate
        case data
        case total
        case success
        case versionNumber = "version_number"
        case lastUpdated = "last_updated"
    }
}

Read the README for more info.

rachebartmposs commented 6 years ago

Thanks I’ll give it a try. Thanks!

— Jeff

"Jack in, turn on, and download!"

On Nov 7, 2017, at 7:00 PM, nixzhu notifications@github.com wrote:

I think it's because the JSON is way too large, syntax highlighting & parse takes too much time.

If you like, you could use the command line version Baby in this repo to avoid the performance issue.

Such as:

$ baby -i ./large.json --codable Output:

struct MyModel: Codable { let imageUrlTemplate: String struct Data: Codable { let code: String let deckLimit: Int let factionCode: String let flavor: String? let illustrator: String? let influenceLimit: Int? let keywords: String? let minimumDeckSize: Int? let packCode: String let position: Int let quantity: Int let sideCode: String let text: String? let title: String let typeCode: String let uniqueness: Bool let baseLink: Int? let cost: Int? let factionCost: Int? let memoryCost: Int? let strength: Int? let advancementCost: Int? let agendaPoints: Int? let trashCost: Int? private enum CodingKeys: String, CodingKey { case code case deckLimit = "deck_limit" case factionCode = "faction_code" case flavor case illustrator case influenceLimit = "influence_limit" case keywords case minimumDeckSize = "minimum_deck_size" case packCode = "pack_code" case position case quantity case sideCode = "side_code" case text case title case typeCode = "type_code" case uniqueness case baseLink = "base_link" case cost case factionCost = "faction_cost" case memoryCost = "memory_cost" case strength case advancementCost = "advancement_cost" case agendaPoints = "agenda_points" case trashCost = "trash_cost" } } let data: [Data] let total: Int let success: Bool let versionNumber: String let lastUpdated: String private enum CodingKeys: String, CodingKey { case imageUrlTemplate case data case total case success case versionNumber = "version_number" case lastUpdated = "last_updated" } } Read the README for more info.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.