Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakewharton/jax-rs-kotlinx-serialization
A JAX-RS message body reader/writer and parameter converter which uses Kotlinx Serialization
https://github.com/jakewharton/jax-rs-kotlinx-serialization
Last synced: 11 days ago
JSON representation
A JAX-RS message body reader/writer and parameter converter which uses Kotlinx Serialization
- Host: GitHub
- URL: https://github.com/jakewharton/jax-rs-kotlinx-serialization
- Owner: JakeWharton
- License: apache-2.0
- Created: 2019-02-25T21:43:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-20T15:17:56.000Z (about 4 years ago)
- Last Synced: 2024-10-14T12:24:55.318Z (25 days ago)
- Language: Kotlin
- Size: 75.2 KB
- Stars: 70
- Watchers: 6
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
JAX-RS Kotlinx Serialization
============================A message body reader/writer and parameter converter which uses kotlinx-serialization.
Usage
-----```kotlin
val resourceConfig = new ResourceConfig();resourceConfig.register(Json.asMessageBodyReader(APPLICATION_JSON_TYPE));
resourceConfig.register(Json.asMessageBodyWriter(APPLICATION_JSON_TYPE));
```_(This example uses Jersey, but any JAX-RS-compatible implementation will work.)_
By specifying `application/json` as the `MediaType`, its usage will match the reader and/or writer
for your `@Serializable` models.```kotlin
@POST @Path("register")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
fun register(registerRequest: RegisterRequest): RegisterResponse {
// ...
}
```Download
--------Gradle:
```groovy
implementation 'com.jakewharton:jax-rs-kotlinx-serialization:0.2.1'
```
or Maven:
```xmlcom.jakewharton
jax-rs-kotlinx-serialization
0.2.1```
Snapshot versions are available in the Sonatype 'snapshots' repository: https://oss.sonatype.org/content/repositories/snapshots/
License
-------Copyright 2019 Jake Wharton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.