glideapps / quicktype

Generate types and converters from JSON, Schema, and GraphQL
https://app.quicktype.io
Apache License 2.0
12.31k stars 1.07k forks source link

C# Renderer with `--features just-types` doesn't include required `using`s. #2523

Open gregmarr opened 7 months ago

gregmarr commented 7 months ago

If you run the C# renderer with --features just-types --array-type list then it creates List<T> properties, but doesn't add the required using System.Collections.Generic;. It also happens without the --array-type list if a Dictionary<K,V> is generated as a property.

This is due to the checks here, with FIXMEs from 6 years ago pointing out this exact bug. https://github.com/glideapps/quicktype/blob/916cd94a9d4fdeab870b6a12f42ad43ebaedf314/packages/quicktype-core/src/language/CSharp.ts#L851 https://github.com/glideapps/quicktype/blob/916cd94a9d4fdeab870b6a12f42ad43ebaedf314/packages/quicktype-core/src/language/CSharp.ts#L1579