All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.andyglow.jsonschema.AsRaw.scala Maven / Gradle / Ivy

package com.github.andyglow.jsonschema

import com.github.andyglow.json.Value._

object AsRaw extends AsValue with AsDraftSupport {

  def schema(x: json.Schema[_]): obj = {
    val base = obj(
      "description" -> x.description,
      "title"       -> x.title)

    val definitions = inferDefinitions(x)

    base ++ apply(x) ++ {
      if (definitions.fields.nonEmpty) obj("definitions" -> definitions) else obj()
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy