Current section

Files

Jump to
jsonschex mix.exs
Raw

mix.exs

defmodule JSONSchex.MixProject do
  use Mix.Project

  @source_url "https://github.com/xinz/jsonschex"
  @version "0.10.0"
  @description "An implementation of the JSON Schema draft 2020-12 and latest specification for Elixir"

  def project do
    [
      app: :jsonschex,
      version: @version,
      elixir: "~> 1.14",
      start_permanent: Mix.env() == :prod,
      deps: deps(),
      elixirc_paths: elixirc_paths(Mix.env()),
      docs: docs(),
      description: @description,
      package: package(),
      source_url: @source_url
    ]
  end

  def elixirc_paths(:test), do: ["lib", "test/support"]
  def elixirc_paths(_), do: ["lib"]

  defp docs do
    [
      main: "readme",
      extras: [
        "README.md",
        "CHANGELOG.md",
        "guide/loader.md",
        "guide/dialect_and_vocabulary.md",
        "guide/feature_matrix.md",
        "guide/content_and_format.md",
        "guide/test_suite.md"
      ],
      groups_for_extras: [
        Guides: [
          "guide/loader.md",
          "guide/dialect_and_vocabulary.md",
          "guide/feature_matrix.md",
          "guide/content_and_format.md",
          "guide/test_suite.md"
        ]
      ],
      groups_for_modules: [
        "Public API": [
          JSONSchex,
          JSONSchex.Ref,
          JSONSchex.Schema,
          JSONSchex.Sigil
        ],
        Types: [
          JSONSchex.Types,
          JSONSchex.Types.Schema,
          JSONSchex.Types.Rule,
          JSONSchex.Types.Error,
          JSONSchex.ErrorFormatter
        ],
        Compiler: [
          JSONSchex.Compiler,
          JSONSchex.Compiler.ECMARegex,
          JSONSchex.Compiler.Predicates,
          JSONSchex.Compiler.Predicates.MultipleOf
        ],
        Validator: [
          JSONSchex.Validator,
          JSONSchex.Validator.Rules,
          JSONSchex.Validator.Keywords,
          JSONSchex.Validator.Reference
        ],
        Formats: [
          JSONSchex.Formats,
          JSONSchex.Formats.DateTime,
          JSONSchex.Formats.Email,
          JSONSchex.Formats.Hostname,
          JSONSchex.Formats.IP,
          JSONSchex.Formats.Regex,
          JSONSchex.Formats.URITemplate
        ],
        Internal: [
          JSONSchex.Vocabulary,
          JSONSchex.ScopeScanner,
          JSONSchex.URIUtil
        ],
        Draft202012: [
          JSONSchex.Draft202012.Vocabulary,
          JSONSchex.Draft202012.Schemas,
          JSONSchex.Draft202012.Dialect,
        ]
      ],
      nest_modules_by_prefix: [
        JSONSchex.Types,
        JSONSchex.Compiler,
        JSONSchex.Validator,
        JSONSchex.Formats,
        JSONSchex.Draft202012
      ]
    ]
  end

  defp package do
    [
      licenses: ["MIT"],
      links: %{
        "GitHub" => @source_url,
        "Changelog" => "#{@source_url}/blob/main/CHANGELOG.md"
      },
      files: ~w(lib .formatter.exs mix.exs README.md LICENSE.md)
    ]
  end

  # Run "mix help compile.app" to learn about applications.
  def application do
    [
      extra_applications: [:logger]
    ]
  end

  # Run "mix help deps" to learn about dependencies.
  defp deps do
    [
      {:ex_json_pointer, "~> 0.8"},
      {:jason, "~> 1.4", optional: true},
      {:decimal, "~> 1.0 or ~> 2.0 or ~> 3.0", optional: true},
      {:idna, "~> 6.0 or ~> 7.1", optional: true},
      {:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
    ]
  end
end