-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experimental abstraction over Argus-generated types
- Loading branch information
1 parent
9046e53
commit a62ec68
Showing
4 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
runtime/src/main/scala/io/circe/argus/HasSchemaSource.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package io.circe.argus | ||
|
||
/** | ||
* Supports abstraction over Argus-generated types that have a schema string associated with them. | ||
*/ | ||
trait HasSchemaSource[A] { | ||
def value: String | ||
} | ||
|
||
object HasSchemaSource { | ||
def apply[A](implicit instance: HasSchemaSource[A]): HasSchemaSource[A] = instance | ||
|
||
def instance[A](source: String): HasSchemaSource[A] = new HasSchemaSource[A] { | ||
def value: String = source | ||
} | ||
} |