jonataslaw / get_cli

Official Getx CLI
Apache License 2.0
578 stars 164 forks source link

How to Avoid Model Duplication When Using 'get_cli' to Generate Models from JSON #262

Open irayshi opened 1 month ago

irayshi commented 1 month ago

I am trying to generate models from several JSON files in my Flutter project. I am facing an issue where the generated model structures are colliding with each other. Here is an example of my JSON file structure:

test.json:

{
  "id": "",
  "global": "",
  "data": [
    {
      "name": ""
    }
  ]
}

myTest.json:

{
  "id": "",
  "data": [
    {
      "name": ""
    }
  ]
}

When I run the following commands:

get generate model with assets/models/test.json
get generate model with assets/models/myTest.json

The generated models have the same structure for the 'data' part. I want to avoid duplicating the 'data' model without having to manually change it every time I generate the models.

Is there a way or specific configuration in 'get_cli' to avoid duplicating models that have the same structure? Or is there another solution that I can apply to this issue?