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

[ktor plugin] refactor route configuration #1688

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

dariuszkuc
Copy link
Collaborator

📝 Description

It appears that it is currently not possible to easily access the previously configured routes. This means that it is not possible to intercept our auto-configured routes to add some additional configuration (e.g. Authentication). This PR refactors the plugin to extract all routes into a separate extension functions that can be invoked by the users.

New plugin configuration will consist of 2 steps - (1) configuring server and (2) configuring routes.

fun Application.myGraphQLModule() {
    install(GraphQL) {
        // all schema, engine and server configuration go here
    }
    install(Routing) {
        // configure routes
        graphQLGetRoute()
        graphQLPostRoute()
        graphQLSDLRoute()
        graphiQLRoute()
    }
}

This refactor follows the same pattern as Authentication plugin.

🔗 Related Issues

Resolves: #1676

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
It appears that it is currently not possible to easily access the previously configured routes. This means that it is not possible to intercept our auto-configured routes to add some additional configuration (e.g. `Authentication`). This PR refactors the plugin to extract all routes into a separate extension functions that can be invoked by the users.

New plugin configuration will consist of 2 steps - (1) configuring server and (2) configuring routes.

```kotlin
fun Application.myGraphQLModule() {
    install(GraphQL) {
        // all schema, engine and server configuration go here
    }
    install(Routing) {
        // configure routes
        graphQLGetRoute()
        graphQLPostRoute()
        graphQLSDLRoute()
        graphiQLRoute()
    }
}
```

This refactor follows the same pattern as `Authentication` plugin.

Resolves: ExpediaGroup#1676
@dariuszkuc dariuszkuc added the changes: major Changes require a major version label Feb 26, 2023
}
limit {
counter = "BRANCH"
value = "COVEREDRATIO"
minimum = "0.45".toBigDecimal()
minimum = "0.35".toBigDecimal()
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

drop in coverages is mostly due to the getters/setters of the config unsure if it is worth to write specific tests for those....

@dariuszkuc dariuszkuc merged commit 53b6522 into ExpediaGroup:master Feb 28, 2023
@dariuszkuc dariuszkuc deleted the ktor_plugin branch February 28, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changes: major Changes require a major version
Development

Successfully merging this pull request may close these issues.

[ktor server] support Authentication plugin
2 participants