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

move core to be mpp #20

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft

move core to be mpp #20

wants to merge 42 commits into from

Conversation

i-walker
Copy link
Member

@i-walker i-walker commented Oct 24, 2021

Status:
temporarily on hold

A fix for https://app.clickup.com/t/kt7qd2 has been addressed here, but we can improve it more in further iterations, adding validation steps before parsing the Uri

TODO:

  • implement js plattform specifc parts [IN PROGRESS: 97 % passed tests]
  • implement native platform specific parts

# Conflicts:
#	build.gradle.kts
#	core/build.gradle.kts
� Conflicts:
�	core/build.gradle.kts
�	core/src/commonMain/kotlin/arrow/endpoint/ArrowEndpoint.kt
�	core/src/commonMain/kotlin/arrow/endpoint/Endpoint.kt
�	core/src/commonMain/kotlin/arrow/endpoint/EndpointIO.kt
�	core/src/commonMain/kotlin/arrow/endpoint/EndpointInput.kt
�	core/src/commonMain/kotlin/arrow/endpoint/EndpointInterceptor.kt
�	core/src/commonMain/kotlin/arrow/endpoint/EndpointOutput.kt
�	core/src/commonMain/kotlin/arrow/endpoint/EndpointTransput.kt
�	core/src/commonMain/kotlin/arrow/endpoint/FieldName.kt
�	core/src/commonMain/kotlin/arrow/endpoint/Mapping.kt
�	core/src/commonMain/kotlin/arrow/endpoint/MethodSyntax.kt
�	core/src/commonMain/kotlin/arrow/endpoint/Params.kt
�	core/src/commonMain/kotlin/arrow/endpoint/client/RequestInfo.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/CodecFormat.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/Cookie.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/Header.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/MediaType.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/Method.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/QueryParams.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/Rfc2616.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/Rfc3986.kt
�	core/src/commonMain/kotlin/arrow/endpoint/model/StatusCode.kt
�	core/src/commonMain/kotlin/arrow/endpoint/server/ServerEndpoint.kt
�	core/src/commonMain/kotlin/arrow/endpoint/server/interpreter/DecodeBasicInputsResult.kt
�	core/src/commonMain/kotlin/arrow/endpoint/server/interpreter/InputValueResult.kt
�	core/src/commonMain/kotlin/arrow/endpoint/server/interpreter/OutputValues.kt
�	core/src/commonMain/kotlin/arrow/endpoint/server/interpreter/RequestBody.kt
�	core/src/commonMain/kotlin/arrow/endpoint/server/interpreter/ServerInterpreter.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/ArrowEndpoint.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/Endpoint.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/EndpointIO.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/EndpointInput.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/EndpointInterceptor.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/EndpointOutput.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/EndpointTransput.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/FieldName.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/Mapping.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/MethodSyntax.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/Params.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/client/RequestInfo.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/CodecFormat.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/Cookie.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/Header.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/MediaType.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/Method.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/QueryParams.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/Rfc2616.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/Rfc3986.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/model/StatusCode.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/server/ServerEndpoint.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/server/interpreter/DecodeBasicInputsResult.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/server/interpreter/InputValueResult.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/server/interpreter/OutputValues.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/server/interpreter/RequestBody.kt
�	core/src/jvmMain/kotlin/arrow/endpoint/server/interpreter/ServerInterpreter.kt
�	core/src/main/kotlin/arrow/endpoint/ArrowEndpoint.kt
�	core/src/main/kotlin/arrow/endpoint/Endpoint.kt
�	core/src/main/kotlin/arrow/endpoint/EndpointIO.kt
�	core/src/main/kotlin/arrow/endpoint/EndpointInput.kt
�	core/src/main/kotlin/arrow/endpoint/EndpointInterceptor.kt
�	core/src/main/kotlin/arrow/endpoint/EndpointOutput.kt
�	core/src/main/kotlin/arrow/endpoint/EndpointTransput.kt
�	core/src/main/kotlin/arrow/endpoint/FieldName.kt
�	core/src/main/kotlin/arrow/endpoint/Mapping.kt
�	core/src/main/kotlin/arrow/endpoint/MethodSyntax.kt
�	core/src/main/kotlin/arrow/endpoint/Params.kt
�	core/src/main/kotlin/arrow/endpoint/client/RequestInfo.kt
�	core/src/main/kotlin/arrow/endpoint/model/CodecFormat.kt
�	core/src/main/kotlin/arrow/endpoint/model/Cookie.kt
�	core/src/main/kotlin/arrow/endpoint/model/Header.kt
�	core/src/main/kotlin/arrow/endpoint/model/MediaType.kt
�	core/src/main/kotlin/arrow/endpoint/model/Method.kt
�	core/src/main/kotlin/arrow/endpoint/model/QueryParams.kt
�	core/src/main/kotlin/arrow/endpoint/model/Rfc2616.kt
�	core/src/main/kotlin/arrow/endpoint/model/Rfc3986.kt
�	core/src/main/kotlin/arrow/endpoint/model/StatusCode.kt
�	core/src/main/kotlin/arrow/endpoint/server/ServerEndpoint.kt
�	core/src/main/kotlin/arrow/endpoint/server/interpreter/DecodeBasicInputsResult.kt
�	core/src/main/kotlin/arrow/endpoint/server/interpreter/InputValueResult.kt
�	core/src/main/kotlin/arrow/endpoint/server/interpreter/OutputValues.kt
�	core/src/main/kotlin/arrow/endpoint/server/interpreter/RequestBody.kt
�	core/src/main/kotlin/arrow/endpoint/server/interpreter/ServerInterpreter.kt
# Conflicts:
#	build.gradle.kts
#	core/src/commonMain/kotlin/arrow/endpoint/model/Rfc3986.kt
#	core/src/commonMain/kotlin/arrow/endpoint/model/Uri.kt
#	core/src/commonMain/kotlin/arrow/endpoint/model/UriCompatibility.kt
#	core/src/jvmMain/kotlin/arrow/endpoint/model/Uri.kt
# Conflicts:
#	core/build.gradle.kts
# Conflicts:
#	build.gradle.kts
#	core/build.gradle.kts
# Conflicts:
#	core/src/commonMain/kotlin/arrow/endpoint/model/Uri.kt
#	core/src/jvmMain/kotlin/arrow/endpoint/model/UriUtils.kt
# Conflicts:
#	build.gradle.kts
#	clients/ktor-client/src/main/kotlin/arrow/endpoint/ktor/client/KtorClientInterpreter.kt
#	core/build.gradle.kts
#	core/src/commonMain/kotlin/arrow/endpoint/ArrowEndpoint.kt
#	core/src/commonMain/kotlin/arrow/endpoint/model/Method.kt
#	core/src/commonMain/kotlin/arrow/endpoint/model/QueryParams.kt
#	core/src/commonMain/kotlin/arrow/endpoint/model/RequestMetadata.kt
#	core/src/commonMain/kotlin/arrow/endpoint/model/Rfc3986.kt
#	core/src/commonMain/kotlin/arrow/endpoint/model/Uri.kt
#	core/src/commonMain/kotlin/arrow/endpoint/predef.kt
#	core/src/jvmMain/kotlin/arrow/endpoint/CodecUtils.kt
#	core/src/jvmMain/kotlin/arrow/endpoint/SchemaUtils.kt
#	core/src/jvmMain/kotlin/arrow/endpoint/model/UriUtils.kt
#	servers/ktor-server/src/main/kotlin/arrow/endpoint/ktor/server/KtorHttpServerInterpreter.kt
Copy link
Member

@nomisRev nomisRev left a comment

Choose a reason for hiding this comment

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

Making good progress. Nice!

build.gradle.kts Outdated Show resolved Hide resolved
core/build.gradle.kts Outdated Show resolved Hide resolved
core/src/jsMain/kotlin/arrow/endpoint/predef.kt Outdated Show resolved Hide resolved
import java.util.Date

public val Codec.Companion.uuid: Codec<String, UUID, CodecFormat.TextPlain>
get() = stringCodec(Schema.uuid, UUID::fromString)
Copy link
Member

Choose a reason for hiding this comment

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

Cannot be = without get(), right? Can we cache the instances?

Copy link
Member Author

Choose a reason for hiding this comment

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

Screenshot 2022-01-24 at 17 13 43

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't looked into Caching, yet ☺️

@i-walker
Copy link
Member Author

Don't fear the 2k changes, most of it is just the yarn file for KotlinJS

@nomisRev
Copy link
Member

Thanks for taking this on @i-walker 💪

Comment on lines 217 to 218
parseToUri("http://abcd").fold(
{ fail("this should work") },
Copy link
Member

Choose a reason for hiding this comment

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

This can all become shoudBeRight(), no?

Copy link
Member Author

@i-walker i-walker Jan 28, 2022

Choose a reason for hiding this comment

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

Correct, there are also other places where this fix applies, but I am focusing on getting the other platform tests to compile first.

@i-walker
Copy link
Member Author

i-walker commented Jan 28, 2022

small Update:
I am reverting from the approach to have platform-specific encoders/ decoders for the Uri and Query Segments, instead going to write those algorithms in kotlin. I found some inconsistencies between libraries between native, js, and jvm. Ktor solves this similarly

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