Removed datamodel-code-generator from dev requirements (#1370)

* Removed datamodel-code-generator from dev requirements

* Adapted docs to mention datamodel-code-generator not being a direct dependency
This commit is contained in:
Ricardo Garcia Silva
2023-11-10 18:08:30 +00:00
committed by GitHub
parent 2f33ff5d15
commit f7b0a584e1
2 changed files with 7 additions and 6 deletions
+7 -3
View File
@@ -34,7 +34,7 @@ This workflow is valid only for the `CQL-JSON` format.
Schema
^^^^^^
The Common Query Language (CQL) is the part 3 of the standard OGC API - Features. This extension has its specification available at
The Common Query Language (CQL) is the part 3 of the standard OGC API - Features. This extension has its specification available at
`OGC API - Features - Part 3: Filtering and the Common Query Language (CQL) <https://portal.ogc.org/files/96288>`_ and the schema exists in development at
`cql.json <https://portal.ogc.org/files/96288#cql-json-schema>`_.
@@ -42,18 +42,22 @@ Model generation
^^^^^^^^^^^^^^^^
pygeoapi uses a class-based Python model interface to translate the schema into Python objects defined by `pydantic <https://docs.pydantic.dev/>`_ models.
The model is generated with the pre-processing of the schema through the utility ``datamodel-codegen``:
The model is generated with the pre-processing of the schema through the utility ``datamodel-codegen``, which is part
of the `datamodel-code-generator <https://koxudaxi.github.io/datamodel-code-generator/>`_ package:
.. code-block:: bash
# Generate from local downloaded json schema file
datamodel-codegen --input ~/Download/cql-schema.json --input-file-type jsonschema --output ./pygeoapi/models/cql_update.py --class-name CQLModel
Note that datamodel-code-generator must be explicitly installed, as it is not a pygeoapi runtime dependency
How to merge
^^^^^^^^^^^^
Once the new pydantic models have been generated then the content of the Python file ``cql_update.py`` can be used to replace the old classes within the ``cql.py`` file.
Update everything above the function ``get_next_node`` and then verify if the tests for the CQL are still passing, for example ``test_post_cql_json_between_query``
Update everything above the function ``get_next_node`` and then verify if the tests for the CQL are still passing, for example ``test_post_cql_json_between_query``
in ``tests/test_elasticsearch__provider.py``.
Working with Spatialite on OSX
-3
View File
@@ -1,9 +1,6 @@
# Flask-based CORS setup
flask_cors
# Generate pydantic models from json schema
datamodel-code-generator
# testing
pytest
pytest-cov