+2
-2
@@ -493,13 +493,13 @@ class API(object):
|
||||
'type': 'application/geo+json',
|
||||
'rel': 'self',
|
||||
'title': 'This document as GeoJSON',
|
||||
'href': '{}/collections/{}/items'.format(
|
||||
'href': '{}/collections/{}/items?f=json'.format(
|
||||
self.config['server']['url'], dataset)
|
||||
}, {
|
||||
'type': 'text/html',
|
||||
'rel': 'alternate',
|
||||
'title': 'This document as HTML',
|
||||
'href': '{}/collections/{}/items'.format(
|
||||
'href': '{}/collections/{}/items?f=html'.format(
|
||||
self.config['server']['url'], dataset)
|
||||
}, {
|
||||
'type': 'application/geo+json',
|
||||
|
||||
@@ -46,7 +46,7 @@ if 'PYGEOAPI_CONFIG' not in os.environ:
|
||||
raise RuntimeError('PYGEOAPI_CONFIG environment variable not set')
|
||||
|
||||
with open(os.environ.get('PYGEOAPI_CONFIG')) as fh:
|
||||
CONFIG = yaml.load(fh)
|
||||
CONFIG = yaml.load(fh, Loader=yaml.FullLoader)
|
||||
|
||||
# CORS: optionally enable from config.
|
||||
if CONFIG['server'].get('cors', False):
|
||||
@@ -73,7 +73,7 @@ def root():
|
||||
@APP.route('/api')
|
||||
def api():
|
||||
with open(os.environ.get('PYGEOAPI_OPENAPI')) as ff:
|
||||
openapi = yaml.load(ff)
|
||||
openapi = yaml.load(ff, Loader=yaml.FullLoader)
|
||||
|
||||
headers, status_code, content = api_.api(request.headers, request.args,
|
||||
openapi)
|
||||
|
||||
+36
-2
@@ -184,6 +184,8 @@ def get_oas_30(cfg):
|
||||
'tags': [k],
|
||||
'parameters': [
|
||||
{'$ref': '#/components/parameters/f'},
|
||||
{'$ref': '#/components/parameters/bbox'},
|
||||
{'$ref': '#/components/parameters/time'},
|
||||
{'$ref': '#/components/parameters/limit'},
|
||||
{'$ref': '#/components/parameters/sortby'},
|
||||
{'$ref': '#/components/parameters/startindex'}
|
||||
@@ -217,6 +219,11 @@ def get_oas_30(cfg):
|
||||
'type': 'number',
|
||||
'format': 'float'
|
||||
}
|
||||
elif v2['type'] == 'long':
|
||||
schema = {
|
||||
'type': 'integer',
|
||||
'format': 'int64'
|
||||
}
|
||||
else:
|
||||
schema = {
|
||||
'type': v2['type']
|
||||
@@ -231,7 +238,7 @@ def get_oas_30(cfg):
|
||||
'explode': False
|
||||
})
|
||||
|
||||
paths['{}/items/{{id}}'.format(collection_name_path)] = {
|
||||
paths['{}/items/{{featureId}}'.format(collection_name_path)] = {
|
||||
'get': {
|
||||
'summary': 'Get {} feature by id'.format(v['title']),
|
||||
'description': v['description'],
|
||||
@@ -374,6 +381,33 @@ def get_oas_30(cfg):
|
||||
'style': 'form',
|
||||
'explode': False
|
||||
},
|
||||
'bbox': {
|
||||
'name': 'bbox',
|
||||
'in': 'query',
|
||||
'description': 'The bbox parameter indicates the minimum bounding rectangle upon which to query the collection in WFS84 (minx, miny, maxx, maxy).', # noqa
|
||||
'required': False,
|
||||
'schema': {
|
||||
'type': 'array',
|
||||
'minItems': 4,
|
||||
'maxItems': 6,
|
||||
'items': {
|
||||
'type': 'number'
|
||||
}
|
||||
},
|
||||
'style': 'form',
|
||||
'explode': False
|
||||
},
|
||||
'datetime': {
|
||||
'name': 'datetime',
|
||||
'in': 'query',
|
||||
'description': 'The time parameter indicates an RFC3339 formatted datetime (single, interval, open).', # noqa
|
||||
'required': False,
|
||||
'schema': {
|
||||
'type': 'string'
|
||||
},
|
||||
'style': 'form',
|
||||
'explode': False,
|
||||
},
|
||||
'limit': {
|
||||
'name': 'limit',
|
||||
'in': 'query',
|
||||
@@ -443,5 +477,5 @@ def generate_openapi_document(ctx, config_file):
|
||||
if config_file is None:
|
||||
raise click.ClickException('--config/-c required')
|
||||
with open(config_file) as ff:
|
||||
s = yaml.load(ff)
|
||||
s = yaml.load(ff, Loader=yaml.FullLoader)
|
||||
click.echo(yaml.safe_dump(get_oas(s), default_flow_style=False))
|
||||
|
||||
@@ -238,7 +238,8 @@ class ElasticsearchProvider(BaseProvider):
|
||||
next(gen)
|
||||
except StopIteration:
|
||||
break
|
||||
results['hits']['total'] = len(results['hits']['hits'])
|
||||
results['hits']['total'] = \
|
||||
len(results['hits']['hits']) + startindex
|
||||
else:
|
||||
results = self.es.search(index=self.index_name,
|
||||
from_=startindex, size=limit,
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<script>
|
||||
var map = L.map('items-map').setView([{{ 45 }}, {{ -75 }}], 10);
|
||||
map.addLayer(new L.TileLayer(
|
||||
'http://tile.osm.org/{z}/{x}/{y}.png', {
|
||||
'https://tile.osm.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 18,
|
||||
subdomains: '1234'
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<tr>
|
||||
<th>id</th>
|
||||
{% for k, v in data['features'][0]['properties'].items() %}
|
||||
<th>{{ k }}</td>
|
||||
<td>{{ k }}</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -74,7 +74,7 @@
|
||||
<script>
|
||||
var map = L.map('items-map').setView([{{ 45 }}, {{ -75 }}], 5);
|
||||
map.addLayer(new L.TileLayer(
|
||||
'http://tile.osm.org/{z}/{x}/{y}.png', {
|
||||
'https://tile.osm.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 18,
|
||||
subdomains: '1234'
|
||||
}
|
||||
|
||||
+2
-2
@@ -58,13 +58,13 @@ def make_req_headers(**kwargs):
|
||||
@pytest.fixture()
|
||||
def config():
|
||||
with open(get_test_file_path('pygeoapi-test-config.yml')) as fh:
|
||||
return yaml.load(fh)
|
||||
return yaml.load(fh, Loader=yaml.FullLoader)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def openapi():
|
||||
with open(get_test_file_path('pygeoapi-test-openapi.yml')) as fh:
|
||||
return yaml.load(fh)
|
||||
return yaml.load(fh, Loader=yaml.FullLoader)
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
|
||||
Reference in New Issue
Block a user