Commit 5ab19a6e authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Changed optimade version to 1.0.0. #325

parent ba6656f4
Pipeline #78683 passed with stages
in 30 minutes and 36 seconds
......@@ -25,7 +25,7 @@ base_url = 'https://%s/%s/optimade' % (
config.services.api_base_path.strip('/'))
def url(endpoint: str = None, version='v0', prefix=None, **kwargs):
def url(endpoint: str = None, version='v1', prefix=None, **kwargs):
''' Returns the full optimade api url (for a given endpoint) including query parameters. '''
if endpoint is not None:
url = '/' + endpoint
......@@ -49,7 +49,7 @@ def url(endpoint: str = None, version='v0', prefix=None, **kwargs):
api = Api(
blueprint,
version='1.0', title='NOMAD\'s OPTiMaDe API implementation',
description='NOMAD\'s OPTiMaDe API implementation, version 0.10.1.',
description='NOMAD\'s OPTiMaDe API implementation, version 1.0.0.',
validate=True)
''' Provides the flask restplust api instance for the optimade api'''
......
......@@ -22,7 +22,7 @@ from nomad import search
from .api import api
ns = api.namespace('v0', description='The version v0 API namespace with all OPTiMaDe endpoints.')
ns = api.namespace('v1', description='The version v1 API namespace with all OPTiMaDe endpoints.')
# TODO replace with decorator that filters response_fields
......
......@@ -21,7 +21,7 @@ from .api import api, url
from .common import base_request_args
from .models import json_api_single_response_model, base_endpoint_parser, json_api_single_response_model, Meta, json_api_list_response_model
ns = api.namespace('index/v0', description='This is the OPTiMaDe index for NOMAD\' implementations.')
ns = api.namespace('index/v1', description='This is the OPTiMaDe index for NOMAD\' implementations.')
@ns.route('/info')
......@@ -38,10 +38,10 @@ class Info(Resource):
'type': 'info',
'id': '/',
'attributes': {
'api_version': '0.10.1',
'api_version': '1.0.0',
'available_api_versions': [{
'url': url(prefix='index'),
'version': '0.10.1'
'version': '1.0.0'
}],
'formats': ['json'],
'entry_types_by_format': {
......@@ -53,7 +53,7 @@ class Info(Resource):
'relationships': {
'default': {
'data': {
'id': 'v0',
'id': 'v1',
'type': 'links'
}
}
......@@ -79,7 +79,7 @@ class Links(Resource):
result = [
{
"type": "child",
"id": "v0",
"id": "v1",
"attributes": {
"name": config.meta.name,
"description": config.meta.description,
......
......@@ -37,10 +37,10 @@ class Info(Resource):
'type': 'info',
'id': '/',
'attributes': {
'api_version': '0.10.1',
'api_version': '1.0.0',
'available_api_versions': [{
'url': url(),
'version': '0.10.1'
'version': '1.0.0'
}],
'formats': ['json'],
'entry_types_by_format': {
......
......@@ -117,7 +117,7 @@ class Meta():
self, query: str, returned: int, available: int = None, last_id: str = None):
self.query = dict(representation=query)
self.api_version = '0.10.1'
self.api_version = '1.0.0'
self.time_stamp = datetime.datetime.now()
self.data_returned = returned
self.more_data_available = available > returned if available is not None else False
......
......@@ -26,12 +26,12 @@ from tests.conftest import clear_elastic, clear_raw_files
@pytest.fixture(scope='session')
def api(session_client):
return BlueprintClient(session_client, '/optimade/v0')
return BlueprintClient(session_client, '/optimade/v1')
@pytest.fixture(scope='session')
def index_api(session_client):
return BlueprintClient(session_client, '/optimade/index/v0')
return BlueprintClient(session_client, '/optimade/index/v1')
def test_index(index_api):
......@@ -156,7 +156,7 @@ def test_optimade_parser(example_structures, query, results):
def test_url():
assert url('endpoint', param='value').endswith('/optimade/v0/endpoint?param=value')
assert url('endpoint', param='value').endswith('/optimade/v1/endpoint?param=value')
def test_list_endpoint(api, example_structures):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment