OpenAPITools / OpenAPITools/openapi-generator
[Question] C# enum & generic type issue
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
I have C# code
public class AccountStatusModel
{
public Guid AccountId { get; set; }
public UserStatus Status { get; set; }
}
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum UserStatus : int
{
Active = 0,
Suspend = 1,
Deleted = 2
}
public class ApiGrid<T>
{
public GridModel<T> Grid { get; set; }
}
When performing openapi-generator-cli generate -i v1.json -g dart-dio -o ../../JobMobile/job/lib/services
It generate flutter dart
When performing flutter pub run build_runner build it didn't generate file "account_status_model.g.dart"
When I comment out this property "public UserStatus Status { get; set; }" regenerate everything work.
What wrong with the enum in C#?
Errors:
log output for built_value_generator:built_value on lib/services/lib/src/model/account_status_model.dart
E Error in BuiltValueGenerator for abstract class AccountStatusModel implements Built<AccountStatusModel, InvalidType>.
Please make the following changes to use BuiltValue:
1. Make field status have non-dynamic type. If you are already specifying a type, please make sure the type is
correctly imported.
log output for built_value_generator:built_value on
lib/services/lib/src/model/api_grid_of_company_admin_light_model.dart
E Error in BuiltValueGenerator for abstract class ApiGridOfCompanyAdminLightModel implements
Built<ApiGridOfCompanyAdminLightModel, InvalidType>.
Please make the following changes to use BuiltValue:
1. Make field grid have non-dynamic type. If you are already specifying a type, please make sure the type is correctly
imported.
log output for built_value_generator:built_value on lib/services/lib/src/model/api_grid_of_company_employer_model.dart
E Error in BuiltValueGenerator for abstract class ApiGridOfCompanyEmployerModel implements
Built<ApiGridOfCompanyEmployerModel, InvalidType>.
Please make the following changes to use BuiltValue:
1. Make field grid have non-dynamic type. If you are already specifying a type, please make sure the type is correctly
imported.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the v1.json input and the dart-dio generation command, then inspect the generated account_status_model.dart and api_grid_of_company_admin_light_model.dart files alongside the built_value_generator errors. Done means determining whether the enum and generic fields produce invalid Dart types and documenting or correcting the generator behavior so flutter pub run build_runner build generates the missing files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, dart, flutter
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100