Is there a recommended library for building GraphQL queries? [closed] - spring

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm calling a service that exposes a GraphQL interface. So I'm able to post a GraphQL query and receive data back via curl. Now I want to write a service that builds the query for me (dynamically, based on query parameters I send my endpoint) and sends the request and gets the response back.
I'm using Spring Boot 2.1.4.
I know you can build queries with the elastic search library in Spring. Wondering if there's something similar for GraphQL.

There's a few clients, taking rather different approaches.
SmallRye GraphQL - Offers both a dynamic and a typesafe client
Netflix DGS client - Has both a simple and a type-safe client
Apollo Kotlin - Generates Kotlin and Java models from GraphQL queries.
There's a Node based Java client generator and a Maven plugin for it too.
Nodes
Shopify's GraphQL code gen - Needs (J)Ruby to run but generates Java code.
Manifold can be used as a GraphQL client
These are all different beasts, as you'll see, so you'll have to decide what fits.

Related

How to use a contract first approach with GraphQL and Quarkus? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 hours ago.
This post was edited and submitted for review 9 hours ago.
Improve this question
For REST API I’m using openapi-generator-maven-plugin to generate java interfaces with jax-rs annotations by an Open API contract and after that, I implement interfaces and run an application at Quarkus with quarkus-resteasy-reactive extension.
Now I want to build GraphQL API at Quarkus using the same approach (generate server code by GraphQL contract). How can I do it with Quarkus with smallrya GraphQL extension (or may be something different)?
Quarkus implements the MicroProfile GraphQL specification, and that is focused on code-first approach only. For server-side GraphQL development, unfortunately there is currently no tooling for the contract-first approach. Should you be interested in client-side development, there are a few tools... (an experimental generator for typesafe client stubs, and an IntelliJ plugin providing autocompletion of typesafe client interfaces)

Unit test cases in Spring boot. Service methods or Http Urls [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 months ago.
Improve this question
I am doing a web project rest api in Spring boot and need to write unit test cases. I am confused about to write test cases for http urls using http client, or test cases for #service methods ?
Usually unit tests cover public methods from #Service annotated class (and other components).
Testing with HTTP client is more like writing integration tests, which cover connection between different systems - just like in the case of HTTP API, that is called either by your different service or by other component independent from your system.
PS: Welcome on StackOverflow, I hope that you will find your answers. :)

What are the best use cases scenario to use Spring Integration and Spring Batch? How they work together? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I am using Spring Batch to process CSV files as a batch process and SFTP adapters (Spring Integration) to download and upload files. Found Spring Documentation very helpful. But I am a little bit confused and curious about their best use cases.
So far my understanding, a monolith application can be broken down and integrated with another external system (FTP, email, queue, etc) using Spring Integration. What are the other use cases? Should I use Spring Batch with Spring Integration? What are the best practices?
Can anybody help?
There are no "best" use cases, it depends on the context. There is a whole chapter about how to use Spring Batch and Spring Integration together here: https://docs.spring.io/spring-batch/docs/4.2.x/reference/html/spring-batch-integration.html#springBatchIntegration.
I will let you decide when it is best to use them together depending on your requirement.

Which is the best way to do end to end testing of Spring Boot Rest APIs? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I have checked in google and stackoverflow for end to end testing of Spring Boot Rest APIs.
I would like to test controller -> Service -> Repository at once.
I found two approaches are efficient:
1. TestRestTemplate:
Single call to the controller method with in-memory database configuration for repository.
2. MockMvc:
Create 2 Test classes.
one for Controller->Service
and one for Service->Repository.
Is there any way to club both 2 classes into one class.
which is the best way to do "end to end testing" of Spring Boot Rest APIs from above 2 approaches ???
I would say the better way to do the END2END testing is to use TestRestTemplate. It would actually start-up the server at a random port (it you configured) and call the api itself for testing.In this way, it mimic the actual behavior of the running server and use the default configures and beans.
MockMvc, in my testing experience, is mainly for testing the web layer, aka controllers. I would use mocked Service beans to replace the original ones. So I can test the behaviors of the controller layer itself without having to worry about the bugs in the service layer. More importantly, I don't have to set up any Database before testing.
So I would say, for E2E test, you can go for the first approach.

Arquitecthure of the project [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I want to create a software about sports and nutrition and I am trying to create a multi-module project with multiples environments.
First , I would like to create six modules ,nutrition , sports , healthy , this modules has a backend and frontend that they consume a restful webservice.
So , the structure of the project I am thinking is the following (This modules will be more subdmodules)
-back-sports
-back-nutrition
-back-health
-front-sports
-front-nutrition
-front-health
-authentication
-authorization
-rest-api
I am not sure how to consume the rest api , but I am sure that I will be use JavaScript(This is the next step to think)
The part of the rest api will be : Jersey , Spring/POJO , JPA/Hibernate.
Database : MySQL
What is better ? Separte the module rest-api in another project or not.
Regards !
You can have rest-api as separate module, you just "inject" services from bussines modules, so rest api module will just expose those services to the rest transport layer.
Btw if you use spring boot you have security already in.

Resources