Skip to content
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

Libraries versions actualization. #572

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ In this case, to fix the issues, we need to:

- Add one empty line before `package` in line 16
- Add the Javadoc for the constructor in line 27
- Add an space after `if` in line 34
- Add a space after `if` in line 34

The plugin also adds a new tab in the bottom of the IDE to run Checkstyle and show errors and warnings. We recommend that you run the report and fix all issues before submitting a pull request.
4 changes: 2 additions & 2 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ NOTE: If you are unsure about something and the issue is more of a question a be

- [ ] Steps to reproduce provided
- [ ] Stacktrace (if present) provided
- [ ] Example that reproduces the problem uploaded to Github
- [ ] Example that reproduces the problem uploaded to GitHub
- [ ] Full description of the issue provided (see below)

### Steps to Reproduce
Expand All @@ -32,5 +32,5 @@ Tell us what happens instead

### Example Application

- TODO: link to github repository with example that reproduces the issue
- TODO: link to GitHub repository with example that reproduces the issue

2 changes: 1 addition & 1 deletion MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ We have a [template repo](https://github.com/micronaut-projects/micronaut-projec
source of truth for certain files. It is used as a template to create new repos, and changes to certain files in the
template repo will get propagated automatically. The files propagated are:

* Workflow files (`.github/workflows/*`). They are copied using rsync"
* Workflow files (`.github/workflows/*`). They are copied using rsync
* `central-sync.yml`.
* `dependency-update.yml`.
* `graalvm.yml`.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Examples can be found in the [examples](https://github.com/micronaut-projects/mi

## Snapshots and Releases

Snaphots are automatically published to [Sonatype Snapshots](https://oss.sonatype.org/content/repositories/snapshots/) using [Github Actions](https://github.com/micronaut-projects/micronaut-graphql/actions).
Snapshots are automatically published to [Sonatype Snapshots](https://oss.sonatype.org/content/repositories/snapshots/) using [GitHub Actions](https://github.com/micronaut-projects/micronaut-graphql/actions).

See the documentation in the [Micronaut Docs](https://docs.micronaut.io/latest/guide/index.html#usingsnapshots) for how to configure your build to use snapshots.

Releases are published to Maven Central via [Github Actions](https://github.com/micronaut-projects/micronaut-graphql/actions).
Releases are published to Maven Central via [GitHub Actions](https://github.com/micronaut-projects/micronaut-graphql/actions).

Releases are completely automated. To perform a release use the following steps:

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repositories {
mavenCentral()
}

configurations.all {
configurations.configureEach {
resolutionStrategy {
preferProjectModules()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ micronaut {
testRuntime("junit5")
}

configurations.all {
configurations.configureEach {
resolutionStrategy {
preferProjectModules()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("io.micronaut.application")
id "io.micronaut.application"
}

micronaut {
Expand All @@ -8,7 +8,7 @@ micronaut {
testRuntime("junit5")
}

configurations.all {
configurations.configureEach {
resolutionStrategy {
preferProjectModules()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
plugins {
id 'io.micronaut.build.internal.graphql-base'
id('io.micronaut.minimal.application')
id 'io.micronaut.minimal.application'
}

micronaut {
version = libs.versions.micronaut.asProvider().get()
coreVersion.set(libs.versions.micronaut.asProvider().get())
runtime "netty"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "com.github.johnrengelman.shadow"
id("io.micronaut.application")
id "io.micronaut.application"
id 'io.micronaut.build.internal.graphql-base'
}

Expand All @@ -9,19 +9,24 @@ version project.projectVersion

dependencies {
compileOnly libs.graal.svm
implementation projects.micronautGraphql


implementation projects.micronautGraphql
implementation mn.micronaut.http.client
implementation mn.micronaut.jackson.databind
implementation mn.micronaut.runtime

runtimeOnly mnLogging.logback.classic
runtimeOnly mn.snakeyaml

testRuntimeOnly mn.snakeyaml
}

mainClassName = "example.Application"
application {
mainClass = "example.Application"
}

micronaut {
version.set(libs.versions.micronaut.platform.get())
coreVersion.set(libs.versions.micronaut.asProvider().get())
runtime("netty")
}
4 changes: 3 additions & 1 deletion docs-examples/hello-world-groovy/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ dependencies {
implementation(mnSerde.micronaut.serde.jackson)
}

mainClassName = "io.micronaut.graphql.docs.Application"
application {
mainClass = "io.micronaut.graphql.docs.Application"
}
4 changes: 3 additions & 1 deletion docs-examples/hello-world-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ micronaut {
coreVersion.set(libs.versions.micronaut.asProvider().get())
}

mainClassName = "io.micronaut.graphql.docs.Application"
application {
mainClass = "io.micronaut.graphql.docs.Application"
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
/**
* @author Marcel Overdijk
*/
@SuppressWarnings("Duplicates")
// tag::clazz[]
@Factory // <1>
public class GraphQLFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class HelloDataFetcher implements DataFetcher<String> {
@Override
public String get(DataFetchingEnvironment env) {
String name = env.getArgument("name");
if (name == null || name.trim().length() == 0) {
if (name == null || name.trim().isEmpty()) {
name = "World";
}
return String.format("Hello %s!", name);
Expand Down
4 changes: 3 additions & 1 deletion docs-examples/hello-world-kotlin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ dependencies {
implementation(mnSerde.micronaut.serde.jackson)
}

mainClassName = "io.micronaut.graphql.docs.ApplicationKt"
application {
mainClass = "io.micronaut.graphql.docs.ApplicationKt"
}

kotlin {
jvmToolchain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class GraphQLFactory {
val schemaGenerator = SchemaGenerator()

// Parse the schema.
val typeRegistry = TypeDefinitionRegistry();
val typeRegistry = TypeDefinitionRegistry()
typeRegistry.merge(schemaParser.parse(BufferedReader(InputStreamReader(
resourceResolver.getResourceAsStream("classpath:schema.graphqls").get()))))

Expand Down
4 changes: 0 additions & 4 deletions examples/chat/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ plugins {
id("micronaut-graphql.example-conventions")
}

micronaut {
version '4.5.1'
}

dependencies {
implementation libs.managed.graphql.java.extended.scalars
implementation mn.reactor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@Singleton
public class ChatDataFetcher implements DataFetcher<ChatMessage> {

private ChatRepository chatRepository;
private final ChatRepository chatRepository;

public ChatDataFetcher(ChatRepository chatRepository) {
this.chatRepository = chatRepository;
Expand All @@ -36,7 +36,7 @@ public ChatDataFetcher(ChatRepository chatRepository) {
@Override
public ChatMessage get(DataFetchingEnvironment env) {
String text = env.getArgument("text");
String from = env.getContext();
String from = env.getGraphQlContext().get("from");
return chatRepository.save(text, from);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import jakarta.inject.Singleton;
import org.reactivestreams.Publisher;

import java.util.Map;

@Singleton
@Primary
public class FromCustomizer implements GraphQLExecutionInputCustomizer {
Expand All @@ -33,8 +35,7 @@ public class FromCustomizer implements GraphQLExecutionInputCustomizer {
@Override
public Publisher<ExecutionInput> customize(ExecutionInput executionInput, HttpRequest httpRequest,
@Nullable MutableHttpResponse<String> httpResponse) {
return Publishers.just(executionInput.transform(
builder -> builder.context(httpRequest.getRemoteAddress().toString())
));
return Publishers.just(executionInput.transform(builder ->
builder.graphQLContext(Map.of("from", httpRequest.getRemoteAddress().toString()))));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
* @author Gerard Klijs
*/
@Factory
@SuppressWarnings("Duplicates")
public class GraphQLFactory {

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
@Singleton
public class MessagesDataFetcher implements DataFetcher<Iterable<ChatMessage>> {

private ChatRepository chatRepository;
private final ChatRepository chatRepository;

public MessagesDataFetcher(ChatRepository chatRepository) {
this.chatRepository = chatRepository;
Expand All @@ -39,8 +39,8 @@ public MessagesDataFetcher(ChatRepository chatRepository) {
@Override
public Iterable<ChatMessage> get(DataFetchingEnvironment env) {
return Optional
.ofNullable((OffsetDateTime) env.getArgument("after"))
.map(after -> chatRepository.findAfter(after.toZonedDateTime()))
.orElseGet(() -> chatRepository.findAll());
.ofNullable((OffsetDateTime) env.getArgument("after"))
.map(after -> chatRepository.findAfter(after.toZonedDateTime()))
.orElseGet(chatRepository::findAll);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@Singleton
public class StreamDataFetcher implements DataFetcher<Publisher<ChatMessage>> {

private ChatRepository chatRepository;
private final ChatRepository chatRepository;

public StreamDataFetcher(ChatRepository chatRepository) {
this.chatRepository = chatRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.function.Consumer;
import java.util.stream.Collectors;

/**
* @author Gerard Klijs
*/
@Singleton
public class ChatRepository {

private List<ChatMessage> chats = new ArrayList<>();
private BlockingQueue<ChatMessage> blockingQueue = new ArrayBlockingQueue<>(10);
private Flux<ChatMessage> stream = Flux.create((Consumer<FluxSink<ChatMessage>>) sink -> {
private final List<ChatMessage> chats = new ArrayList<>();
private final BlockingQueue<ChatMessage> blockingQueue = new ArrayBlockingQueue<>(10);
private final Flux<ChatMessage> stream = Flux.create((Consumer<FluxSink<ChatMessage>>) sink -> {
while (!sink.isCancelled()) {
try {
sink.next(blockingQueue.take());
Expand All @@ -54,12 +53,12 @@ public Iterable<ChatMessage> findAll() {

public Iterable<ChatMessage> findAfter(ZonedDateTime after) {
return chats.stream()
.filter(chat -> chat.getTime().isAfter(after))
.collect(Collectors.toList());
.filter(chat -> chat.getTime().isAfter(after))
.toList();
}

public ChatMessage save(String text, String from) {
ChatMessage chatMessage = new ChatMessage(text, from);
var chatMessage = new ChatMessage(text, from);
chats.add(chatMessage);
blockingQueue.add(chatMessage);
return chatMessage;
Expand Down
6 changes: 1 addition & 5 deletions examples/jwt-security/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ plugins {
id("micronaut-graphql.example-conventions")
}

micronaut {
version '4.5.1'
}

configurations.all {
configurations.configureEach {
resolutionStrategy {
preferProjectModules()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import io.micronaut.security.utils.SecurityService;
import jakarta.inject.Singleton;

import java.util.Optional;

/**
* @author Alexey Zhokhov
*/
Expand All @@ -43,10 +41,10 @@ public CurrentUserDataFetcher(SecurityService securityService,

@Nullable
@Override
public User get(DataFetchingEnvironment environment) throws Exception {
Optional<String> username = securityService.username();

return username.flatMap(userRepository::findByUsername).orElse(null);
public User get(DataFetchingEnvironment environment) {
return securityService.username()
.flatMap(userRepository::findByUsername)
.orElse(null);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public class GraphQLFactory {
public GraphQL graphQL(ResourceResolver resourceResolver,
CurrentUserDataFetcher currentUserDataFetcher,
LoginDataFetcher loginDataFetcher) {
SchemaParser schemaParser = new SchemaParser();
SchemaGenerator schemaGenerator = new SchemaGenerator();
var schemaParser = new SchemaParser();
var schemaGenerator = new SchemaGenerator();

// Parse the schema.
TypeDefinitionRegistry typeRegistry = new TypeDefinitionRegistry();
var typeRegistry = new TypeDefinitionRegistry();
typeRegistry.merge(schemaParser.parse(new BufferedReader(new InputStreamReader(
resourceResolver.getResourceAsStream("classpath:schema.graphqls").get()))));

Expand Down
Loading
Loading