tdwg / cd

Collection Descriptions
Creative Commons Attribution 4.0 International
23 stars 10 forks source link

re-try auto-generating json-schema #441

Closed magpiedin closed 1 year ago

magpiedin commented 1 year ago

@essvee & @jbstatgen -- When you have a chance does this pull-request / auto-generated JSON-Schema look good on your end?

I reverted the current review branch standard/json-schema files to how they were before auto-generated JSON-schema files were added.

Recap:

  1. These JSON terms were autogenerated by running csv_to_json.py with the current review-branch CSVs

    • if "tdwgutility_required" = "Yes" in CSV:

      • "minItems" (for array-terms) is currently set to 1 in JSON
      • term is added to the required array at end of json file.
    • "uniqueItems" defaults to true in JSON

      • Should this instead be based on "tdwgutility_repeatable" = "Yes" in CSV?
    • Should term names in JSON-Schema be formatted "namespace:term_localName"?

  2. $id &$ref` URI-values point to resolvable 'raw' github URLS on the "review" branch, rather than "master"

Fixes:

  1. For spec's, required terms are now included in the required array at the end of each Class JSON-Schema file
  2. Arrays for repeatable terms (e.g. for ltc:typeOfCollection) include "type" and "description", not "$ref"
    • For now, "type" within the array defaults to "string" until the datatypes CSV includes array-datatype
    • Related: String "formats" also can't be auto-generated until the terms or datatype CSVs can define the format-requirements.
      • e.g. - see notes below from #433 :

The terms or datatype CSVs may need a new column or value to specify string "format" -- e.g. to regenerate the date/date-time format specified for these 4 terms:

      "endedAtTime": {
        "description": "The date or time when a Person stopped fulfilling the role specified in the role property.",
        "type": "string",
        "oneOf": [
            {
              "format": "date"
            },
            {
              "format": "date-time"
            }
          ]
        }

If anything looks mangled, all ears!