bluelinelabs / bluelinelabs/LoganSquare

NoSuchMapperException in a derived class

Open
#156 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
3.2k
Forks
303
PR merge metrics
No merged PRs in 30d

Description

Hi,

i have this model:

```
@JsonObject
public class ValidationErrorsModel {

@SerializedName("validation_errors")
@JsonField(name = "validation_errors")
public SimpleArrayMap> validationErrors;
}
```

and i have another one that extends it:

```
@JsonObject
public class UserCreateModel extends ValidationErrorsModel
```

but it appears this error:

```
Caused by: com.bluelinelabs.logansquare.NoSuchMapperException: Class io.swagger.client.model.ValidationErrorsModel could not be mapped to a JSON object. Perhaps it hasn't been annotated with @JsonObject?
at com.bluelinelabs.logansquare.LoganSquare.mapperFor(LoganSquare.java:304)
at io.swagger.client.model.UserCreateModel$$JsonObjectMapper.(UserCreateModel$$JsonObjectMapper.java:15)
```

any idea how can i solve it?

Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with LoganSquare.mapperFor(LoganSquare.java:304) and the generated UserCreateModel$$JsonObjectMapper, where the exception occurs. Reproduce the inheritance case using the ValidationErrorsModel and UserCreateModel shown in the report, then trace how annotated base classes are resolved. Done means the derived model maps successfully without NoSuchMapperException and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.