Skip to content

INF-138 - Include data in response even if not populated#28

Merged
ctucker3 merged 2 commits intodevelopfrom
bug/INF-138
Jul 10, 2020
Merged

INF-138 - Include data in response even if not populated#28
ctucker3 merged 2 commits intodevelopfrom
bug/INF-138

Conversation

@ctucker3
Copy link
Contributor

@ctucker3 ctucker3 commented Jun 30, 2020

One Line of code to fix it all, One line to find them,
One Line of code to bring them all and in the Jackson bind them

Testing

  • Tests run
  • Data object is in the result of the response even if not results are returned.

@ctucker3 ctucker3 marked this pull request as ready for review June 30, 2020 18:16
@nickpalladino nickpalladino changed the title Include data in response even if not populated INF-138 - Include data in response even if not populated Jun 30, 2020
Copy link
Member

@nickpalladino nickpalladino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, tests pass and manual testing with insomnia has data array responses include the empty data array now.

@NoArgsConstructor
@AllArgsConstructor
public class DataResponse<T> {
@JsonInclude()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking up @JsonInclude, I see that it defaults to JsonInclude.Include.ALWAYS. For me personally seeing JsonInclude.Include.ALWAYS would make it more clear but IntelliJ doesn't like that and says it's redundant. Didn't know if anyone else had any thoughts on this? I'm ok with it either way just didn't know if we had a preferred style we should follow.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see a problem with leaving it as @JsonInclude

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was using JsonInclude.Include.ALWAYS at first in the other models, but I think I lean toward not including it now. Just having the @JsonInclude seems explicit enough to me. But, thats a good point on consistency, because some of our models will still have the JsonInclude.Include.ALWAYS so we should update those at some point.

@ctucker3
Copy link
Contributor Author

ctucker3 commented Jul 6, 2020

Copy link
Contributor

@dmeidlin dmeidlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GET /programs endpoint returns an empty array as expected. I'm unable to run the tests using bi-docker-stack. From our offline discussions it seems like a bind mount to the docker daemon socket needs to be added to the bi-docker-stack docker-compose.yml under the dev-biapi service, and the installation of the docker daemon (or maybe just docker-cli) needs to be added to the biapi Dockerfile.

@ctucker3 ctucker3 merged commit 7829bb7 into develop Jul 10, 2020
@ctucker3 ctucker3 deleted the bug/INF-138 branch July 10, 2020 17:24
@nickpalladino nickpalladino added the bug Something isn't working label Aug 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants