glideapps / glideapps/quicktype
Missing generated classes
- Dominant language
- TypeScript
- Stars
- 13.9k
- Forks
- 1.2k
- Avg merge
- 8h 53m
- Merged PRs (30d)
- 369
Description
I am running Quicktype version 15.0.258. and trying to convert the Plaid JSON API to C# classes.
I have a reproducible example available at https://github.com/oconnor0/quicktype-bug/
I have 3 JSON files in a directory and run
quicktype --lang cs --namespace Plaid --out Plaid.cs .
to generate C# code. The resulting code is missing the top-level class for one of the JSON files. And one of the renamed "Options" types is using the wrong name prefix.
`AccountsGet.Request.json`:
```
{
"client_id": "1234abcd5678efgh90ij",
"secret": "1234abcd5678efgh90ij",
"access_token": "1234abcd5678efgh90ij"
}
```
`AuthGet.Request.json`:
```
{
"client_id": "1234abcd5678efgh90ij",
"secret": "1234abcd5678efgh90ij",
"access_token": "1234abcd5678efgh90ij",
"options": {
"account_ids": ["abc", "def", "ghi"]
}
}
```
`TransactionsGet.Request.json`:
```
{
"client_id": "1234abcd5678efgh90ij",
"secret": "1234abcd5678efgh90ij",
"access_token": "1234abcd5678efgh90ij",
"start_date": "2020-01-01",
"end_date": "2020-01-31",
"options": {
"account_ids": ["abc", "def", "ghi"],
"count": 100,
"offset": 0
}
}
```
The relevant portion of `Plaid.cs` is:
```
public partial class AuthGetRequest
{
[JsonProperty("client_id")]
public string ClientId { get; set; }
[JsonProperty("secret")]
public string Secret { get; set; }
[JsonProperty("access_token")]
public string AccessToken { get; set; }
[JsonProperty("options", NullValueHandling = NullValueHandling.Ignore)]
public AccountsGetRequestOptions Options { get; set; }
}
public partial class AccountsGetRequestOptions
{
[JsonProperty("account_ids")]
public string[] AccountIds { get; set; }
}
public partial class TransactionsGetRequest
{
[JsonProperty("client_id")]
public string ClientId { get; set; }
[JsonProperty("secret")]
public string Secret { get; set; }
[JsonProperty("access_token")]
public string AccessToken { get; set; }
[JsonProperty("start_date")]
public DateTimeOffset StartDate { get; set; }
[JsonProperty("end_date")]
public DateTimeOffset EndDate { get; set; }
[JsonProperty("options")]
public TransactionsGetRequestOptions Options { get; set; }
}
public partial class TransactionsGetRequestOptions
{
[JsonProperty("account_ids")]
public string[] AccountIds { get; set; }
[JsonProperty("count")]
public long Count { get; set; }
[JsonProperty("offset")]
public long Offset { get; set; }
}
```
I expect an `AccountsGetRequest` class. I expect `AuthGetRequest.Options` to be of type `AuthGetRequestOptions` not `AccountsGetRequestOptions`.
Contributor guide
Assessment
This issue has not been assessed yet.