================================================================================
funding.json.ncl
================================================================================

.. default-role:: code

:author: toastal

It’s |funding.json|_, but in Nickel — & some additional enhancements in
``Enhanced``:

• Stronger type constaints

  • ``NonEmpty`` for relevant strings & arrays
  • Some numbers / integers have a useful bounds check
  • Invariant case for cross-host :ac:`URL`\s which require the ``well-known``
    :ac:`URL` to be stated
  • Amounts must be ``'Any`` or ``'Stated`` instead of ``0`` being implicitly
    ``'Any``
  • All channels are accounted for in plans

• Channels, projects, plans now a record with :ac:`GUID` keys instead of an
  array — which is more ergonomic to write, but also asserts :ab:`ID`
  uniqueness.
• Fixing spelling & syntax errors (some subject like swapping to -ize suffixes)
• Allowing ``check`` to be a payment method (gets mapped as an alias to Common
  Wealth ``cheque``), ``organization`` for entity types (gets mapped to
  ``organisation``)
• kebab-case keys are clearer to read, are easier to type, & don’t have issues
  like miscasing acronyms/initialism
• `unhance` adapter will map our better typing to the original schema :ab:`spec`
  (maybe in the future an `enhance` adapter returning a ``[| 'Ok … | 'Error …
  |]`` could happen too)

License
================================================================================

This project is licensed under th Mozilla Public License Version 2.0 (MPL-2.0_)
— see the ``LICENSE.txt`` file in for details.

Using
================================================================================

.. code:: nickel

	# funding.ncl
	let Funding = import "$FUNDING_JSON_NCL_DIR/main.ncl" in
	{
		# …
	} | Funding.EnhancedSchema

Then can be exported as a valid ``funding.json``

.. code:: console

	$ cat <EOF | nickel export -f json -o funding.json
	let Funding = import "$FUNDING_JSON_NCL_DIR/main.ncl" in
	Funding.unhance (import "./funding.ncl")
	EOF

Nickel also lets you use ``--import-path`` or set the ``$NICKEL_IMPORT_PATH``
with its commands.

.. note::

	There is technically an in-development Nickel registry, but it only has 2
	packages & requires both an account with Microsoft GitHub but also that your
	project is hosted on Microsoft’s platform. As such, this registry should be
	dismissed until its design is more abstract & without :ac:`VCS` *or* code
	forge lock-in — especially a proprietary, personal-data-guzzling one — as
	free software is about giving users choice as well as supporting other free
	software projects (which includes the tooling to host code + community).

	Luckily a Nix overlay or `callPackage`\ing `nix/package/funding.json.nix` can
	get around their short-coming. This becomes even easier with |Nixtamal|_’s
	Nix pinning as Pijul is natively supported.

.. |funding.json| replace:: :t:`funding.json`
.. _funding.json: https://fundingjson.org
.. _MPL-2.0: https://www.mozilla.org/en-US/MPL/2.0/
.. |Nixtamal| replace:: :t:`Nixtamal`
.. _Nixtamal: https://nixtamal.toast.al/

.. vim: set textwidth=80 :
