add support for configuration schema and validation (#553) (#719)

* add support for configuration schema and validation (#553)

* rename types

* minor doc fix

* update i18n regexes

* make openapi click options required arguments
This commit is contained in:
Tom Kralidis
2021-07-06 17:01:05 -04:00
committed by GitHub
parent d6df7d4fef
commit 89eff49ce0
18 changed files with 627 additions and 60 deletions
+4 -23
View File
@@ -20,19 +20,19 @@ To generate the OpenAPI document, run the following:
.. code-block:: bash
pygeoapi openapi generate -c /path/to/my-pygeoapi-config.yml
pygeoapi openapi generate /path/to/my-pygeoapi-config.yml
This will dump the OpenAPI document as YAML to your system's ``stdout``. To save to a file on disk, run:
.. code-block:: bash
pygeoapi openapi generate -c /path/to/my-pygeoapi-config.yml > /path/to/my-pygeoapi-openapi.yml
pygeoapi openapi generate /path/to/my-pygeoapi-config.yml > /path/to/my-pygeoapi-openapi.yml
To generate the OpenAPI document as JSON, run:
.. code-block:: bash
pygeoapi openapi generate -c /path/to/my-pygeoapi-config.yml -f json > /path/to/my-pygeoapi-openapi.json
pygeoapi openapi generate /path/to/my-pygeoapi-config.yml -f json > /path/to/my-pygeoapi-openapi.json
.. note::
Generate as YAML or JSON? If your OpenAPI YAML definition is slow to render as JSON,
@@ -56,26 +56,7 @@ utility that can be run as follows:
.. code-block:: bash
pygeoapi validate-openapi-document -o /path/to/my-pygeoapi-openapi.yml
Verifying configuration files
-----------------------------
To ensure your YAML configurations are correctly formatted, you can use any YAML validator, or try
the Python one-liner per below:
.. code-block:: bash
python -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < /path/to/my-pygeoapi-config.yml
python -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < /path/to/my-pygeoapi-openapi.yml
To ensure your OpenAPI JSON is correctly formatted, you can use any JSON validator, or try
the Python one-liner per below:
.. code-block:: bash
cat /path/to/my-pygeoapi-openapi.json | python -m json.tool
pygeoapi openapi validate /path/to/my-pygeoapi-openapi.yml
Setting system environment variables
+11
View File
@@ -200,6 +200,17 @@ default.
:ref:`plugins` for more information on plugins
Validating the configuration
----------------------------
To ensure your configuration is valid, pygeoapi provides a validation
utility that can be run as follows:
.. code-block:: bash
pygeoapi config validate -c /path/to/my-pygeoapi-config.yml
Using environment variables
---------------------------
@@ -3,7 +3,7 @@
Publishing metadata to OGC API - Records
========================================
`OGC API - Records `_ provides geospatial data access functionality to vector data.
`OGC API - Records`_ provides geospatial data access functionality to vector data.
To add vector data to pygeoapi, you can use the dataset example in :ref:`configuration`
as a baseline and modify accordingly.
+1 -1
View File
@@ -31,7 +31,7 @@ For developers and the truly impatient
vi example-config.yml
export PYGEOAPI_CONFIG=example-config.yml
export PYGEOAPI_OPENAPI=example-openapi.yml
pygeoapi openapi generate -c $PYGEOAPI_CONFIG > $PYGEOAPI_OPENAPI
pygeoapi openapi generate $PYGEOAPI_CONFIG > $PYGEOAPI_OPENAPI
pygeoapi serve
curl http://localhost:5000