All Projects → 47degrees → case-classy

47degrees / case-classy

Licence: Apache-2.0 license
configuration with less hassle

Programming Languages

scala
5932 projects
CSS
56736 projects

Projects that are alternatives of or similar to case-classy

Configuration
Hierarchical configuration manager for Swift applications
Stars: ✭ 72 (+5.88%)
Mutual labels:  configuration
CoSky
High-performance, low-cost microservice governance platform. Service Discovery and Configuration Service | 高性能、低成本微服务治理平台
Stars: ✭ 57 (-16.18%)
Mutual labels:  configuration
configuration-service
Configuration Service is a distributed configuration provider for .NET Core.
Stars: ✭ 62 (-8.82%)
Mutual labels:  configuration
frontend-platform
A framework for Open edX micro-frontend applications.
Stars: ✭ 17 (-75%)
Mutual labels:  configuration
unity-auto-preset
Auto Preset enables scriptable configuration of assets from the Unity Editor without requiring any additional code.
Stars: ✭ 19 (-72.06%)
Mutual labels:  configuration
envkey-node
EnvKey's official Node.js client library
Stars: ✭ 46 (-32.35%)
Mutual labels:  configuration
dotfiles
🔧 .files - different setups separated in branches
Stars: ✭ 168 (+147.06%)
Mutual labels:  configuration
config
Config component, strictly typed
Stars: ✭ 14 (-79.41%)
Mutual labels:  configuration
open-scd
A substation configuration description editor for projects using SCL IEC 61850-6 Edition 2 or greater
Stars: ✭ 35 (-48.53%)
Mutual labels:  configuration
salak.rs
A multi layered configuration loader and zero-boilerplate configuration parser.
Stars: ✭ 27 (-60.29%)
Mutual labels:  configuration
scalecube-config
ScaleCube Config is a configuration access management library for JVM based distributed applications
Stars: ✭ 15 (-77.94%)
Mutual labels:  configuration
configuro
An opinionated configuration loading framework for Containerized and Cloud-Native applications.
Stars: ✭ 81 (+19.12%)
Mutual labels:  configuration
kfc-plugins
Kotlin/JS Fast Configuration
Stars: ✭ 37 (-45.59%)
Mutual labels:  configuration
wcm-io-caconfig
Context-Aware Configuration for AEM applications.
Stars: ✭ 16 (-76.47%)
Mutual labels:  configuration
dotfiles
🏡 There's no place like ~/
Stars: ✭ 59 (-13.24%)
Mutual labels:  configuration
go-chassis-config
pull and push configs in distributed configuration management service. migrated to go-archaius https://github.com/go-chassis/go-archaius/pull/87
Stars: ✭ 23 (-66.18%)
Mutual labels:  configuration
habitat
Easily configure settings for Crystal projects
Stars: ✭ 73 (+7.35%)
Mutual labels:  configuration
nginx-conf
Nginx configuration
Stars: ✭ 18 (-73.53%)
Mutual labels:  configuration
network tech
Cisco config syntax and snippets for Sublime Text
Stars: ✭ 82 (+20.59%)
Mutual labels:  configuration
Selenium-Foundation
Selenium Foundation is an automation framework designed to extend and enhance the capabilities provided by Selenium (WebDriver).
Stars: ✭ 51 (-25%)
Mutual labels:  configuration

Build Status codecov.io Maven Central License Latest version Scala.js GitHub Issues

Case Classy (ABANDONED)

DEPRECATION NOTICE

The case-classy was a small Scala library, written in a functional style, to handle loading configurations. It was developed between August 2016 and April 2017. At that time, there was not any great Scala-FP alternative for loading configuration from HOCON .conf files. However, since then new alternative libraries like pureconfig or ciris have appeared, which provide more features and have received wider adoption. We recommend using those.

47 Degrees hasf therefore discontinued development and maintenance of this library. The source code is left here for those interesting in studying it.

Introduction

Case classy is a tiny library to make it easy to decode untyped structured data into case class hierarchies of your choosing. It's completely modular, support Scala 2.11 and 2.12, ScalaJS ready, and the core module has zero external dependencies.

// required
libraryDependencies += "com.47deg" %% "classy-core"            % "0.4.0"

// at least one required
libraryDependencies += "com.47deg" %% "classy-config-typesafe" % "0.4.0"
libraryDependencies += "com.47deg" %% "classy-config-shocon"   % "0.4.0"

// optional
libraryDependencies += "com.47deg" %% "classy-generic"         % "0.4.0"
libraryDependencies += "com.47deg" %% "classy-cats"            % "0.4.0"

The modules provide the following support:

  • classy-core: Basic set of configuration decoders and combinators. required
  • classy-generic: Automatic derivation for your case class hierarchies. depends on shapeless
  • classy-config-typesafe: Support for Typesafe's Config library.
  • classy-config-shocon: Support for the Shocon config library.
  • classy-cats: Instances for Cats.

All module support ScalaJS except classy-config-typesafe.

Documentation

Documentation is available on the website.

Quick Example

import classy.generic._
import classy.config._

// Our configuration class hierarchy
sealed trait Shape
case class Circle(radius: Double) extends Shape
case class Rectangle(length: Double, width: Double) extends Shape

case class MyConfig(
  someString: Option[String],
  shapes: List[Shape])

import com.typesafe.config.Config
val decoder1 = deriveDecoder[Config, MyConfig]
decoder1.fromString("""shapes = []""")
// res4: Either[classy.DecodeError,MyConfig] = Right(MyConfig(None,List()))

decoder1.fromString("""
  someString = "hello"
  shapes     = []""")
// res5: Either[classy.DecodeError,MyConfig] = Right(MyConfig(Some(hello),List()))

decoder1.fromString("""shapes = [
  { circle    { radius: 200.0 } },
  { rectangle { length: 10.0, width: 20.0 } }
]""")
// res6: Either[classy.DecodeError,MyConfig] = Right(MyConfig(None,List(Circle(200.0), Rectangle(10.0,20.0))))

// mismatched config
val res = decoder1.fromString("""shapes = [
  { rectangle { radius: 200.0 } },
  { circle    { length: 10.0, width: 20.0 } }
]""")
// res: Either[classy.DecodeError,MyConfig] = Left(AtPath(shapes,And(AtIndex(0,Or(AtPath(circle,Missing),List(AtPath(rectangle,And(AtPath(length,Missing),List(AtPath(width,Missing))))))),List(AtIndex(1,Or(AtPath(circle,AtPath(radius,Missing)),List(AtPath(rectangle,Missing))))))))

// error pretty printing
res.fold(
  error => error.toPrettyString,
  conf  => s"success: $conf")
// res9: String =
// errors.shapes (conjunction/AND):
//   [0] (disjunction/OR):
//     circle: missing value
//     rectangle (conjunction/AND):
//       length: missing value
//       width: missing value
//   [1] (disjunction/OR):
//     circle.radius: missing value
//     rectangle: missing value

Case Classy in the wild

If you wish to add your library here please consider a PR to include it in the list below.

Commercial Support

47 Degrees offers commercial support for the Case Classy library and associated technologies. To find out more, visit 47 Degrees' Open Source Support.

Copyright

Case Classy is designed and developed by 47 Degrees

Copyright (C) 2017 47 Degrees. http://47deg.com

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].