NAME

Dist::Conformance::Check::DataSchema - A JSON or YAML file parses and matches a schema

VERSION

version 0.001

DESCRIPTION

Some programs read a configuration file that a person writes by hand, and ignore a key that they do not know without a word. In such a file a misspelling turns a rule off. .perl-slop.json of the perl-slop plugin is one, as above. This check reports missing when the file is absent. It fails when the file does not parse as a JSON object or a YAML mapping, or does not match schema, and passes otherwise.

The schema is in the flavor, so that it changes in the same commit as the standards that describe the file. It is an OpenAPI v3 schema, as Dist::Conformance::Schema describes.

What a file should say is the repository's own choice, so the update changes nothing. It says what is wrong when the check fails.

METHODS

from_config

The same as "from_config" in Dist::Conformance::Check. It also dies when there is no format and the name of file does not say one.

file_format

json or yaml: format, or the format that the extension of file says. Undefined when neither says one.

check

IN A FLAVOR

checks:
  PerlSlopConfig:
    module: DataSchema
    file: .perl-slop.json
    missing: info
    schema:
      type: object
      additionalProperties: false
      properties:
        before_edit:
          type: object
        before_commit:
          type: object

CONFIGURATION

file

Required. The path of the file.

schema

Required. The schema that its content must match.

format

json or yaml: how to parse the file. Default json for a file whose name ends in .json, and yaml for one whose name ends in .yml or .yaml. A file with any other name needs it.

missing

The status when the file is absent. Default info, because a file of this kind is usually optional.

SEE ALSO

Please see those modules/websites for more information related to this module.

BUGS

Please report any bugs or feature requests on the bugtracker website https://github.com/Troglodyne-Internet-Widgets/Dist-Conformance/issues

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

AUTHORS

Current Maintainers:

  • George S. Baugh <george@troglodyne.net>

COPYRIGHT AND LICENSE

Copyright (c) 2026 Troglodyne LLC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.