Hi @Carapacik, I'm having an issue with enums which have the same name.
I created a simplified version of my issue here: swagger schema.
Basically, I have an endpoint which takes an enum value as path param (with reference to my swagger json example, the /{type} endpoint accepts a Type.paramValue1 or Type.paramValue2 enum value).
But I also have a TestClass model, which contains another Type enum (which has 2 values: Type.propertyValue1 or Type.propertyValue2). Obviously, the two Type enums are not the same, they are two different entities.
The generated code actually compiles, but the two enums are in conflict, in fact only the Type.propertyValue1 and Type.propertyValue2 enum is generated (and also referenced as a parameter in the findByType, where instead I would want to use Type.paramValue1 or Type.paramValue2.
Basically, this code in test_client.dart:
@GET('/{type}')
Future<void> findByType({
@Path('type') required Type type,
});
and this code in test_class.dart:
const factory TestClass({
/// Type used as property value
required Type type,
}) = _TestClass;
both reference this Type enum (which is the only Type enum created, the other is ignored):
enum Type {
@JsonValue('propertyValue1')
propertyValue1('propertyValue1'),
@JsonValue('propertyValue2')
propertyValue2('propertyValue2'),
/// Default value for all unparsed values, allows backward compatibility when adding new values on the backend.
$unknown(null);
/// ... etc ...
}
Hi @Carapacik, I'm having an issue with enums which have the same name. I created a simplified version of my issue here: swagger schema. Basically, I have an endpoint which takes an enum value as path param (with reference to my swagger json example, the
/{type}
endpoint accepts aType.paramValue1
orType.paramValue2
enum value). But I also have aTestClass
model, which contains anotherType
enum (which has 2 values:Type.propertyValue1
orType.propertyValue2
). Obviously, the twoType
enums are not the same, they are two different entities. The generated code actually compiles, but the two enums are in conflict, in fact only theType.propertyValue1
andType.propertyValue2
enum is generated (and also referenced as a parameter in thefindByType
, where instead I would want to useType.paramValue1
orType.paramValue2
. Basically, this code intest_client.dart
:and this code in
test_class.dart
:both reference this
Type
enum (which is the onlyType
enum created, the other is ignored):