https://github.com/scalalandio/linkuisitor
Plebeian-simple library for hateoas using circe.io
https://github.com/scalalandio/linkuisitor
circe hateoas scala
Last synced: 6 months ago
JSON representation
Plebeian-simple library for hateoas using circe.io
- Host: GitHub
- URL: https://github.com/scalalandio/linkuisitor
- Owner: scalalandio
- License: apache-2.0
- Created: 2017-05-05T03:57:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-10-30T15:31:41.000Z (almost 5 years ago)
- Last Synced: 2025-04-03T07:13:01.117Z (6 months ago)
- Topics: circe, hateoas, scala
- Language: Scala
- Size: 52.7 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Linkuisitor
[](https://travis-ci.org/scalalandio/linkuisitor)
[](http://search.maven.org/#search%7Cga%7C1%7Clinkuisitor)
[](http://www.apache.org/licenses/LICENSE-2.0.txt)Plebeian-simple library for generating HATEOAS JSONs with Circe.
## Adding to project
Scala 2.11, 2.12, 2.13.0-M4:
libraryDependencies += "io.scalaland" %% "linkuisitor-core" % "0.4.0"
Scala.js
libraryDependencies += "io.scalaland" %%% "linkuisitor-core" % "0.4.0"
## Usage
import io.circe._
import io.circe.generic.auto._
import io.circe.syntax._case class Test(string: String, int: Int)
implicit val testLinks: LinkProvider[Test] = (test: Test) => Map(
...
){
// convert class into plain (unstandardized) format
import linkuisitor.format.plain._
WithHateoas(Test("test", 1)).asJson
}{
// convert class into hal format
import linkuisitor.format.hal._
WithHateoas(Test("test", 1)).asJson
}One can change format by using different import.
## Notices
Library will only generate links for entities directly wrapped using
`WithHateoas` wrapper. If one need to have nested HATEOAS entities,
then each of them in a nested structure should be wrapped separately.Library support no `entities` section at the moment.
Library support no custom link properties.
PRs are welcome.