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

refactor: Reduce coupling with Type #119

Merged
merged 1 commit into from
Dec 20, 2024
Merged

Conversation

stuebingerb
Copy link
Owner

@stuebingerb stuebingerb commented Dec 3, 2024

The current implementation is heavily coupled to Type which itself is heavily coupled to actual Kotlin classes. This tries to move away from Type when it is not needed to simplify working with non-Kotlin schemas (like schemas created from SDL or introspection queries).

@stuebingerb stuebingerb changed the base branch from main to docs/cleanup-documentation December 3, 2024 13:12
@stuebingerb stuebingerb force-pushed the refactor/reduce-type-coupling branch 8 times, most recently from bfb62a1 to 2406400 Compare December 4, 2024 12:46
@stuebingerb stuebingerb force-pushed the docs/cleanup-documentation branch 2 times, most recently from 3f8c00e to 78c6815 Compare December 5, 2024 11:23
Base automatically changed from docs/cleanup-documentation to main December 5, 2024 11:25
@stuebingerb stuebingerb force-pushed the refactor/reduce-type-coupling branch 2 times, most recently from ff596cf to c1fbe34 Compare December 6, 2024 10:54
@stuebingerb stuebingerb force-pushed the refactor/reduce-type-coupling branch 3 times, most recently from ca6f6b4 to 36172d7 Compare December 16, 2024 15:58
@stuebingerb stuebingerb changed the base branch from main to refactor/cleanup-schema-proxy December 16, 2024 15:58
@stuebingerb stuebingerb force-pushed the refactor/cleanup-schema-proxy branch from 6f67c79 to a039cad Compare December 16, 2024 16:50
@stuebingerb stuebingerb force-pushed the refactor/reduce-type-coupling branch from 36172d7 to 92bdfd4 Compare December 16, 2024 16:54
@stuebingerb stuebingerb force-pushed the refactor/cleanup-schema-proxy branch from a039cad to 3b4af49 Compare December 17, 2024 12:39
Base automatically changed from refactor/cleanup-schema-proxy to main December 17, 2024 13:10
@stuebingerb stuebingerb force-pushed the refactor/reduce-type-coupling branch 2 times, most recently from 85b354e to 9625454 Compare December 17, 2024 14:25
The current implementation is heavily coupled to `Type` which itself
is heavily coupled to actual Kotlin classes. This tries to move away
from `Type` when it is not needed to simplify working with non-Kotlin
schemas (like schemas created from SDL or introspection queries).
@stuebingerb stuebingerb force-pushed the refactor/reduce-type-coupling branch from 9625454 to b46b0c3 Compare December 18, 2024 16:00
@stuebingerb stuebingerb changed the title Refactor/reduce type coupling refactor: Reduce coupling with Type Dec 18, 2024
@stuebingerb stuebingerb marked this pull request as ready for review December 18, 2024 16:01
fun isList(): Boolean = when {
kind == TypeKind.LIST -> true
ofType == null -> false
else -> (ofType as __Type).isList()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would (ofType as? __Type)?.isList() ?: false also work here without the second when case plus it would be a safe cast?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Would work, yes. The current cast should also be safe, though, shouldn't it? I'll have a look in my next PR.

@stuebingerb stuebingerb merged commit 1b68d58 into main Dec 20, 2024
4 checks passed
@stuebingerb stuebingerb deleted the refactor/reduce-type-coupling branch December 20, 2024 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants