Skip to content

Commit

Permalink
chore: review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrevanveluw committed Oct 28, 2024
1 parent 6af3e26 commit fb6148b
Show file tree
Hide file tree
Showing 75 changed files with 148 additions and 672 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package community.flock.wirespec.example.gradle.app
package community.flock.wirespec.example.maven.custom.app

import community.flock.wirespec.example.gradle.app.todo.LiveTodoRepository
import community.flock.wirespec.example.gradle.app.todo.todoModule
import community.flock.wirespec.example.maven.custom.app.todo.LiveTodoRepository
import community.flock.wirespec.example.maven.custom.app.todo.todoModule
import io.ktor.serialization.kotlinx.json.json
import io.ktor.server.application.Application
import io.ktor.server.application.install
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.common
package community.flock.wirespec.example.maven.custom.app.common

interface Converter<DOMAIN : Any, DTO : Any> :
Internalizer<DTO, DOMAIN>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.common
package community.flock.wirespec.example.maven.custom.app.common

fun interface Consumer<DTO : Any, DOMAIN : Any> {
fun DTO.consume(): DOMAIN
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.common
package community.flock.wirespec.example.maven.custom.app.common

interface Value<T : Any> {
val value: T
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.common
package community.flock.wirespec.example.maven.custom.app.common

import community.flock.wirespec.kotlin.Wirespec
import io.ktor.client.HttpClient
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package community.flock.wirespec.example.gradle.app.exception
package community.flock.wirespec.example.maven.custom.app.exception

import community.flock.wirespec.example.gradle.app.todo.Todo
import community.flock.wirespec.example.maven.custom.app.todo.Todo

sealed class AppException(override val message: String) : RuntimeException(message)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.exception
package community.flock.wirespec.example.maven.custom.app.exception

import community.flock.wirespec.generated.kotlin.Error

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package community.flock.wirespec.example.gradle.app.todo
package community.flock.wirespec.example.maven.custom.app.todo

import community.flock.wirespec.example.gradle.app.exception.TodoNotFoundException
import community.flock.wirespec.example.maven.custom.app.exception.TodoNotFoundException

class LiveTodoRepository : TodoRepository {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package community.flock.wirespec.example.gradle.app.todo
package community.flock.wirespec.example.maven.custom.app.todo

import community.flock.wirespec.example.gradle.app.common.Value
import community.flock.wirespec.example.maven.custom.app.common.Value

data class Todo(
val id: Id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package community.flock.wirespec.example.gradle.app.todo
package community.flock.wirespec.example.maven.custom.app.todo

import community.flock.wirespec.example.gradle.app.todo.TodoConsumer.consume
import community.flock.wirespec.example.gradle.app.todo.TodoProducer.produce
import community.flock.wirespec.example.maven.custom.app.exception.TodoIdNotValidException
import community.flock.wirespec.example.maven.custom.app.todo.TodoConsumer.consume
import community.flock.wirespec.example.maven.custom.app.todo.TodoProducer.produce
import community.flock.wirespec.generated.kotlin.DeleteTodoByIdEndpoint
import community.flock.wirespec.generated.kotlin.GetTodoByIdEndpoint
import community.flock.wirespec.generated.kotlin.GetTodosEndpoint
Expand All @@ -27,7 +28,7 @@ class TodoHandler(liveTodoRepository: TodoRepository) : TodoApi {

override suspend fun getTodoById(request: GetTodoByIdEndpoint.Request): GetTodoByIdEndpoint.Response200 =
request.path.id
.also { if (!it.validate()) throw community.flock.wirespec.example.gradle.app.exception.TodoIdNotValidException(
.also { if (!it.validate()) throw TodoIdNotValidException(
it.value
)
}
Expand All @@ -46,7 +47,7 @@ class TodoHandler(liveTodoRepository: TodoRepository) : TodoApi {

override suspend fun deleteTodoById(request: DeleteTodoByIdEndpoint.Request): DeleteTodoByIdEndpoint.Response200 =
request.path.id
.also { if (!it.validate()) throw community.flock.wirespec.example.gradle.app.exception.TodoIdNotValidException(
.also { if (!it.validate()) throw TodoIdNotValidException(
it.value
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.todo
package community.flock.wirespec.example.maven.custom.app.todo

interface HasTodoRepository {
val todoRepository: TodoRepository
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package community.flock.wirespec.example.gradle.app.todo
package community.flock.wirespec.example.maven.custom.app.todo

import community.flock.wirespec.example.gradle.app.common.Serialization
import community.flock.wirespec.example.maven.custom.app.common.Serialization
import community.flock.wirespec.generated.kotlin.DeleteTodoByIdEndpoint
import community.flock.wirespec.generated.kotlin.GetTodoByIdEndpoint
import community.flock.wirespec.generated.kotlin.GetTodosEndpoint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.todo
package community.flock.wirespec.example.maven.custom.app.todo

interface TodoService : HasTodoRepository

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package community.flock.wirespec.example.gradle.app.todo
package community.flock.wirespec.example.maven.custom.app.todo

import community.flock.wirespec.example.gradle.app.common.Consumer
import community.flock.wirespec.example.gradle.app.common.Producer
import community.flock.wirespec.example.maven.custom.app.common.Consumer
import community.flock.wirespec.example.maven.custom.app.common.Producer
import community.flock.wirespec.generated.kotlin.PotentialTodoDto
import community.flock.wirespec.generated.kotlin.TodoDto
import community.flock.wirespec.generated.kotlin.TodoId
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package community.flock.wirespec.example.gradle.app.user
package community.flock.wirespec.example.maven.custom.app.user

import community.flock.wirespec.example.gradle.app.user.UserConverter.internalize
import community.flock.wirespec.example.maven.custom.app.user.UserConverter.internalize
import community.flock.wirespec.generated.kotlin.DeleteUserByNameEndpoint
import community.flock.wirespec.generated.kotlin.GetUserByNameEndpoint
import community.flock.wirespec.generated.kotlin.GetUsersEndpoint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package community.flock.wirespec.example.gradle.app.user
package community.flock.wirespec.example.maven.custom.app.user

import community.flock.wirespec.example.gradle.app.common.Serialization
import community.flock.wirespec.example.gradle.app.common.WirespecClient
import community.flock.wirespec.example.maven.custom.app.common.Serialization
import community.flock.wirespec.example.maven.custom.app.common.WirespecClient
import community.flock.wirespec.generated.kotlin.DeleteUserByNameEndpoint
import community.flock.wirespec.generated.kotlin.GetUserByNameEndpoint
import community.flock.wirespec.generated.kotlin.GetUsersEndpoint
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package community.flock.wirespec.example.maven.custom.app.user

data class User(val name: String)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.user
package community.flock.wirespec.example.maven.custom.app.user

interface HasUserAdapter {
val userAdapter: UserAdapter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package community.flock.wirespec.example.gradle.app.user
package community.flock.wirespec.example.maven.custom.app.user

import community.flock.wirespec.example.gradle.app.common.Converter
import community.flock.wirespec.example.maven.custom.app.common.Converter
import community.flock.wirespec.generated.kotlin.UserDto

object UserConverter : Converter<User, UserDto> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.user
package community.flock.wirespec.example.maven.custom.app.user

interface UserService : HasUserAdapter

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package community.flock.wirespec.example.gradle.app
package community.flock.wirespec.example.maven.custom.app

import community.flock.wirespec.example.gradle.app.todo.LiveTodoRepository
import community.flock.wirespec.example.gradle.app.todo.todoModule
import community.flock.wirespec.example.maven.custom.app.todo.LiveTodoRepository
import community.flock.wirespec.example.maven.custom.app.todo.todoModule
import io.ktor.client.request.get
import io.ktor.client.statement.bodyAsText
import io.ktor.http.HttpStatusCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package community.flock.wirespec.example.gradle.app.todo
package community.flock.wirespec.example.maven.custom.app.todo

import org.junit.Test
import kotlin.test.assertTrue

interface TestContext {
val todoService: TodoService
val todoService: _root_ide_package_.community.flock.wirespec.example.maven.custom.app.todo.TodoService
}

class TodoTest {
Expand All @@ -16,7 +16,7 @@ class TodoTest {

private fun testContext(test: TestContext.() -> Unit) = object : TestContext {
override val todoService = object :
TodoService {
_root_ide_package_.community.flock.wirespec.example.maven.custom.app.todo.TodoService {
override val todoRepository = LiveTodoRepository()
}
}.test()
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.user
package community.flock.wirespec.example.maven.custom.app.user

import community.flock.wirespec.generated.kotlin.DeleteUserByNameEndpoint
import community.flock.wirespec.generated.kotlin.GetUserByNameEndpoint
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.user
package community.flock.wirespec.example.maven.custom.app.user

import org.junit.Test
import kotlin.test.assertEquals
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app;
package community.flock.wirespec.example.maven.custom.app;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.common;
package community.flock.wirespec.example.maven.custom.app.common;

public interface Converter<I, E> extends Internalizer<E, I>, Externalizer<I, E> {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.common;
package community.flock.wirespec.example.maven.custom.app.common;

public interface Externalizer<I, E> {
E externalize(I domain);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.common;
package community.flock.wirespec.example.maven.custom.app.common;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package community.flock.wirespec.example.gradle.app.common;
package community.flock.wirespec.example.maven.custom.app.common;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import community.flock.wirespec.example.gradle.app.exception.SerializationException;
import community.flock.wirespec.example.maven.custom.app.exception.SerializationException;
import community.flock.wirespec.java.Wirespec;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.common;
package community.flock.wirespec.example.maven.custom.app.common;

import community.flock.wirespec.java.Wirespec.RawRequest;
import community.flock.wirespec.java.Wirespec.RawResponse;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.config;
package community.flock.wirespec.example.maven.custom.app.config;

import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.exception;
package community.flock.wirespec.example.maven.custom.app.exception;

public sealed class AppException extends RuntimeException permits Conflict, NotFound, CallInterrupted, SerializationException {
public AppException(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.exception;
package community.flock.wirespec.example.maven.custom.app.exception;

public final class CallInterrupted extends AppException {
public CallInterrupted(Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.exception;
package community.flock.wirespec.example.maven.custom.app.exception;

public sealed class Conflict extends AppException {
public Conflict(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.exception;
package community.flock.wirespec.example.maven.custom.app.exception;

public sealed class NotFound extends AppException {
public NotFound(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.exception;
package community.flock.wirespec.example.maven.custom.app.exception;

public final class SerializationException extends AppException {
public SerializationException(Exception cause) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.todo;
package community.flock.wirespec.example.maven.custom.app.todo;

import community.flock.wirespec.generated.java.Todo;
import community.flock.wirespec.generated.java.TodoId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package community.flock.wirespec.example.gradle.app.todo;
package community.flock.wirespec.example.maven.custom.app.todo;

import community.flock.wirespec.example.gradle.app.exception.NotFound;
import community.flock.wirespec.example.maven.custom.app.exception.NotFound;
import community.flock.wirespec.generated.java.Error;
import community.flock.wirespec.generated.java.Todo;
import community.flock.wirespec.generated.java.TodoId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.todo;
package community.flock.wirespec.example.maven.custom.app.todo;

import community.flock.wirespec.generated.java.Todo;
import community.flock.wirespec.generated.java.TodoId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.todo;
package community.flock.wirespec.example.maven.custom.app.todo;

import community.flock.wirespec.generated.java.Todo;
import community.flock.wirespec.generated.java.TodoId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package community.flock.wirespec.example.gradle.app.user;
package community.flock.wirespec.example.maven.custom.app.user;

import community.flock.wirespec.example.gradle.app.exception.CallInterrupted;
import community.flock.wirespec.example.gradle.app.exception.Conflict;
import community.flock.wirespec.example.gradle.app.exception.NotFound;
import community.flock.wirespec.example.maven.custom.app.exception.CallInterrupted;
import community.flock.wirespec.example.maven.custom.app.exception.Conflict;
import community.flock.wirespec.example.maven.custom.app.exception.NotFound;
import community.flock.wirespec.generated.java.DeleteUserByNameEndpoint;
import community.flock.wirespec.generated.java.GetUserByNameEndpoint;
import community.flock.wirespec.generated.java.GetUsersEndpoint;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package community.flock.wirespec.example.gradle.app.user;
package community.flock.wirespec.example.maven.custom.app.user;

import community.flock.wirespec.example.gradle.app.common.WirespecSerializer;
import community.flock.wirespec.example.gradle.app.common.WirespecTransporter;
import community.flock.wirespec.example.maven.custom.app.common.WirespecSerializer;
import community.flock.wirespec.example.maven.custom.app.common.WirespecTransporter;
import community.flock.wirespec.generated.java.DeleteUserByNameEndpoint;
import community.flock.wirespec.generated.java.GetUserByNameEndpoint;
import community.flock.wirespec.generated.java.GetUsersEndpoint;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package community.flock.wirespec.example.maven.custom.app.user;

public record User(String name) {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.user;
package community.flock.wirespec.example.maven.custom.app.user;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.user;
package community.flock.wirespec.example.maven.custom.app.user;

import community.flock.wirespec.generated.java.DeleteUserByNameEndpoint;
import community.flock.wirespec.generated.java.GetUserByNameEndpoint;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.user;
package community.flock.wirespec.example.maven.custom.app.user;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package community.flock.wirespec.example.gradle.app.user;
package community.flock.wirespec.example.maven.custom.app.user;

import community.flock.wirespec.example.gradle.app.common.Converter;
import community.flock.wirespec.example.maven.custom.app.common.Converter;
import community.flock.wirespec.generated.java.UserDto;
import org.springframework.stereotype.Component;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package community.flock.wirespec.example.gradle.app.todo;
package community.flock.wirespec.example.maven.custom.app.todo;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Loading

0 comments on commit fb6148b

Please sign in to comment.