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

Validate interoperability with Kotlin's inline classes. #822

Closed
michael-simons opened this issue Aug 21, 2020 · 1 comment
Closed

Validate interoperability with Kotlin's inline classes. #822

michael-simons opened this issue Aug 21, 2020 · 1 comment

Comments

@michael-simons
Copy link
Collaborator

michael-simons commented Aug 21, 2020

See https://jira.spring.io/browse/DATAGRAPH-1330, paging @corneil

@michael-simons
Copy link
Collaborator Author

Inline classes won't work without a bit of massaging the parameter mapper during querying, reasons for that being: FasterXML/jackson-module-kotlin#199

michael-simons added a commit that referenced this issue Aug 21, 2020
Kotlin provides so called „Inline classes“ (https://kotlinlang.org/docs/reference/inline-classes.html), wrapping standard types into a dedicated type. This makes them a nice fit for IDs etc.

The object mapping process works ootb, the parameter mapping needs some extra work: One has to provide custom serializers for all data classes being used (see `IdTypes`). Those serializers can be registered with a dedicated `SimpleModule`. This module needs to be added to the `ObjectMapper` instance used by OGM to convert parameters:

```
ObjectMapperFactory.objectMapper()
        .registerModule(KotlinModule())
        .registerModule(IdTypesModule())
```

The kotlin jackson module may detect them at some point in the future itself (See FasterXML/jackson-module-kotlin#199), but until than that work is necessary.

This closes #822.
michael-simons added a commit that referenced this issue Aug 21, 2020
Kotlin provides so called „Inline classes“ (https://kotlinlang.org/docs/reference/inline-classes.html), wrapping standard types into a dedicated type. This makes them a nice fit for IDs etc.

The object mapping process works ootb, the parameter mapping needs some extra work: One has to provide custom serializers for all data classes being used (see `IdTypes`). Those serializers can be registered with a dedicated `SimpleModule`. This module needs to be added to the `ObjectMapper` instance used by OGM to convert parameters:

```
ObjectMapperFactory.objectMapper()
        .registerModule(KotlinModule())
        .registerModule(IdTypesModule())
```

The kotlin jackson module may detect them at some point in the future itself (See FasterXML/jackson-module-kotlin#199), but until than that work is necessary.

This closes #822.
michael-simons added a commit that referenced this issue Aug 24, 2020
Kotlin provides so called „Inline classes“ (https://kotlinlang.org/docs/reference/inline-classes.html), wrapping standard types into a dedicated type. This makes them a nice fit for IDs etc.

The object mapping process works ootb, the parameter mapping needs some extra work: One has to provide custom serializers for all data classes being used (see `IdTypes`). Those serializers can be registered with a dedicated `SimpleModule`. This module needs to be added to the `ObjectMapper` instance used by OGM to convert parameters:

```
ObjectMapperFactory.objectMapper()
        .registerModule(KotlinModule())
        .registerModule(IdTypesModule())
```

The kotlin jackson module may detect them at some point in the future itself (See FasterXML/jackson-module-kotlin#199), but until than that work is necessary.

This closes #822.
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

No branches or pull requests

1 participant