%YAML 1.1
---
$schema: "http://stsci.edu/schemas/yaml-schema/draft-01"
id: "http://stsci.edu/schemas/asdf/unit/defunit-1.0.0"
title: Define a new physical unit.
description: |
  Defines a new unit.  It can be used to either:

  - Define a new base unit.

  - Create a new unit name that is a equivalent to a given unit.

  The new unit must be defined before any unit tags that use it.

type: object
properties:
  name:
    description: The name of the new unit.
    type: string
    pattern: "[A-Za-z_][A-Za-z0-9_]+"

  unit:
    description: |
      The unit that the new name is equivalent to.  It is optional,
      and if not provided, or ``null``, this ``defunit`` defines a new
      base unit.

    anyOf:
      - $ref: "unit-1.0.0"
      - type: "null"

required: [name]
...
