Commit Graph

1068 Commits

Author SHA1 Message Date
Tom Kralidis 989dfb6d30 fix Coverage output and format exception MIME type (#712)
* fix Coverage output and format exception MIME type

* Minor tweaks, added test to assert that a text/html header (without 'f' query param) returns JSON for get_collection_coverage()

Co-authored-by: Sander Schaminee <sander.schaminee@geocat.net>
2021-06-10 19:47:21 -04:00
Tom Kralidis b914e13205 STAC: dynamically capture band tags (#710) 2021-06-09 17:13:19 -04:00
Tom Kralidis 1715509f39 add safeguard for formatting errors (#708) 2021-06-09 14:33:09 -04:00
Sander Schaminee 8f3e5c2ad7 Simplify API tests (#707) 2021-06-09 06:10:10 -04:00
Tom Kralidis 48efbdec53 various fixes (#706) 2021-06-09 06:09:32 -04:00
Sander Schaminee 023f24d26b Multilingual support (alternative) (#664)
* Created localization (l10n) module + tests. Added l10n support to API and plugins (wip).

* Big refactor:

* All routed API methods are now decorated by @pre_process (consistency) and no longer have a headers+format argument but a request argument (**kwargs also removed)
* The pre_process decorator turns an incoming Flask/Starlette request into a generic APIRequest instance
* The new APIRequest class extracts all relevant info (params, data, locale, etc.) from the request and exposes them as properties
* Removed a lot of boilerplate (i.e. format checking) and wrapped that into methods
* Updated server-specific API calls in each route method (pass entire request object, not headers and query params)

* Several improvements and fixes:

* Updated OpenAPI page with "l" query param
* Added example translations (metadata)
* Changed plugin signature: added explicit locale attribute (instead of **kwargs)
* Moved locale processing to get_plugin_locale() function in l10n module
* API should pass raw requested locale to plugins, locale should always be set
* Fixed API tests and added APIRequest tests
* Prepared utils.py for Jinja2 i18n extension
* Rebased on commit b40297a8 and fixed compatibility with #661 and #662

* Updated documentation for language support

* Rebased and fixed compatibility with PR #658:

* Fixed EDR provider signature (added locale)
* Fixed EDR API routes and query function (and improved parameter-name handling)
* Fixed EDR tests

* Translate entire config in render_j2_template for requested locale:

* Added new translate_dict function to l10n module (+ tests)
* Updated all render_j2_template calls with locale parameter
* Updated pygeoapi-test-config.yml with some language structs

* Minor improvements

* support both 'language' and 'languages' property in server config and provider definitions
* renamed and modified translate_dict() to more generic translate_struct() function (l10n module)
* remove Content-Language header from provider responses if provider has no language support and format is json(ld)
* updated tests

* Leave provider locale handling to API

* Moved code to determine locale from providers to API class (and remove for formatters and processes)
* Removed locale parameter from plugin __init__ signatures
* Removed locale parameter from load_plugin()
* Added **kwargs to provider implementations for get, query, get_metadata, get_coverage_domainset and get_coverage_rangetype method signatures
* Added language=<locale> to all API calls to provider get, query, get_metadata, get_coverage_domainset and get_coverage_rangetype methods

* Use 'lang' instead of 'l' as language query parameter

* Updated Open API
* Updated documentation
* Fixed tests

* Implemented requested PR changes:

* Added usage examples to the APIRequest docstring
* Removed language support from coverage functions
* Updated plugins.rst and language.rst to match new behavior
* Removed language struct from resource links in pygeoapi-config.yml
* Rebased on latest master (fixed test_api.py)

* Rebased and applied fixes:

* Data property in APIRequest now is an awaitable attribute (fixed for Starlette compatibility)
* Named references to 'l' parameter to 'lang'

* Final changes/improvements:

* Make sure that Content-Language is always set;
* Added more tests to ensure that the default language returned is the first configured language (if no language was requested by the user);
* Updated docs;
* Replaced re-occuring strings with constants in api.py;
* Fixed Flake8 checks.

* add missing async to starlette routes (#704)

Co-authored-by: Tom Kralidis <tomkralidis@gmail.com>
2021-06-08 18:46:35 -04:00
Tom Kralidis 4bc929ef87 add missing async to starlette routes (#704) 2021-06-05 15:49:36 +02:00
Tom Kralidis 46f84a4ed3 migrate to GitHub Actions (#616) (#703) 2021-06-01 17:15:30 -04:00
Tom Kralidis f2d064656f fix Flask blueprints (#702) 2021-05-31 18:30:30 -04:00
Tom Kralidis d92f8012d1 update OARec metadata models per spec changes (#701) 2021-05-31 18:27:53 -04:00
Jo 7a9a8b19bf - Updated attribution to reflect the change of background map (#700)
Co-authored-by: doublebyte1 <info@doublebyte.net>
2021-05-31 10:41:42 -04:00
Tom Kralidis f6a469a7f5 fix flake8 2021-05-28 11:16:47 -04:00
Tom Kralidis 357c184c71 fix flake8, add function documentation 2021-05-28 10:58:46 -04:00
Francesco Bartoli b478f4f4b6 Fix #695 with a monkey patch (#698)
Fix #695 with a monkey patch
2021-05-28 10:52:00 -04:00
Jo ba3bf1621f - changed default background map to OSM (#697)
Co-authored-by: doublebyte1 <info@doublebyte.net>
2021-05-27 17:43:46 -04:00
Jo c7ea56218d Added missing parameters on the openapi definition of the get an observations tile request (#694)
* - Added missing parameters on the openapi definition of get an observations tile request

* - changed default background map to osm

Co-authored-by: doublebyte1 <info@doublebyte.net>
2021-05-27 22:30:04 +02:00
Ben Coleman 6f8ba4709d Handle null geometries (#693)
If the geometry value is `null`, then a JSON serialization error occurs
because `None` by itself is not JSON serializable.
2021-05-27 13:42:05 -04:00
Tom Kralidis ac7098aab5 update OATiles conformance classes (#692) 2021-05-27 08:38:06 -04:00
Tom Kralidis 7e568f5838 fix 5 minute install (#686) (#691) 2021-05-24 21:49:11 -04:00
Tom Kralidis 2744a24e6a fix ESRI Shapefile STAC publishing (#561) (#681) 2021-05-18 06:46:36 -04:00
Tom Kralidis a4bf35d310 implement STAC 1.0.0-rc.2 improvements (#679) 2021-04-27 19:52:28 -04:00
Tom Kralidis 5f241ba484 fixes JSON and JSON-LD links in HTML base template (#680) 2021-04-27 19:48:39 -04:00
Kyle Onda 589df6370a Support for PIDs and (non-Geo)JSON-LD (#676)
* Update api.py for uri_field

* Update linked_data.py

Update to meet the needs of https://github.com/internetofwater/geoconnex.us/issues/93

* Add uri_field to base.py provider

* Update index.html

Push uri-like field to front of list in collections/items

* Update api.py

Allow html files to handle uri_field

* Add trailing / to schema context

* Add uri_field to collections index page

* Add uri_field to collections item html page

* Update api.py

* Update configuration.rst

* fixed spelling

* Update configuration.rst

* Update configuration.rst

* Update configuration.rst

* Update sqlite.py

* Update linked_data.py

* Update api.py

* Revert 'id' cast to string

* Update configuration.rst

* Update linked_data.py

* Update api.py

* Update linked_data.py

* Update configuration.rst for json boolean

Co-authored-by: Benjamin Webb <40066515+webb-ben@users.noreply.github.com>
2021-04-27 19:44:19 -04:00
Tom Kralidis 3b0cc014d4 tighten ES id query as match case (#678) 2021-04-22 06:55:24 -04:00
Tom Kralidis a196f40e8c fix Starlette POST handling (#673) (#674) 2021-04-08 08:24:14 -04:00
totycro f7800fb46b Allow specifying job_id via request parameter (#675)
This is somewhat unconventional with REST design and leaves it up to the
process implementation to deal with duplicates and invalid IDs, however
it can make sense in certain use cases.

An alternative design would be to encode the desired `job_id` in the url:
`POST /processes/<process_id>/jobs/<job_id>`
This would suggest full control over the `job_id` from the client side,
so I'd prefer to pass the id via POST data. This way we can treat it as
suggestion, or possibly as a template from which the server derives the
actual id.
2021-04-08 08:16:21 -04:00
Tom Kralidis 3f248a5c42 fix datetime window validation (#666) (#671) 2021-03-30 06:21:11 -04:00
Tom Kralidis 43b6165fa9 EDR: s/parameters/parameter-names/ (#667) 2021-03-26 09:58:46 -04:00
Angelos Tzotsos c55e1cf452 back to dev 2021-03-18 18:01:10 +02:00
Angelos Tzotsos 837847e85d update release version 2021-03-18 17:59:10 +02:00
Tom Kralidis b40297a864 handle datetime errors in config (#659) (#661) 2021-03-18 06:25:39 -04:00
Tom Kralidis e2e2b7d671 improve MIME type handling for raw payload responses (#662)
* improve MIME type handling for raw payload responses

* fix ref
2021-03-18 06:25:10 -04:00
Angelos Tzotsos 50fcfdf047 Back to dev 2021-03-16 18:40:48 +02:00
Angelos Tzotsos f978d0a1f6 update release version 2021-03-16 18:06:56 +02:00
Tom Kralidis 951a1fb486 implement OGC EDR API (#658)
* implement OGC EDR API
* add docs/tests
* fix tests
2021-03-15 17:37:40 +02:00
Tom Kralidis 2063c69872 add support for OpenAPI document as JSON (#657) 2021-03-12 16:47:01 -05:00
Tom Kralidis ee568f9952 handle ES URLs via HTTPS (#654) 2021-03-02 19:15:17 -05:00
Sander Schaminee 22a46ec5c8 Match new queryable model from commit e0003b06 (#652) 2021-02-27 07:24:37 -05:00
Tom Kralidis 2f99f19fb0 refactor exceptions (#650)
* refactor exceptions

* add test
2021-02-26 14:07:50 -05:00
Tom Kralidis 1804a9b493 fix ref 2021-02-25 22:26:25 +01:00
Tom Kralidis 4242083330 allow for enumerated values in providers 2021-02-25 22:26:25 +01:00
Tom Kralidis e0003b066b update queryables response 2021-02-25 22:26:25 +01:00
Tom Kralidis dea90efcfb Merge pull request #646 from pvgenuchten/fix-in-concat
fixes concatenation, if int
2021-02-24 08:37:10 -05:00
Paul df1b2612fe fixes concatenation, if int 2021-02-24 14:22:58 +01:00
Tom Kralidis 332a62932f Merge pull request #645 from pvgenuchten/optimize-type-check
fixes check=boolean issue in item.html
2021-02-23 06:23:02 -05:00
Paul ff65145492 fixes check=boolean issue in item.html
patches the display of associations
2021-02-23 11:39:24 +01:00
Tom Kralidis 5ea137650e Merge pull request #644 from pvgenuchten/no-truncate-on-int
cast to string before calling truncate, else fails
2021-02-22 17:50:12 -05:00
Paul 30ddef692a cast to string before calling truncate, else fails (int has no option len()) 2021-02-22 23:38:45 +01:00
Tom Kralidis 16f956fa91 Merge pull request #640 from tomkralidis/update-sortby
update sortby parameter handling
2021-02-21 20:00:12 -05:00
Tom Kralidis 4f5ae70a07 skip q parameter declaration if records 2021-02-21 19:45:41 -05:00