Giter Club home page Giter Club logo

circe-config's Introduction

circe

Build status Coverage status Maven Central Discord

circe is a JSON library for Scala (and Scala.js).

Please see the guide for more information about why circe exists and how to use it.

Community

Adopters

Are you using circe? Please consider opening a pull request to list your organization here:

Other circe organization projects

Please get in touch on Gitter if you have a circe-related project that you'd like to discuss hosting under the circe organization on GitHub.

  • circe-benchmarks: Benchmarks for comparing the performance of circe and other JSON libraries for the JVM.
  • circe-config: A library for translating between HOCON, Java properties, and JSON documents.
  • circe-derivation: Experimental generic derivation with improved compile times.
  • circe-fs2: A library that provides streaming JSON parsing and decoding built on fs2 and Jawn.
  • circe-iteratee: A library that provides streaming JSON parsing and decoding built on iteratee.io and Jawn.
  • circe-jackson: A library that provides Jackson-supported parsing and printing for circe.
  • circe-spray: A library that provides JSON marshallers and unmarshallers for Spray using circe.
  • circe-yaml: A library that uses SnakeYAML to support parsing YAML 1.1 into circe's Json.

Related projects

The following open source projects are either built on circe or provide circe support:

  • Actor Messenger: A platform for instant messaging.
  • akka-http-json: A library that supports using circe for JSON marshalling and unmarshalling in Akka HTTP.
  • akka-stream-json: A library that provides JSON support for stream based applications using Jawn as a parser with a convenience example for circe.
  • Argus: Generates models and circe encoders and decoders from JSON schemas.
  • Blackdoor JOSE: circe JSON support for blackdoor JOSE and JWT.
  • borer: Allows circe encoders/decoders to be reused for CBOR (de)serialization.
  • circe-debezium: Circe codecs for Debezium payload types
  • circe-geojson: Circe support for GeoJSON (RFC 7946)
  • circe-kafka: Implicit conversion of Encoder and Decoder into Kafka Serializer/Deserializer/Serde
  • cornichon: A DSL for JSON API testing.
  • Cosmos: An API for DCOS services that uses circe.
  • crjdt: A conflict-free replicated JSON datatype in Scala.
  • diffson: A Scala diff / patch library for JSON.
  • elastic4s: A Scala client for Elasticsearch with circe support.
  • Enumeratum: Enumerations for Scala with circe integration.
  • Featherbed: A REST client library with circe support.
  • Finch: A library for building web services with circe support.
  • fintrospect: HTTP contracts for Finagle with circe support.
  • fluflu: A Fluentd logger.
  • Github4s: A GitHub API wrapper written in Scala.
  • content-api-models: The Guardian's Content API Thrift models.
  • http4s: A purely functional HTTP library for client and server applications.
  • IdeaLingua: Staged Interface Definition and Data Modeling Language & RPC system currently targeting Scala, Go, C# and TypeScript. Scala codegen generates models and JSON codecs using circe.
  • Iglu Schema Repository: A JSON Schema repository with circe support.
  • jsactor: An actor library for Scala.js with circe support.
  • jsoniter-scala-circe: A booster for faster parsing/printing to/from circe AST and decoding/encoding of java.time._ and BigInt types.
  • jwt-circe: A JSON Web Token implementation with circe support.
  • kadai-log: A logging library with circe support.
  • msgpack4z-circe: A MessagePack implementation with circe support.
  • ohNoMyCirce: Friendly compile error messages for shapeless's Generic, circe's Encoder & Decoder and slick's case class mapping.
  • play-circe: circe support for Play!.
  • pulsar4s: A Scala client for Apache-Pulsar with circe support.
  • Rapture: Support for using circe's parsing and AST in Rapture JSON.
  • roc: A PostgreSQL client built on Finagle.
  • sangria-circe: circe marshalling for Sangria, a GraphQL implementation.
  • scalist: A Todoist API client.
  • scala-jsonapi: Scala support library for integrating the JSON API spec with Spray, Play! or Circe
  • scala-json-rpc: JSON-RPC 2.0 library for Scala and Scala.js
  • scalatest-json-circe: Scalatest matchers for Json with appropriate equality and descriptive error messages.
  • Scio: A Scala API for Apache Beam and Google Cloud Dataflow, uses circe for JSON IO
  • seals: Tools for schema evolution and language-integrated schemata (derives circe encoders and decoders).
  • shaclex: RDF validation using SHACL or ShEx.
  • Slick-pg: Slick extensions for PostgreSQL.
  • sttp: Scala HTTP client.
  • Synapses: A lightweight Neural Network library, for js, jvm and .net.
  • telepooz: A Scala wrapper for the Telegram Bot API built on circe.
  • Zenith: Functional HTTP library built on circe.

Examples

The following projects provide examples, templates, or benchmarks that include circe:

Contributors and participation

circe is a fork of Argonaut, and if you find it at all useful, you should thank Mark Hibberd, Tony Morris, Kenji Yoshida, and the rest of the Argonaut contributors.

circe is currently maintained by Darren Gibson and Erlend Hamnaberg. After the 1.0 release, all pull requests will require two sign-offs by a maintainer to be merged.

The circe project is a typelevel affiliate project, and follow the Typelevel Code of Conduct

Please see the contributors' guide for details on how to submit a pull request.

License

circe is licensed under the Apache License, Version 2.0 (the "License"); you may not use this software except in compliance with the License.

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.

circe-config's People

Contributors

char16t avatar fthomas avatar jonas avatar mzuehlke avatar scala-steward avatar travisbrown avatar vhiairrassary avatar xuwei-k avatar zakpatterson avatar zarthross avatar zmccoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

circe-config's Issues

Environment variable overrides for ConfigList do not parse

Array overrides with environment variables, such as:

-Dsettings.list.0.elem="value"

Do not get parsed properly by circe config, this produces an error:

  C[A]: DownField(list)

Internally this structure gets printed as:

{"list":{"0":{"elem":"value"}}}

So it probably gets converted to an object with "0" as a key, not to a JsonArray. This would need either smart detection of objects with numeric keys or some kind of delaying of Json conversion as discussed here: #12 (comment)

See description of the syntax: lightbend/config#86 (comment)

List is not loadable

This simple example fails to parse:

import com.typesafe.config.ConfigFactory

import io.circe.config.syntax._
import io.circe.generic.auto._
import cats.implicits._

object bug extends App {
  val config = ConfigFactory.parseString("asd: [{k: 1},{k: 2},{k: 3}]")

  case class f(k: Int)

  println(
    config.as[List[f]]("asd")
  )
}

This outputs:
Left(io.circe.ParsingFailure: String: 1: asd has type LIST rather than OBJECT)

I suppose the problem arises from that the lib expects a config object rather than anything else.

how to support default value with Scala 3?

case class DefaultConfig(a:Int = 1)// derives Codec.AsObject

import io.circe.derivation.Configuration
import io.circe.config.syntax.*
import io.circe.generic.auto.*

    given Configuration = Configuration.default.withDefaults

    println(ConfigFactory.load().as[DefaultConfig])
// would output error( .a is required)

Boolean environment variable overrides do not parse

Overrides for boolean values in system properties such as:

-Dsetting.flag=false

Will result in an exception such as:

  Boolean: DownField(flag)

Instead of being parsed properly. Note that unlike inside a HOCON file, wrapping the boolean in quotes is not necessary for the environment variables to fail to parse.

Related: #12

Document limitations regarding numerical types

Typesafe config uses Java's int, long and double types to represent numbers. In some cases, double values may read as long after a roundtrip since the input formatting is not guaranteed. Also, precision may be lost when converting from circe's JsonNumber to Typsafe config's number representation (as can be seen in the test for the printer laws).

Example in readme does not work in new SBT project with Scala 2.12.4

Using the scala-seed.g8 template to create a new project, running the example in the readme fails with the following compiler errors:

object generic is not a member of package io.circe
[error]   import io.circe.generic.auto._

could not find implicit value for evidence parameter of type io.circe.Decoder[foo.ServerSettings
[error]     val x = c.as[ServerSettings]("http.server")

circe-generic is a Test dependency, which I think it should not be.

Convert Config back into Properties object

Some APIs such as Apache Kafka require their configuration to be done with Properties objects. It would be nice if typesafe Config's could be converted back into Properties, e.g. to do some fallback logic, and then plug into their systems.

Expose ConfigValue parser

It's extremely inconvenient to wrap a ConfigValue into a Config just to be able to pass it to the API:

cv =>
  val dec = derivationDerivedDecoder.value
  val (wrappedValue, path) = cv match {
    case configObject: ConfigObject =>
      configObject.toConfig -> None
    case _ =>
      ConfigValueFactory.fromMap(Map("_root_" -> cv).asJava).toConfig -> Some("_root_")
  }
  path.fold(parser.decode[T](wrappedValue)) {
    parser.decodePath[T](wrappedValue, _)
  }

circe-config will fail on Boolean values written as "on/true/false/off"

It may be intended, but right now circe-config is inconsistent with original config for Boolean values written as strings:

scala> import com.typesafe.config.ConfigFactory
import com.typesafe.config.ConfigFactory

scala> import io.circe.config.parser
import io.circe.config.parser

scala> val config = ConfigFactory.parseString("server { host = localhost, port = 8080 }")
config: com.typesafe.config.Config = Config(SimpleConfigObject({"server":{"host":"localhost","port":8080}}))

scala> val config = ConfigFactory.parseString("server { host = localhost, port = 8080, enabled = on }")
config: com.typesafe.config.Config = Config(SimpleConfigObject({"server":{"enabled":"on","host":"localhost","port":8080}}))

scala> val json: Either[io.circe.ParsingFailure, io.circe.Json] = parser.parse(config)

json: Either[io.circe.ParsingFailure,io.circe.Json] =
Right({
  "server" : {
    "enabled" : "on",
    "port" : 8080,
    "host" : "localhost"
  }
})

scala> config.getBoolean("server.enabled")
res0: Boolean = true

It is possible to work around it, but it is not very convenient when passing config values via ENV_VARIABLES in K8s -- it disallows unquoted strings. :(

Release using circe-core 0.14.6

The latest version of circe-config requires circe-core 0.14.3 version. The latest version of circe-core is 0.14.6.

There has already been a commit with the upgraded dependency into the master branch b5ebb38 .

It would be nice to do a new release of circe-config to include the latest version of circe-core to allow people to upgrade who are using strict builds.

Is scala 2.10.5 supported?

[warn] 	Note: Unresolved dependencies path:
[warn] 		io.circe:circe-config_2.10:0.4.0 (/Users/ivan/Development/project_test/build.sbt#L720)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.