-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] [dart-dio] No builder factory for BuiltMap<String, JsonObject> #6951
Comments
Can you test this on master? |
Tested this on master: import 'package:built_collection/built_collection.dart';
import 'package:built_value/json_object.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
part 'model_that_fails.g.dart';
abstract class ModelThatFails implements Built<ModelThatFails, ModelThatFailsBuilder> {
@nullable
@BuiltValueField(wireName: r'data')
BuiltList<BuiltMap<String, JsonObject>> get data;
// Boilerplate code needed to wire-up generated code
ModelThatFails._();
factory ModelThatFails([updates(ModelThatFailsBuilder b)]) = _$ModelThatFails;
static Serializer<ModelThatFails> get serializer => _$modelThatFailsSerializer;
} It also generated this builder factory in ..addBuilderFactory(
const FullType(BuiltList, const [
const FullType(BuiltMap,
const [const FullType(String), const FullType(JsonObject)])
]),
() => new ListBuilder<BuiltMap<String, JsonObject>>()) Looks like this is what you were missing. |
I'll have to test and get back at you. Thank you for investigating on your end. What exactly did you meann with > Looks like this is what you were missing. |
I was talking about the builder factory above. Judging from your issue in built_value this is the one that was missing. Now it is being generated as far as I can tell. |
I'm not sure how is this fixed or what's the workaround, but I'm getting the same issue with the latest openapi-generator-cli-5.1.1.jar @flipch Is it working for you? |
If you are missing a builder factory, you can always add it manually to the serializers and pass the result to your API constructor. If you have a spec that causes missing builder factories then please share. |
I have this model object:
And the resulting Dart object cannot be deserialized:
Created ListResultDTO contains this:
So it seem to me it's the same issue: No builder factory for BuiltMap<String, JsonObject> ... I'm not sure how to add it :-/ ? |
OK I have it, in my case I need to add:
I guess it should be part of the "default" build. |
Glad that your workaround works, I will check out what is missing later. |
This is still an issue, though the current workaround still is sufficient. Is it possible to open this back up? |
Could you guys try the fix from the PR branch please. |
Description
When describing an object whose type is a List<Dictionary<string, object>> dart-dio fails to generate a proper serializor prompting an exception
openapi-generator version
"@openapitools/openapi-generator-cli": "~1.0.13-4.3.1"
OpenAPI declaration file content or url
Command line used for generation
Options besides this only include the swagger file location and package name/version.
openapi-generator generate --enable-post-process-file -o headset_mobile_api
Steps to reproduce
Include that model and generate the dart code. Try and deserialize it with this example input
'[a.b, 123]'
Related issues/PRs
Suggest a fix
It seems the issue is within the Built_Value serializor or the Model that got generated. Not too knowledgeable in mustache templating
The text was updated successfully, but these errors were encountered: