Skip to content

Jackson InvalidDefinitionException for Class Completion #2085

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

Closed
houtaroy opened this issue Feb 16, 2022 · 1 comment · Fixed by #2086
Closed

Jackson InvalidDefinitionException for Class Completion #2085

houtaroy opened this issue Feb 16, 2022 · 1 comment · Fixed by #2086
Labels
type: enhancement A general enhancement

Comments

@houtaroy
Copy link
Contributor

houtaroy commented Feb 16, 2022

org.springframework.data.elasticsearch.core.suggest.Completion has no parameterless constructor
use jackson load JSON to Completion, throws InvalidDefinitionException
should we add a parameterless constructor?

class:

@Document(indexName = "trending")
@Setting(settingPath = "elasticsearch/settings/default.json")
@Data
@NoArgsConstructor
@FieldNameConstants
public class Trending {

    @Id
    private String id;
    @CompletionField
    private Completion suggest;
}

error:

com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `org.springframework.data.elasticsearch.core.suggest.Completion` (no Creators, like default constructor, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 16, 2022
@houtaroy houtaroy changed the title Jackson InvalidDefinitionException for class Completion Jackson InvalidDefinitionException for Class Completion Feb 16, 2022
@sothawo
Copy link
Collaborator

sothawo commented Feb 16, 2022

Feel free to submit a PR adding one, initialize the input array to an empty one.

@sothawo sothawo added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 16, 2022
sothawo pushed a commit that referenced this issue Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants