FasterXML / FasterXML/jackson-annotations

'Bundled' @JsonView annotations should merge

Open
#38 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.1k
Forks
342
Avg merge
8h 53m
Merged PRs (30d)
2

Description

I have created two annotation bundles:

```
...
@JsonView(view1.class)
@JacksonAnnotationsInside
...
public @interface bundle1 {
...
```

and

```
...
@JsonView(view2.class)
@JacksonAnnotationsInside
...
public @interface bundle2 {
...
```

Then I apply the annotations to properties, like this:

```
@bundle1
String prop1

@bundle2
int prop2

@bundle1
@bundle2
boolean prop3
```

I would like it if the @JsonView annotations be merged for prop3 (becoming the equivalent of @JsonView({view1.class, view2.class})). Right now it appears that one of the them overwrites the other one.

Alternatively, if there is another way of doing what I am trying, I would appreciate that. I know I could create a 3rd annotation named bundle1and2, but that is a bit ugly and I end up with duplicate code. I know I can also remove the @JsonView from the bundles and separate it out and use @JsonView({view1.class, view2.class}), but I don't want to do that either as I would prefer the views to be encapsulated in the bundles.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.