idealingua-v1
                                
                                 idealingua-v1 copied to clipboard
                                
                                    idealingua-v1 copied to clipboard
                            
                            
                            
                        API descriptor generator
We may implement a tool converting a JSON into a set of model drafts.
This API call:
{
  "personalizations": [
    {
      "to": [
        {
          "email": "[email protected]",
          "name": "John Doe"
        }
      ],
      "subject": "Hello, World!"
    }
  ],
  "from": {
    "email": "[email protected]",
    "name": "Sam Smith"
  },
  "reply_to": {
    "email": "[email protected]",
    "name": "Sam Smith"
  }
}
may be translated into
data emailuser {
   email: str
   name: str
}
data emailData {
   to: list[emailuser]
   subject: str
}
data {
   personalizations: list[emailData]
   from: emailUser
   reply_to: emailUser
}
This may allow us to interoperate with simple REST data providers.
Also we may convert swagger and other popular formats into our models. Kinda related: 7mind/idealingua-v1#19
@pshirshov How get should deal with follow input?
"from": {
    "email": "[email protected]",
    "name": "Sam Smith"
  },
  "reply_to": {
    "email": "[email protected]",
    "name": "Sam Smith"
    "extra_field" : "foo"    // new field!
  }
Either:
// One for both inputs
data emailUser {
    email : str
    name : str
    extraField : opt[str]
}
or
data emailUser {
    email : str
    name : str
}
data emailUserWithExtra {
    email : str
    name : str
    extraField : str
}
I guess second one. From what I can see first one requires a complex and fragile heuristic.