New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The queryables resource use invalid JSON Schema types #1091
Comments
@jerstlouis thanks for filing the issue. This depends on the backend provider in use. If I assume/guess a PostgreSQL provider, then this would mean that its Can someone confirm PostgreSQL is indeed the backend being used here? cc @skyNacho |
Yes, that is correct. The PostgreSQL provider was used in this case. @tomkralidis do you want me to give it a try? |
@tomkralidis @skyNacho Thank you for looking into this. e.g., |
|
@ximenesuk & @volcan01010 adding to the thread for info... |
The expected_fields = {
'blockage': {'type': 'VARCHAR(80)'},
'covered': {'type': 'VARCHAR(80)'},
'depth': {'type': 'VARCHAR(80)'},
'layer': {'type': 'VARCHAR(80)'},
'name': {'type': 'VARCHAR(80)'},
'natural': {'type': 'VARCHAR(80)'},
'osm_id': {'type': 'INTEGER'},
'tunnel': {'type': 'VARCHAR(80)'},
'water': {'type': 'VARCHAR(80)'},
'waterway': {'type': 'VARCHAR(80)'},
'width': {'type': 'VARCHAR(80)'},
'z_index': {'type': 'VARCHAR(80)'}
} I wasn't aware of the JSON Schema requirement. The best fix is probably to map between SQLAlchemy types and JSON Schema types within the pygeoapi/pygeoapi/provider/postgresql.py Line 169 in 2d4d8e6
|
It seems that at minimum the |
@skyNacho if you do submit a PR/update, feel free to update to """
Get provider field information (field names, JSON Schema data types)
Example response: {'field1': 'string', 'field2': 'number'}}
:returns: dict of field names and their associated JSON Schema typess
""" |
Fixed in master (thanks @totycro!) |
Description
When importing data types from PostgreSQL database, unrecognized types are simply copied, resulting in invalid JSON Schema types for queryables.
Steps to Reproduce
See https://aviationapi.skymantics.com/faa/collections/faa_flight_plans/queryables
Expected behavior
The queryables response should always conform to the JSON Schema. Invalid types should be converted to valid types (e.g., strings, objects).
Additional context
This issue was discovered in Testbed 18 - Advanced SWIM Filtering with Skymantics Aviation service.
The problem may be in openapi.py, about line 601:
The text was updated successfully, but these errors were encountered: