Skip to content
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

Response as map of map support #155

Open
jaumard opened this issue Sep 10, 2018 · 3 comments
Open

Response as map of map support #155

jaumard opened this issue Sep 10, 2018 · 3 comments

Comments

@jaumard
Copy link
Contributor

jaumard commented Sep 10, 2018

In the swagger codegen I'm doing, the swagger api has something like:

Future<Map<String, int>> getInventory();

My problem is how Jaguar serializer can parse the string response to this ?

@tejainece
Copy link
Member

Can you post what is generated for getInventory.

@jaumard
Copy link
Contributor Author

jaumard commented Sep 10, 2018

Just tried only serializer involve like this and was able to reproduce

import 'package:jaguar_serializer/jaguar_serializer.dart';

void main() {
  final data = '{"sold":17,"placed":1,"string":1139,"Operated":4,"NOT available":1,"123456":1,"Nonavailable":1,"pending":14,"Not-Operated":10,"available":854,"For sale":1,"Offline":1}';

  final repo = JsonRepo();

  Map<String, int> parsedData = repo.from(data);

  print(parsedData);
}

@jaumard
Copy link
Contributor Author

jaumard commented Sep 10, 2018

So now Map<String, int> can be parsed without problem thanks @tejainece ! Let's keep this issue to manage Map<String, Map<String, ...>> :)

@jaumard jaumard changed the title Response as list or map supported / how to Response as map of map support Sep 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants