Fix service-doc and service-desc inversion, and update media type of openapi+json (#270)
* Landing page: fix inversion of service-doc and service-desc service-desc should be for the OpenAPI version of /api, and service-doc for the HTML version See Abstract Test 40 of http://docs.opengeospatial.org/DRAFTS/17-069r3.html * Update media type for OpenAPI JSon 3.0
This commit is contained in:
committed by
Just van den Broecke
parent
6e504933cf
commit
3f88575648
+5
-4
@@ -142,12 +142,12 @@ class API(object):
|
||||
'href': '{}?f=html'.format(self.config['server']['url']),
|
||||
'hreflang': self.config['server']['language']
|
||||
}, {
|
||||
'rel': 'service-doc',
|
||||
'type': 'application/openapi+json;version=3.0',
|
||||
'rel': 'service-desc',
|
||||
'type': 'application/vnd.oai.openapi+json;version=3.0',
|
||||
'title': 'The OpenAPI definition as JSON',
|
||||
'href': '{}/api'.format(self.config['server']['url'])
|
||||
}, {
|
||||
'rel': 'service-desc',
|
||||
'rel': 'service-doc',
|
||||
'type': 'text/html',
|
||||
'title': 'The OpenAPI definition as HTML',
|
||||
'href': '{}/api?f=html'.format(self.config['server']['url']),
|
||||
@@ -208,7 +208,8 @@ class API(object):
|
||||
content = _render_j2_template(self.config, 'api.html', data)
|
||||
return headers_, 200, content
|
||||
|
||||
headers_['Content-Type'] = 'application/openapi+json;version=3.0'
|
||||
headers_['Content-Type'] = \
|
||||
'application/vnd.oai.openapi+json;version=3.0'
|
||||
|
||||
return headers_, 200, json.dumps(openapi)
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ def test_api(config, api_, openapi):
|
||||
req_headers = make_req_headers(HTTP_CONTENT_TYPE='application/json')
|
||||
rsp_headers, code, response = api_.api(req_headers, {}, openapi)
|
||||
assert rsp_headers['Content-Type'] ==\
|
||||
'application/openapi+json;version=3.0'
|
||||
'application/vnd.oai.openapi+json;version=3.0'
|
||||
root = json.loads(response)
|
||||
|
||||
assert isinstance(root, dict)
|
||||
|
||||
Reference in New Issue
Block a user