From b4fdd28c7fb162d3287c6fa32ec360834f090b86 Mon Sep 17 00:00:00 2001 From: Johan Bergsma <29785380+JPBergsma@users.noreply.github.com> Date: Fri, 26 Aug 2022 13:16:24 +0200 Subject: [PATCH 1/8] Added model for files endpoint. --- docs/api_reference/models/files.md | 5 + docs/api_reference/server/mappers/files.md | 3 + docs/api_reference/server/routers/files.md | 3 + optimade/models/__init__.py | 22 +- optimade/models/files.py | 232 +++++++++++++++++++++ optimade/models/responses.py | 17 ++ optimade/server/config.py | 4 + optimade/server/data/__init__.py | 1 + optimade/server/data/test_files.json | 4 + optimade/server/mappers/__init__.py | 2 + optimade/server/mappers/files.py | 9 + optimade/server/routers/__init__.py | 2 + optimade/server/routers/files.py | 58 ++++++ 13 files changed, 352 insertions(+), 10 deletions(-) create mode 100644 docs/api_reference/models/files.md create mode 100644 docs/api_reference/server/mappers/files.md create mode 100644 docs/api_reference/server/routers/files.md create mode 100644 optimade/models/files.py create mode 100644 optimade/server/data/test_files.json create mode 100644 optimade/server/mappers/files.py create mode 100644 optimade/server/routers/files.py diff --git a/docs/api_reference/models/files.md b/docs/api_reference/models/files.md new file mode 100644 index 000000000..e60e4ad6b --- /dev/null +++ b/docs/api_reference/models/files.md @@ -0,0 +1,5 @@ +# files + +::: optimade.models.files + options: + show_if_no_docstring: true diff --git a/docs/api_reference/server/mappers/files.md b/docs/api_reference/server/mappers/files.md new file mode 100644 index 000000000..75d3c94f2 --- /dev/null +++ b/docs/api_reference/server/mappers/files.md @@ -0,0 +1,3 @@ +# files + +::: optimade.server.mappers.files diff --git a/docs/api_reference/server/routers/files.md b/docs/api_reference/server/routers/files.md new file mode 100644 index 000000000..a987dfb69 --- /dev/null +++ b/docs/api_reference/server/routers/files.md @@ -0,0 +1,3 @@ +# files + +::: optimade.server.routers.files diff --git a/optimade/models/__init__.py b/optimade/models/__init__.py index 018560412..aecd1a6a7 100644 --- a/optimade/models/__init__.py +++ b/optimade/models/__init__.py @@ -8,17 +8,19 @@ from .references import * # noqa: F403 from .responses import * # noqa: F403 from .structures import * # noqa: F403 +from .files import * # noqa: F403 from .utils import * # noqa: F403 __all__ = ( - jsonapi.__all__ # type: ignore[name-defined] # noqa: F405 - + utils.__all__ # type: ignore[name-defined] # noqa: F405 - + baseinfo.__all__ # type: ignore[name-defined] # noqa: F405 - + entries.__all__ # type: ignore[name-defined] # noqa: F405 - + index_metadb.__all__ # type: ignore[name-defined] # noqa: F405 - + links.__all__ # type: ignore[name-defined] # noqa: F405 - + optimade_json.__all__ # type: ignore[name-defined] # noqa: F405 - + references.__all__ # type: ignore[name-defined] # noqa: F405 - + responses.__all__ # type: ignore[name-defined] # noqa: F405 - + structures.__all__ # type: ignore[name-defined] # noqa: F405 + jsonapi.__all__ # noqa: F405 + + utils.__all__ # noqa: F405 + + baseinfo.__all__ # noqa: F405 + + entries.__all__ # noqa: F405 + + index_metadb.__all__ # noqa: F405 + + links.__all__ # noqa: F405 + + optimade_json.__all__ # noqa: F405 + + references.__all__ # noqa: F405 + + responses.__all__ # noqa: F405 + + structures.__all__ # noqa: F405 + + files.__all__ # noqa: F405 ) diff --git a/optimade/models/files.py b/optimade/models/files.py new file mode 100644 index 000000000..96bf4b09c --- /dev/null +++ b/optimade/models/files.py @@ -0,0 +1,232 @@ +# pylint: disable=no-self-argument,line-too-long,no-name-in-module +from datetime import datetime +from typing import Optional, Dict +from optimade.models.entries import EntryResourceAttributes, EntryResource +from optimade.models.utils import ( + OptimadeField, + StrictField, + SupportLevel, +) + + +__all__ = ( + "FileResourceAttributes", + "FileResource", +) + + +CORRELATED_FILE_FIELDS = ( + {}, + {}, +) + + +class FileResourceAttributes(EntryResourceAttributes): + """This class contains the Field for the attributes used to represent a file, e.g. .""" + + url: str = OptimadeField( + ..., + description="""The URL to get the contents of a file. +- **Type**: string +- **Requirements/Conventions**: + + - **Support**: MUST be supported by all implementations, MUST NOT be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + - **Response**: REQUIRED in the response. + - The URL MUST point to the actual contents of a file (i.e. byte stream), not an intermediate (preview) representation. + For example, if referring to a file on GitHub, a link should point to raw contents. + +- **Examples**: + + - :val:`"https://example.org/files/cifs/1000000.cif"` +""", + support=SupportLevel.MUST, + queryable=SupportLevel.OPTIONAL, + ) + + url_stable_until: Optional[datetime] = OptimadeField( + ..., + description="""Point in time until which the URL in `url` is guaranteed to stay stable. +- **Type**: timestamp +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + - :val:`null` means that there is no stability guarantee for the URL in `url`. + Indefinite support could be communicated by providing a date sufficiently far in the future, for example, :val:`9999-12-31`.""", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + name: str = OptimadeField( + ..., + description="""Base name of a file. +- **Type**: string +- **Requirements/Conventions**: + + - **Support**: MUST be supported by all implementations, MUST NOT be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + - File name extension is an integral part of a file name and, if available, MUST be included. + +- **Examples**: + + - :val:`"1000000.cif"`""", + support=SupportLevel.MUST, + queryable=SupportLevel.OPTIONAL, + ) + + size: Optional[int] = OptimadeField( + ..., + description="""Size of a file in bytes. +- **Type**: integer +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + - If provided, it MUST be guaranteed that either exact size of a file is given or its upper bound. + This way if a client reserves a static buffer or truncates the download stream after this many bytes the whole file would be received. + Such provision is included to allow the providers to serve on-the-fly compressed files.""", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + media_type: Optional[str] = OptimadeField( + ..., + description="""Media type identifier (also known as MIME type), for a file as per `RFC 6838 Media Type Specifications and Registration Procedures `__. +- **Type**: string +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + +- **Examples**: + + - :val:`"chemical/x-cif"`""", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + version: Optional[str] = OptimadeField( + None, + description="""Version information of a file (e.g. commit, revision, timestamp). +- **Type**: string +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + - If provided, it MUST be guaranteed that file contents pertaining to the same combination of :field:`id` and :field:`version` are the same""", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + modification_timestamp: Optional[datetime] = OptimadeField( + ..., + description="""Timestamp of the last modification of file contents. + A modification is understood as an addition, change or deletion of one or more bytes, resulting in file contents different from the previous. +- **Type**: timestamp +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + - Timestamps of subsequent file modifications SHOULD be increasing (not earlier than previous timestamps).""", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + description: Optional[str] = OptimadeField( + ..., + description="""Free-form description of a file. +- **Type**: string +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + +- **Examples**: + + - :val:`"POSCAR format file"`""", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + checksums: Optional[Dict[str, str]] = OptimadeField( + ..., + description="""Dictionary providing checksums of file contents. +* **Type**: dictionary with keys identifying checksum functions and values (strings) giving the actual checksums +* **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + - Supported dictionary keys: :property:`md5`, :property:`sha1`, :property:`sha224`, :property:`sha256`, :property:`sha384`, :property:`sha512`. + Checksums outside this list MAY be used, but their names MUST be prefixed by database-provider-specific namespace prefix (see appendix `Database-Provider-Specific Namespace Prefixes`_). +""", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + atime: Optional[datetime] = OptimadeField( + ..., + description="""Time of last access of a file as per POSIX standard. +- **Type**: timestamp +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL.""", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + ctime: Optional[datetime] = OptimadeField( + ..., + description="""Time of last status change of a file as per POSIX standard. +- **Type**: timestamp +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL.""", + unit="Å", + support=SupportLevel.OPTIONAL, + queryable=SupportLevel.OPTIONAL, + ) + + mtime: Optional[datetime] = OptimadeField( + ..., + description=""" Time of last modification of a file as per POSIX standard. +- **Type**: timestamp +- **Requirements/Conventions**: + + - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`. + - **Query**: Support for queries on this property is OPTIONAL. + - It should be noted that the values of :field:`last_modified`, :field:`modification_timestamp` and :field:`mtime` do not necessary match. + :field:`last_modified` pertains to the modification of the OPTIMADE metadata, :field:`modification_timestamp` pertains to file contents and :field:`mtime` pertains to the modification of the file (not necessary changing its contents). + For example, appending an empty string to a file would result in the change of :field:`mtime` in some operating systems, but this would not be deemed as a modification of its contents. +""", + queryable=SupportLevel.OPTIONAL, + support=SupportLevel.OPTIONAL, + ) + + +class FileResource(EntryResource): + """Representing a structure.""" + + type: str = StrictField( + "files", + description="""The name of the type of an entry. + +- **Type**: string. + +- **Requirements/Conventions**: + - **Support**: MUST be supported by all implementations, MUST NOT be `null`. + - **Query**: MUST be a queryable property with support for all mandatory filter features. + - **Response**: REQUIRED in the response. + - MUST be an existing entry type. + - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL. + +- **Examples**: + - `"structures"`""", + regex="^files$", + support=SupportLevel.MUST, + queryable=SupportLevel.MUST, + ) + + attributes: FileResourceAttributes diff --git a/optimade/models/responses.py b/optimade/models/responses.py index 01845dc82..da8622a33 100644 --- a/optimade/models/responses.py +++ b/optimade/models/responses.py @@ -11,6 +11,7 @@ from optimade.models.optimade_json import OptimadeError, ResponseMeta, Success from optimade.models.references import ReferenceResource from optimade.models.structures import StructureResource +from optimade.models.files import FileResource from optimade.models.utils import StrictField __all__ = ( @@ -23,6 +24,8 @@ "EntryResponseMany", "StructureResponseOne", "StructureResponseMany", + "FileResponseOne", + "FileResponseMany", "ReferenceResponseOne", "ReferenceResponseMany", ) @@ -103,6 +106,20 @@ class StructureResponseMany(EntryResponseMany): ) +class FileResponseOne(EntryResponseOne): + data: Union[FileResource, Dict[str, Any], None] = StrictField( + ..., description="A single files entry resource." + ) + + +class FileResponseMany(EntryResponseMany): + data: Union[List[FileResource], List[Dict[str, Any]]] = StrictField( + ..., + description="List of unique OPTIMADE files entry resource objects.", + uniqueItems=True, + ) + + class ReferenceResponseOne(EntryResponseOne): data: Union[ReferenceResource, Dict[str, Any], None] = StrictField( ..., description="A single references entry resource." diff --git a/optimade/server/config.py b/optimade/server/config.py index f763c336d..d942397ac 100644 --- a/optimade/server/config.py +++ b/optimade/server/config.py @@ -172,6 +172,10 @@ class ServerConfig(BaseSettings): "structures", description="Mongo collection name for /structures endpoint resources", ) + files_collection: str = Field( + "files", + description="Mongo collection name for /files endpoint resources", + ) page_limit: int = Field(20, description="Default number of resources per page") page_limit_max: int = Field( 500, description="Max allowed number of resources per page" diff --git a/optimade/server/data/__init__.py b/optimade/server/data/__init__.py index 87060d387..e6e90a7d6 100644 --- a/optimade/server/data/__init__.py +++ b/optimade/server/data/__init__.py @@ -7,6 +7,7 @@ "structures": "test_structures.json", "references": "test_references.json", "links": "test_links.json", + "files": "test_files.json", "providers": "providers.json", } diff --git a/optimade/server/data/test_files.json b/optimade/server/data/test_files.json new file mode 100644 index 000000000..f56b9db21 --- /dev/null +++ b/optimade/server/data/test_files.json @@ -0,0 +1,4 @@ +[{"url": "www.example.com/file001.pdb", "name": "file001.pdb", "size": 12536, "media_type": "chemical/x-pdb","modification_timestamp": { + "$date": "2022-08-26T13:09:37.945Z" + } +}] diff --git a/optimade/server/mappers/__init__.py b/optimade/server/mappers/__init__.py index c38e6ccd0..27d0e8e44 100644 --- a/optimade/server/mappers/__init__.py +++ b/optimade/server/mappers/__init__.py @@ -3,10 +3,12 @@ from .links import * # noqa: F403 from .references import * # noqa: F403 from .structures import * # noqa: F403 +from .files import * # noqa: F403 __all__ = ( entries.__all__ # type: ignore[name-defined] # noqa: F405 + links.__all__ # type: ignore[name-defined] # noqa: F405 + references.__all__ # type: ignore[name-defined] # noqa: F405 + structures.__all__ # type: ignore[name-defined] # noqa: F405 + + files.__all__ # noqa: F405 ) diff --git a/optimade/server/mappers/files.py b/optimade/server/mappers/files.py new file mode 100644 index 000000000..29b80df6a --- /dev/null +++ b/optimade/server/mappers/files.py @@ -0,0 +1,9 @@ +from optimade.server.mappers.entries import BaseResourceMapper +from optimade.models.files import FileResource + +__all__ = ("FileMapper",) + + +class FileMapper(BaseResourceMapper): + + ENTRY_RESOURCE_CLASS = FileResource diff --git a/optimade/server/routers/__init__.py b/optimade/server/routers/__init__.py index 266518dbe..3c74f8bf2 100644 --- a/optimade/server/routers/__init__.py +++ b/optimade/server/routers/__init__.py @@ -1,9 +1,11 @@ from .links import links_coll from .references import references_coll from .structures import structures_coll +from .files import files_coll ENTRY_COLLECTIONS = { "links": links_coll, "references": references_coll, "structures": structures_coll, + "files": files_coll, } diff --git a/optimade/server/routers/files.py b/optimade/server/routers/files.py new file mode 100644 index 000000000..3a5846f3d --- /dev/null +++ b/optimade/server/routers/files.py @@ -0,0 +1,58 @@ +from fastapi import APIRouter, Depends, Request + +from optimade.models import ( + FileResource, + FileResponseMany, + FileResponseOne, +) +from optimade.server.config import CONFIG +from optimade.server.entry_collections import create_collection +from optimade.server.mappers import FileMapper +from optimade.server.query_params import EntryListingQueryParams, SingleEntryQueryParams +from optimade.server.routers.utils import get_entries, get_single_entry +from optimade.server.schemas import ERROR_RESPONSES + +router = APIRouter(redirect_slashes=True) + +files_coll = create_collection( + name=CONFIG.files_collection, + resource_cls=FileResource, + resource_mapper=FileMapper, +) + + +@router.get( + "/files", + response_model=FileResponseMany, + response_model_exclude_unset=True, + tags=["Files"], + responses=ERROR_RESPONSES, +) +def get_files( + request: Request, params: EntryListingQueryParams = Depends() +) -> FileResponseMany: + return get_entries( + collection=files_coll, + response=FileResponseMany, + request=request, + params=params, + ) + + +@router.get( + "/files/{entry_id:path}", + response_model=FileResponseOne, + response_model_exclude_unset=True, + tags=["Files"], + responses=ERROR_RESPONSES, +) +def get_single_file( + request: Request, entry_id: str, params: SingleEntryQueryParams = Depends() +) -> FileResponseOne: + return get_single_entry( + collection=files_coll, + entry_id=entry_id, + response=FileResponseOne, + request=request, + params=params, + ) From 34a428550bfec4fbe30fcf278348f9c4b3006f61 Mon Sep 17 00:00:00 2001 From: Johan Bergsma <29785380+JPBergsma@users.noreply.github.com> Date: Fri, 2 Sep 2022 19:06:15 +0200 Subject: [PATCH 2/8] Storing intermediate code state in implementing the files endpoint. --- optimade/server/config.py | 4 +- .../test_entry_collections.py | 2 + tests/server/routers/test_files.py | 221 ++++++++++++++++++ 3 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 tests/server/routers/test_files.py diff --git a/optimade/server/config.py b/optimade/server/config.py index d942397ac..3afa98fe9 100644 --- a/optimade/server/config.py +++ b/optimade/server/config.py @@ -232,7 +232,9 @@ class ServerConfig(BaseSettings): "broken down by endpoint." ), ) - aliases: Dict[Literal["links", "references", "structures"], Dict[str, str]] = Field( + aliases: Dict[ + Literal["links", "references", "structures", "files"], Dict[str, str] + ] = Field( {}, description=( "A mapping between field names in the database with their corresponding OPTIMADE field" diff --git a/tests/server/entry_collections/test_entry_collections.py b/tests/server/entry_collections/test_entry_collections.py index a5f537698..de820429b 100644 --- a/tests/server/entry_collections/test_entry_collections.py +++ b/tests/server/entry_collections/test_entry_collections.py @@ -7,6 +7,7 @@ def test_get_attribute_fields(): LinksResourceAttributes, ReferenceResourceAttributes, StructureResourceAttributes, + FileResourceAttributes, ) from optimade.server.routers import ENTRY_COLLECTIONS @@ -14,6 +15,7 @@ def test_get_attribute_fields(): "links": LinksResourceAttributes, "references": ReferenceResourceAttributes, "structures": StructureResourceAttributes, + "files": FileResourceAttributes, } # Make sure we're hitting all collections diff --git a/tests/server/routers/test_files.py b/tests/server/routers/test_files.py new file mode 100644 index 000000000..406a05446 --- /dev/null +++ b/tests/server/routers/test_files.py @@ -0,0 +1,221 @@ +from optimade.models import ( + FileResponseMany, + # FileResponseOne, + # FileResource, +) + +from ..utils import RegularEndpointTests + + +class TestFilesEndpoint(RegularEndpointTests): + """Tests for /structures""" + + request_str = "/files" + response_cls = FileResponseMany + + def test_files_endpoint_data(self): + """Check known properties/attributes for successful response""" + assert "meta" in self.json_response + assert self.json_response["meta"]["data_available"] == 17 + assert not self.json_response["meta"]["more_data_available"] + assert "data" in self.json_response + assert ( + len(self.json_response["data"]) + == self.json_response["meta"]["data_available"] + ) + + +# def test_get_next_responses(self, get_good_response): +# """Check pagination""" +# total_data = self.json_response["meta"]["data_available"] +# page_limit = 5 +# +# json_response = get_good_response( +# self.request_str + f"?page_limit={page_limit}" +# ) +# +# cursor = json_response["data"].copy() +# assert json_response["meta"]["more_data_available"] +# assert json_response["meta"]["data_returned"] == total_data +# more_data_available = True +# next_request = json_response["links"]["next"] +# +# while more_data_available: +# next_response = get_good_response(next_request) +# assert next_response["meta"]["data_returned"] == total_data +# next_request = next_response["links"]["next"] +# cursor.extend(next_response["data"]) +# more_data_available = next_response["meta"]["more_data_available"] +# if more_data_available: +# assert len(next_response["data"]) == page_limit +# else: +# assert len(next_response["data"]) == total_data % page_limit +# +# assert len(cursor) == total_data +# +# +# class TestSingleFileeEndpoint(RegularEndpointTests): +# """Tests for /files/""" +# +# test_id = "mpf_1" +# request_str = f"/files/{test_id}" +# response_cls = FileResponseOne +# +# def test_structures_endpoint_data(self): +# """Check known properties/attributes for successful response""" +# assert "data" in self.json_response +# assert self.json_response["data"]["id"] == self.test_id +# assert self.json_response["data"]["type"] == "structures" +# assert "attributes" in self.json_response["data"] +# assert "_exmpl_chemsys" in self.json_response["data"]["attributes"] +# +# +# def test_check_response_single_structure(check_response): +# """Tests whether check_response also handles single endpoint queries correctly.""" +# +# test_id = "mpf_1" +# expected_ids = "mpf_1" +# request = f"/files/{test_id}?response_fields=name" +# check_response(request, expected_ids=expected_ids) +# +# +# class TestMissingSingleStructureEndpoint(RegularEndpointTests): +# """Tests for /structures/ for unknown """ +# +# test_id = "mpf_random_string_that_is_not_in_test_data" +# request_str = f"/structures/{test_id}" +# response_cls = StructureResponseOne +# +# def test_structures_endpoint_data(self): +# """Check known properties/attributes for successful response""" +# assert "data" in self.json_response +# assert "meta" in self.json_response +# assert self.json_response["data"] is None +# assert self.json_response["meta"]["data_returned"] == 0 +# assert not self.json_response["meta"]["more_data_available"] +# +# +# class TestSingleStructureWithRelationships(RegularEndpointTests): +# """Tests for /structures/, where has relationships""" +# +# test_id = "mpf_1" +# request_str = f"/structures/{test_id}" +# response_cls = StructureResponseOne +# +# def test_structures_endpoint_data(self): +# """Check known properties/attributes for successful response""" +# assert "data" in self.json_response +# assert self.json_response["data"]["id"] == self.test_id +# assert self.json_response["data"]["type"] == "structures" +# assert "attributes" in self.json_response["data"] +# assert "relationships" in self.json_response["data"] +# assert self.json_response["data"]["relationships"] == { +# "references": {"data": [{"type": "references", "id": "dijkstra1968"}]} +# } +# assert "included" in self.json_response +# assert len( +# self.json_response["data"]["relationships"]["references"]["data"] +# ) == len(self.json_response["included"]) +# +# ReferenceResource(**self.json_response["included"][0]) +# +# +# class TestMultiStructureWithSharedRelationships(RegularEndpointTests): +# """Tests for /structures for entries with shared relationships""" +# +# request_str = '/structures?filter=id="mpf_1" OR id="mpf_2"' +# response_cls = StructureResponseMany +# +# def test_structures_endpoint_data(self): +# """Check known properties/attributes for successful response""" +# # mpf_1 and mpf_2 both contain the same reference relationship, so response should not duplicate it +# assert "data" in self.json_response +# assert len(self.json_response["data"]) == 2 +# assert "included" in self.json_response +# assert len(self.json_response["included"]) == 1 +# +# +# class TestMultiStructureWithRelationships(RegularEndpointTests): +# """Tests for /structures for mixed entries with and without relationships""" +# +# request_str = '/structures?filter=id="mpf_1" OR id="mpf_23"' +# response_cls = StructureResponseMany +# +# def test_structures_endpoint_data(self): +# """Check known properties/attributes for successful response""" +# # mpf_23 contains no relationships, which shouldn't break anything +# assert "data" in self.json_response +# assert len(self.json_response["data"]) == 2 +# assert "included" in self.json_response +# assert len(self.json_response["included"]) == 1 +# +# +# class TestMultiStructureWithOverlappingRelationships(RegularEndpointTests): +# """Tests for /structures with entries with overlapping relationships +# +# One entry has multiple relationships, another entry has other relationships, +# some of these relationships overlap between the entries, others don't. +# """ +# +# request_str = '/structures?filter=id="mpf_1" OR id="mpf_3"' +# response_cls = StructureResponseMany +# +# def test_structures_endpoint_data(self): +# """Check known properties/attributes for successful response""" +# assert "data" in self.json_response +# assert len(self.json_response["data"]) == 2 +# assert "included" in self.json_response +# assert len(self.json_response["included"]) == 2 +# +# +# class TestStructuresWithNullFieldsDoNotMatchNegatedFilters(RegularEndpointTests): +# """Tests that structures with e.g., `'assemblies':null` do not get +# returned for negated queries like `filter=assemblies != 1`, as mandated +# by the specification. +# +# """ +# +# request_str = "/structures?filter=assemblies != 1" +# response_cls = StructureResponseMany +# +# def test_structures_endpoint_data(self): +# """Check that no structures are returned.""" +# assert len(self.json_response["data"]) == 0 +# +# +# class TestStructuresWithNullFieldsMatchUnknownFilter(RegularEndpointTests): +# """Tests that structures with e.g., `'assemblies':null` do get +# returned for queries testing for "UNKNOWN" fields. +# +# """ +# +# request_str = "/structures?filter=assemblies IS UNKNOWN" +# response_cls = StructureResponseMany +# +# def test_structures_endpoint_data(self): +# """Check that all structures are returned.""" +# assert len(self.json_response["data"]) == 17 +# +# +# class TestStructuresWithUnknownResponseFields(RegularEndpointTests): +# """Tests that structures with e.g., `'assemblies':null` do get +# returned for queries testing for "UNKNOWN" fields. +# +# """ +# +# request_str = "/structures?filter=assemblies IS UNKNOWN&response_fields=assemblies,_other_provider_field,chemical_formula_anonymous" +# response_cls = StructureResponseMany +# +# def test_structures_endpoint_data(self): +# """Check that all structures are returned.""" +# assert len(self.json_response["data"]) == 17 +# keys = ("_other_provider_field", "assemblies", "chemical_formula_anonymous") +# for key in keys: +# assert all(key in doc["attributes"] for doc in self.json_response["data"]) +# assert all( +# doc["attributes"]["_other_provider_field"] is None +# for doc in self.json_response["data"] +# ) +# assert all( +# len(doc["attributes"]) == len(keys) for doc in self.json_response["data"] +# ) From 857555d73aec3ca12603326dcf49b51e9d02a048 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 6 Dec 2022 15:34:49 +0000 Subject: [PATCH 3/8] Re-render OpenAPI specs --- openapi/index_openapi.json | 20 +-- openapi/openapi.json | 268 ++++++++++++++++++------------------- 2 files changed, 144 insertions(+), 144 deletions(-) diff --git a/openapi/index_openapi.json b/openapi/index_openapi.json index 38b883057..0965fff7d 100644 --- a/openapi/index_openapi.json +++ b/openapi/index_openapi.json @@ -509,15 +509,15 @@ "title": "Id", "type": "string", "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "type": { "title": "Type", "type": "string", "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Example**: `\"structures\"`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "links": { "title": "Links", @@ -569,16 +569,16 @@ "title": "Immutable Id", "type": "string", "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", - "x-optimade-queryable": "must", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "must" }, "last_modified": { "title": "Last Modified", "type": "string", "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", "format": "date-time", - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" } }, "description": "Contains key-value pairs representing the entry's properties." @@ -1118,8 +1118,8 @@ "title": "Id", "type": "string", "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "type": { "title": "Type", diff --git a/openapi/openapi.json b/openapi/openapi.json index 918a2965c..b6625003e 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -1353,8 +1353,8 @@ } }, "description": "Index of the sites (0-based) that belong to each group for each assembly.\n\n- **Examples**:\n - `[[1], [2]]`: two groups, one with the second site, one with the third.\n - `[[1,2], [3]]`: one group with the second and third site, one with the fourth.", - "x-optimade-queryable": "optional", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "optional" }, "group_probabilities": { "title": "Group Probabilities", @@ -1363,8 +1363,8 @@ "type": "number" }, "description": "Statistical probability of each group. It MUST have the same length as `sites_in_groups`.\nIt SHOULD sum to one.\nSee below for examples of how to specify the probability of the occurrence of a vacancy.\nThe possible reasons for the values not to sum to one are the same as already specified above for the `concentration` of each `species`.", - "x-optimade-queryable": "optional", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "optional" } }, "description": "A description of groups of sites that are statistically correlated.\n\n- **Examples** (for each entry of the assemblies list):\n - `{\"sites_in_groups\": [[0], [1]], \"group_probabilities: [0.3, 0.7]}`: the first site and the second site never occur at the same time in the unit cell.\n Statistically, 30 % of the times the first site is present, while 70 % of the times the second site is present.\n - `{\"sites_in_groups\": [[1,2], [3]], \"group_probabilities: [0.3, 0.7]}`: the second and third site are either present together or not present; they form the first group of atoms for this assembly.\n The second group is formed by the fourth site. Sites of the first group (the second and the third) are never present at the same time as the fourth site.\n 30 % of times sites 1 and 2 are present (and site 3 is absent); 70 % of times site 3 is present (and sites 1 and 2 are absent)." @@ -1767,15 +1767,15 @@ "title": "Id", "type": "string", "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "type": { "title": "Type", "type": "string", "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Example**: `\"structures\"`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "links": { "title": "Links", @@ -1827,16 +1827,16 @@ "title": "Immutable Id", "type": "string", "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", - "x-optimade-queryable": "must", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "must" }, "last_modified": { "title": "Last Modified", "type": "string", "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", "format": "date-time", - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" } }, "description": "Contains key-value pairs representing the entry's properties." @@ -2235,8 +2235,8 @@ "title": "Id", "type": "string", "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "type": { "title": "Type", @@ -2534,22 +2534,22 @@ "title": "Name", "type": "string", "description": "Full name of the person, REQUIRED.", - "x-optimade-queryable": "optional", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "optional" }, "firstname": { "title": "Firstname", "type": "string", "description": "First name of the person.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "lastname": { "title": "Lastname", "type": "string", "description": "Last name of the person.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" } }, "description": "A person, i.e., an author, editor or other." @@ -2651,8 +2651,8 @@ "title": "Id", "type": "string", "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "type": { "title": "Type", @@ -2660,8 +2660,8 @@ "type": "string", "description": "The name of the type of an entry.\n- **Type**: string.\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type and ID MUST be returned in response to a request for `//` under the versioned base URL.\n- **Example**: `\"structures\"`", "default": "references", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "links": { "title": "Links", @@ -2707,16 +2707,16 @@ "title": "Immutable Id", "type": "string", "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", - "x-optimade-queryable": "must", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "must" }, "last_modified": { "title": "Last Modified", "type": "string", "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", "format": "date-time", - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "authors": { "title": "Authors", @@ -2725,8 +2725,8 @@ "$ref": "#/components/schemas/Person" }, "description": "List of person objects containing the authors of the reference.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "editors": { "title": "Editors", @@ -2735,15 +2735,15 @@ "$ref": "#/components/schemas/Person" }, "description": "List of person objects containing the editors of the reference.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "doi": { "title": "Doi", "type": "string", "description": "The digital object identifier of the reference.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "url": { "title": "Url", @@ -2752,162 +2752,162 @@ "type": "string", "description": "The URL of the reference.", "format": "uri", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "address": { "title": "Address", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "annote": { "title": "Annote", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "booktitle": { "title": "Booktitle", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "chapter": { "title": "Chapter", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "crossref": { "title": "Crossref", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "edition": { "title": "Edition", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "howpublished": { "title": "Howpublished", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "institution": { "title": "Institution", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "journal": { "title": "Journal", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "key": { "title": "Key", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "month": { "title": "Month", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "note": { "title": "Note", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "number": { "title": "Number", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "organization": { "title": "Organization", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "pages": { "title": "Pages", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "publisher": { "title": "Publisher", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "school": { "title": "School", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "series": { "title": "Series", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "title": { "title": "Title", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "bib_type": { "title": "Bib Type", "type": "string", "description": "Type of the reference, corresponding to the **type** property in the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "volume": { "title": "Volume", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "year": { "title": "Year", "type": "string", "description": "Meaning of property matches the BiBTeX specification.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" } }, "description": "Model that stores the attributes of a reference.\n\nMany properties match the meaning described in the\n[BibTeX specification](http://bibtexml.sourceforge.net/btxdoc.pdf)." @@ -3329,8 +3329,8 @@ "title": "Name", "type": "string", "description": "Gives the name of the species; the **name** value MUST be unique in the `species` list.", - "x-optimade-queryable": "optional", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "optional" }, "chemical_symbols": { "title": "Chemical Symbols", @@ -3339,8 +3339,8 @@ "type": "string" }, "description": "MUST be a list of strings of all chemical elements composing this species. Each item of the list MUST be one of the following:\n\n- a valid chemical-element symbol, or\n- the special value `\"X\"` to represent a non-chemical element, or\n- the special value `\"vacancy\"` to represent that this site has a non-zero probability of having a vacancy (the respective probability is indicated in the `concentration` list, see below).\n\nIf any one entry in the `species` list has a `chemical_symbols` list that is longer than 1 element, the correct flag MUST be set in the list `structure_features`.", - "x-optimade-queryable": "optional", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "optional" }, "concentration": { "title": "Concentration", @@ -3349,8 +3349,8 @@ "type": "number" }, "description": "MUST be a list of floats, with same length as `chemical_symbols`. The numbers represent the relative concentration of the corresponding chemical symbol in this species. The numbers SHOULD sum to one. Cases in which the numbers do not sum to one typically fall only in the following two categories:\n\n- Numerical errors when representing float numbers in fixed precision, e.g. for two chemical symbols with concentrations `1/3` and `2/3`, the concentration might look something like `[0.33333333333, 0.66666666666]`. If the client is aware that the sum is not one because of numerical precision, it can renormalize the values so that the sum is exactly one.\n- Experimental errors in the data present in the database. In this case, it is the responsibility of the client to decide how to process the data.\n\nNote that concentrations are uncorrelated between different site (even of the same species).", - "x-optimade-queryable": "optional", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "optional" }, "mass": { "title": "Mass", @@ -3359,16 +3359,16 @@ "type": "number" }, "description": "If present MUST be a list of floats expressed in a.m.u.\nElements denoting vacancies MUST have masses equal to 0.", - "x-optimade-queryable": "optional", + "x-optimade-unit": "a.m.u.", "x-optimade-support": "optional", - "x-optimade-unit": "a.m.u." + "x-optimade-queryable": "optional" }, "original_name": { "title": "Original Name", "type": "string", "description": "Can be any valid Unicode string, and SHOULD contain (if specified) the name of the species that is used internally in the source database.\n\nNote: With regards to \"source database\", we refer to the immediate source being queried via the OPTIMADE API implementation.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "attached": { "title": "Attached", @@ -3377,8 +3377,8 @@ "type": "string" }, "description": "If provided MUST be a list of length 1 or more of strings of chemical symbols for the elements attached to this site, or \"X\" for a non-chemical element.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "nattached": { "title": "Nattached", @@ -3387,8 +3387,8 @@ "type": "integer" }, "description": "If provided MUST be a list of length 1 or more of integers indicating the number of attached atoms of the kind specified in the value of the :field:`attached` key.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" } }, "description": "A list describing the species of the sites of this structure.\n\nSpecies can represent pure chemical elements, virtual-crystal atoms representing a\nstatistical occupation of a given site by multiple chemical elements, and/or a\nlocation to which there are attached atoms, i.e., atoms whose precise location are\nunknown beyond that they are attached to that position (frequently used to indicate\nhydrogen atoms attached to another element, e.g., a carbon with three attached\nhydrogens might represent a methyl group, -CH3).\n\n- **Examples**:\n - `[ {\"name\": \"Ti\", \"chemical_symbols\": [\"Ti\"], \"concentration\": [1.0]} ]`: any site with this species is occupied by a Ti atom.\n - `[ {\"name\": \"Ti\", \"chemical_symbols\": [\"Ti\", \"vacancy\"], \"concentration\": [0.9, 0.1]} ]`: any site with this species is occupied by a Ti atom with 90 % probability, and has a vacancy with 10 % probability.\n - `[ {\"name\": \"BaCa\", \"chemical_symbols\": [\"vacancy\", \"Ba\", \"Ca\"], \"concentration\": [0.05, 0.45, 0.5], \"mass\": [0.0, 137.327, 40.078]} ]`: any site with this species is occupied by a Ba atom with 45 % probability, a Ca atom with 50 % probability, and by a vacancy with 5 % probability. The mass of this site is (on average) 88.5 a.m.u.\n - `[ {\"name\": \"C12\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"mass\": [12.0]} ]`: any site with this species is occupied by a carbon isotope with mass 12.\n - `[ {\"name\": \"C13\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"mass\": [13.0]} ]`: any site with this species is occupied by a carbon isotope with mass 13.\n - `[ {\"name\": \"CH3\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"attached\": [\"H\"], \"nattached\": [3]} ]`: any site with this species is occupied by a methyl group, -CH3, which is represented without specifying precise positions of the hydrogen atoms." @@ -3457,8 +3457,8 @@ "title": "Id", "type": "string", "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "type": { "title": "Type", @@ -3466,8 +3466,8 @@ "type": "string", "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Examples**:\n - `\"structures\"`", "default": "structures", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" }, "links": { "title": "Links", @@ -3527,8 +3527,8 @@ "title": "Immutable Id", "type": "string", "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", - "x-optimade-queryable": "must", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "must" }, "last_modified": { "title": "Last Modified", @@ -3536,8 +3536,8 @@ "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", "format": "date-time", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "elements": { "title": "Elements", @@ -3547,16 +3547,16 @@ }, "description": "The chemical symbols of the different elements present in the structure.\n\n- **Type**: list of strings.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - The strings are the chemical symbols, i.e., either a single uppercase letter or an uppercase letter followed by a number of lowercase letters.\n - The order MUST be alphabetical.\n - MUST refer to the same elements in the same order, and therefore be of the same length, as `elements_ratios`, if the latter is provided.\n - Note: This property SHOULD NOT contain the string \"X\" to indicate non-chemical elements or \"vacancy\" to indicate vacancies (in contrast to the field `chemical_symbols` for the `species` property).\n\n- **Examples**:\n - `[\"Si\"]`\n - `[\"Al\",\"O\",\"Si\"]`\n\n- **Query examples**:\n - A filter that matches all records of structures that contain Si, Al **and** O, and possibly other elements: `elements HAS ALL \"Si\", \"Al\", \"O\"`.\n - To match structures with exactly these three elements, use `elements HAS ALL \"Si\", \"Al\", \"O\" AND elements LENGTH 3`.\n - Note: length queries on this property can be equivalently formulated by filtering on the `nelements`_ property directly.", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "nelements": { "title": "Nelements", "type": "integer", "description": "Number of different elements in the structure as an integer.\n\n- **Type**: integer\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - MUST be equal to the lengths of the list properties `elements` and `elements_ratios`, if they are provided.\n\n- **Examples**:\n - `3`\n\n- **Querying**:\n - Note: queries on this property can equivalently be formulated using `elements LENGTH`.\n - A filter that matches structures that have exactly 4 elements: `nelements=4`.\n - A filter that matches structures that have between 2 and 7 elements: `nelements>=2 AND nelements<=7`.", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "elements_ratios": { "title": "Elements Ratios", @@ -3566,16 +3566,16 @@ }, "description": "Relative proportions of different elements in the structure.\n\n- **Type**: list of floats\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - Composed by the proportions of elements in the structure as a list of floating point numbers.\n - The sum of the numbers MUST be 1.0 (within floating point accuracy)\n - MUST refer to the same elements in the same order, and therefore be of the same length, as `elements`, if the latter is provided.\n\n- **Examples**:\n - `[1.0]`\n - `[0.3333333333333333, 0.2222222222222222, 0.4444444444444444]`\n\n- **Query examples**:\n - Note: Useful filters can be formulated using the set operator syntax for correlated values.\n However, since the values are floating point values, the use of equality comparisons is generally inadvisable.\n - OPTIONAL: a filter that matches structures where approximately 1/3 of the atoms in the structure are the element Al is: `elements:elements_ratios HAS ALL \"Al\":>0.3333, \"Al\":<0.3334`.", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "chemical_formula_descriptive": { "title": "Chemical Formula Descriptive", "type": "string", "description": "The chemical formula for a structure as a string in a form chosen by the API implementation.\n\n- **Type**: string\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - The chemical formula is given as a string consisting of properly capitalized element symbols followed by integers or decimal numbers, balanced parentheses, square, and curly brackets `(`,`)`, `[`,`]`, `{`, `}`, commas, the `+`, `-`, `:` and `=` symbols. The parentheses are allowed to be followed by a number. Spaces are allowed anywhere except within chemical symbols. The order of elements and any groupings indicated by parentheses or brackets are chosen freely by the API implementation.\n - The string SHOULD be arithmetically consistent with the element ratios in the `chemical_formula_reduced` property.\n - It is RECOMMENDED, but not mandatory, that symbols, parentheses and brackets, if used, are used with the meanings prescribed by [IUPAC's Nomenclature of Organic Chemistry](https://www.qmul.ac.uk/sbcs/iupac/bibliog/blue.html).\n\n- **Examples**:\n - `\"(H2O)2 Na\"`\n - `\"NaCl\"`\n - `\"CaCO3\"`\n - `\"CCaO3\"`\n - `\"(CH3)3N+ - [CH2]2-OH = Me3N+ - CH2 - CH2OH\"`\n\n- **Query examples**:\n - Note: the free-form nature of this property is likely to make queries on it across different databases inconsistent.\n - A filter that matches an exactly given formula: `chemical_formula_descriptive=\"(H2O)2 Na\"`.\n - A filter that does a partial match: `chemical_formula_descriptive CONTAINS \"H2O\"`.", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "chemical_formula_reduced": { "title": "Chemical Formula Reduced", @@ -3583,16 +3583,16 @@ "type": "string", "description": "The reduced chemical formula for a structure as a string with element symbols and integer chemical proportion numbers.\nThe proportion number MUST be omitted if it is 1.\n\n- **Type**: string\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property.\n However, support for filters using partial string matching with this property is OPTIONAL (i.e., BEGINS WITH, ENDS WITH, and CONTAINS).\n Intricate queries on formula components are instead suggested to be formulated using set-type filter operators on the multi valued `elements` and `elements_ratios` properties.\n - Element symbols MUST have proper capitalization (e.g., `\"Si\"`, not `\"SI\"` for \"silicon\").\n - Elements MUST be placed in alphabetical order, followed by their integer chemical proportion number.\n - For structures with no partial occupation, the chemical proportion numbers are the smallest integers for which the chemical proportion is exactly correct.\n - For structures with partial occupation, the chemical proportion numbers are integers that within reasonable approximation indicate the correct chemical proportions. The precise details of how to perform the rounding is chosen by the API implementation.\n - No spaces or separators are allowed.\n\n- **Examples**:\n - `\"H2NaO\"`\n - `\"ClNa\"`\n - `\"CCaO3\"`\n\n- **Query examples**:\n - A filter that matches an exactly given formula is `chemical_formula_reduced=\"H2NaO\"`.", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "chemical_formula_hill": { "title": "Chemical Formula Hill", "pattern": "^([A-Z][a-z]?([2-9]|[1-9]\\d+)?)+$", "type": "string", "description": "The chemical formula for a structure in [Hill form](https://dx.doi.org/10.1021/ja02046a005) with element symbols followed by integer chemical proportion numbers. The proportion number MUST be omitted if it is 1.\n\n- **Type**: string\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, only a subset of the filter features MAY be supported.\n - The overall scale factor of the chemical proportions is chosen such that the resulting values are integers that indicate the most chemically relevant unit of which the system is composed.\n For example, if the structure is a repeating unit cell with four hydrogens and four oxygens that represents two hydroperoxide molecules, `chemical_formula_hill` is `\"H2O2\"` (i.e., not `\"HO\"`, nor `\"H4O4\"`).\n - If the chemical insight needed to ascribe a Hill formula to the system is not present, the property MUST be handled as unset.\n - Element symbols MUST have proper capitalization (e.g., `\"Si\"`, not `\"SI\"` for \"silicon\").\n - Elements MUST be placed in [Hill order](https://dx.doi.org/10.1021/ja02046a005), followed by their integer chemical proportion number.\n Hill order means: if carbon is present, it is placed first, and if also present, hydrogen is placed second.\n After that, all other elements are ordered alphabetically.\n If carbon is not present, all elements are ordered alphabetically.\n - If the system has sites with partial occupation and the total occupations of each element do not all sum up to integers, then the Hill formula SHOULD be handled as unset.\n - No spaces or separators are allowed.\n\n- **Examples**:\n - `\"H2O2\"`\n\n- **Query examples**:\n - A filter that matches an exactly given formula is `chemical_formula_hill=\"H2O2\"`.", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "chemical_formula_anonymous": { "title": "Chemical Formula Anonymous", @@ -3600,8 +3600,8 @@ "type": "string", "description": "The anonymous formula is the `chemical_formula_reduced`, but where the elements are instead first ordered by their chemical proportion number, and then, in order left to right, replaced by anonymous symbols A, B, C, ..., Z, Aa, Ba, ..., Za, Ab, Bb, ... and so on.\n\n- **Type**: string\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property.\n However, support for filters using partial string matching with this property is OPTIONAL (i.e., BEGINS WITH, ENDS WITH, and CONTAINS).\n\n- **Examples**:\n - `\"A2B\"`\n - `\"A42B42C16D12E10F9G5\"`\n\n- **Querying**:\n - A filter that matches an exactly given formula is `chemical_formula_anonymous=\"A2B\"`.", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "dimension_types": { "title": "Dimension Types", @@ -3613,16 +3613,16 @@ }, "description": "List of three integers.\nFor each of the three directions indicated by the three lattice vectors (see property `lattice_vectors`), this list indicates if the direction is periodic (value `1`) or non-periodic (value `0`).\nNote: the elements in this list each refer to the direction of the corresponding entry in `lattice_vectors` and *not* the Cartesian x, y, z directions.\n\n- **Type**: list of integers.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - MUST be a list of length 3.\n - Each integer element MUST assume only the value 0 or 1.\n\n- **Examples**:\n - For a molecule: `[0, 0, 0]`\n - For a wire along the direction specified by the third lattice vector: `[0, 0, 1]`\n - For a 2D surface/slab, periodic on the plane defined by the first and third lattice vectors: `[1, 0, 1]`\n - For a bulk 3D system: `[1, 1, 1]`", "nullable": true, - "x-optimade-queryable": "optional", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "optional" }, "nperiodic_dimensions": { "title": "Nperiodic Dimensions", "type": "integer", "description": "An integer specifying the number of periodic dimensions in the structure, equivalent to the number of non-zero entries in `dimension_types`.\n\n- **Type**: integer\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - The integer value MUST be between 0 and 3 inclusive and MUST be equal to the sum of the items in the `dimension_types` property.\n - This property only reflects the treatment of the lattice vectors provided for the structure, and not any physical interpretation of the dimensionality of its contents.\n\n- **Examples**:\n - `2` should be indicated in cases where `dimension_types` is any of `[1, 1, 0]`, `[1, 0, 1]`, `[0, 1, 1]`.\n\n- **Query examples**:\n - Match only structures with exactly 3 periodic dimensions: `nperiodic_dimensions=3`\n - Match all structures with 2 or fewer periodic dimensions: `nperiodic_dimensions<=2`", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "lattice_vectors": { "title": "Lattice Vectors", @@ -3639,9 +3639,9 @@ }, "description": "The three lattice vectors in Cartesian coordinates, in \u00e5ngstr\u00f6m (\u00c5).\n\n- **Type**: list of list of floats or unknown values.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - MUST be a list of three vectors *a*, *b*, and *c*, where each of the vectors MUST BE a list of the vector's coordinates along the x, y, and z Cartesian coordinates.\n (Therefore, the first index runs over the three lattice vectors and the second index runs over the x, y, z Cartesian coordinates).\n - For databases that do not define an absolute Cartesian system (e.g., only defining the length and angles between vectors), the first lattice vector SHOULD be set along *x* and the second on the *xy*-plane.\n - MUST always contain three vectors of three coordinates each, independently of the elements of property `dimension_types`.\n The vectors SHOULD by convention be chosen so the determinant of the `lattice_vectors` matrix is different from zero.\n The vectors in the non-periodic directions have no significance beyond fulfilling these requirements.\n - The coordinates of the lattice vectors of non-periodic dimensions (i.e., those dimensions for which `dimension_types` is `0`) MAY be given as a list of all `null` values.\n If a lattice vector contains the value `null`, all coordinates of that lattice vector MUST be `null`.\n\n- **Examples**:\n - `[[4.0,0.0,0.0],[0.0,4.0,0.0],[0.0,1.0,4.0]]` represents a cell, where the first vector is `(4, 0, 0)`, i.e., a vector aligned along the `x` axis of length 4 \u00c5; the second vector is `(0, 4, 0)`; and the third vector is `(0, 1, 4)`.", "nullable": true, - "x-optimade-queryable": "optional", + "x-optimade-unit": "\u00c5", "x-optimade-support": "should", - "x-optimade-unit": "\u00c5" + "x-optimade-queryable": "optional" }, "cartesian_site_positions": { "title": "Cartesian Site Positions", @@ -3656,17 +3656,17 @@ }, "description": "Cartesian positions of each site in the structure.\nA site is usually used to describe positions of atoms; what atoms can be encountered at a given site is conveyed by the `species_at_sites` property, and the species themselves are described in the `species` property.\n\n- **Type**: list of list of floats\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - It MUST be a list of length equal to the number of sites in the structure, where every element is a list of the three Cartesian coordinates of a site expressed as float values in the unit angstrom (\u00c5).\n - An entry MAY have multiple sites at the same Cartesian position (for a relevant use of this, see e.g., the property `assemblies`).\n\n- **Examples**:\n - `[[0,0,0],[0,0,2]]` indicates a structure with two sites, one sitting at the origin and one along the (positive) *z*-axis, 2 \u00c5 away from the origin.", "nullable": true, - "x-optimade-queryable": "optional", + "x-optimade-unit": "\u00c5", "x-optimade-support": "should", - "x-optimade-unit": "\u00c5" + "x-optimade-queryable": "optional" }, "nsites": { "title": "Nsites", "type": "integer", "description": "An integer specifying the length of the `cartesian_site_positions` property.\n\n- **Type**: integer\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `42`\n\n- **Query examples**:\n - Match only structures with exactly 4 sites: `nsites=4`\n - Match structures that have between 2 and 7 sites: `nsites>=2 AND nsites<=7`", "nullable": true, - "x-optimade-queryable": "must", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "must" }, "species": { "title": "Species", @@ -3676,8 +3676,8 @@ }, "description": "A list describing the species of the sites of this structure.\nSpecies can represent pure chemical elements, virtual-crystal atoms representing a statistical occupation of a given site by multiple chemical elements, and/or a location to which there are attached atoms, i.e., atoms whose precise location are unknown beyond that they are attached to that position (frequently used to indicate hydrogen atoms attached to another element, e.g., a carbon with three attached hydrogens might represent a methyl group, -CH3).\n\n- **Type**: list of dictionary with keys:\n - `name`: string (REQUIRED)\n - `chemical_symbols`: list of strings (REQUIRED)\n - `concentration`: list of float (REQUIRED)\n - `attached`: list of strings (REQUIRED)\n - `nattached`: list of integers (OPTIONAL)\n - `mass`: list of floats (OPTIONAL)\n - `original_name`: string (OPTIONAL).\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - Each list member MUST be a dictionary with the following keys:\n - **name**: REQUIRED; gives the name of the species; the **name** value MUST be unique in the `species` list;\n - **chemical_symbols**: REQUIRED; MUST be a list of strings of all chemical elements composing this species.\n Each item of the list MUST be one of the following:\n - a valid chemical-element symbol, or\n - the special value `\"X\"` to represent a non-chemical element, or\n - the special value `\"vacancy\"` to represent that this site has a non-zero probability of having a vacancy (the respective probability is indicated in the `concentration` list, see below).\n\n If any one entry in the `species` list has a `chemical_symbols` list that is longer than 1 element, the correct flag MUST be set in the list `structure_features`.\n\n - **concentration**: REQUIRED; MUST be a list of floats, with same length as `chemical_symbols`.\n The numbers represent the relative concentration of the corresponding chemical symbol in this species.\n The numbers SHOULD sum to one. Cases in which the numbers do not sum to one typically fall only in the following two categories:\n\n - Numerical errors when representing float numbers in fixed precision, e.g. for two chemical symbols with concentrations `1/3` and `2/3`, the concentration might look something like `[0.33333333333, 0.66666666666]`. If the client is aware that the sum is not one because of numerical precision, it can renormalize the values so that the sum is exactly one.\n - Experimental errors in the data present in the database. In this case, it is the responsibility of the client to decide how to process the data.\n\n Note that concentrations are uncorrelated between different sites (even of the same species).\n\n - **attached**: OPTIONAL; if provided MUST be a list of length 1 or more of strings of chemical symbols for the elements attached to this site, or \"X\" for a non-chemical element.\n\n - **nattached**: OPTIONAL; if provided MUST be a list of length 1 or more of integers indicating the number of attached atoms of the kind specified in the value of the `attached` key.\n\n The implementation MUST include either both or none of the `attached` and `nattached` keys, and if they are provided, they MUST be of the same length.\n Furthermore, if they are provided, the `structure_features` property MUST include the string `site_attachments`.\n\n - **mass**: OPTIONAL. If present MUST be a list of floats, with the same length as `chemical_symbols`, providing element masses expressed in a.m.u.\n Elements denoting vacancies MUST have masses equal to 0.\n\n - **original_name**: OPTIONAL. Can be any valid Unicode string, and SHOULD contain (if specified) the name of the species that is used internally in the source database.\n\n Note: With regards to \"source database\", we refer to the immediate source being queried via the OPTIMADE API implementation.\n\n The main use of this field is for source databases that use species names, containing characters that are not allowed (see description of the list property `species_at_sites`).\n\n - For systems that have only species formed by a single chemical symbol, and that have at most one species per chemical symbol, SHOULD use the chemical symbol as species name (e.g., `\"Ti\"` for titanium, `\"O\"` for oxygen, etc.)\n However, note that this is OPTIONAL, and client implementations MUST NOT assume that the key corresponds to a chemical symbol, nor assume that if the species name is a valid chemical symbol, that it represents a species with that chemical symbol.\n This means that a species `{\"name\": \"C\", \"chemical_symbols\": [\"Ti\"], \"concentration\": [1.0]}` is valid and represents a titanium species (and *not* a carbon species).\n - It is NOT RECOMMENDED that a structure includes species that do not have at least one corresponding site.\n\n- **Examples**:\n - `[ {\"name\": \"Ti\", \"chemical_symbols\": [\"Ti\"], \"concentration\": [1.0]} ]`: any site with this species is occupied by a Ti atom.\n - `[ {\"name\": \"Ti\", \"chemical_symbols\": [\"Ti\", \"vacancy\"], \"concentration\": [0.9, 0.1]} ]`: any site with this species is occupied by a Ti atom with 90 % probability, and has a vacancy with 10 % probability.\n - `[ {\"name\": \"BaCa\", \"chemical_symbols\": [\"vacancy\", \"Ba\", \"Ca\"], \"concentration\": [0.05, 0.45, 0.5], \"mass\": [0.0, 137.327, 40.078]} ]`: any site with this species is occupied by a Ba atom with 45 % probability, a Ca atom with 50 % probability, and by a vacancy with 5 % probability. The mass of this site is (on average) 88.5 a.m.u.\n - `[ {\"name\": \"C12\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"mass\": [12.0]} ]`: any site with this species is occupied by a carbon isotope with mass 12.\n - `[ {\"name\": \"C13\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"mass\": [13.0]} ]`: any site with this species is occupied by a carbon isotope with mass 13.\n - `[ {\"name\": \"CH3\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"attached\": [\"H\"], \"nattached\": [3]} ]`: any site with this species is occupied by a methyl group, -CH3, which is represented without specifying precise positions of the hydrogen atoms.", "nullable": true, - "x-optimade-queryable": "optional", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "optional" }, "species_at_sites": { "title": "Species At Sites", @@ -3687,8 +3687,8 @@ }, "description": "Name of the species at each site (where values for sites are specified with the same order of the property `cartesian_site_positions`).\nThe properties of the species are found in the property `species`.\n\n- **Type**: list of strings.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - MUST have length equal to the number of sites in the structure (first dimension of the list property `cartesian_site_positions`).\n - Each species name mentioned in the `species_at_sites` list MUST be described in the list property `species` (i.e. for each value in the `species_at_sites` list there MUST exist exactly one dictionary in the `species` list with the `name` attribute equal to the corresponding `species_at_sites` value).\n - Each site MUST be associated only to a single species.\n **Note**: However, species can represent mixtures of atoms, and multiple species MAY be defined for the same chemical element.\n This latter case is useful when different atoms of the same type need to be grouped or distinguished, for instance in simulation codes to assign different initial spin states.\n\n- **Examples**:\n - `[\"Ti\",\"O2\"]` indicates that the first site is hosting a species labeled `\"Ti\"` and the second a species labeled `\"O2\"`.\n - `[\"Ac\", \"Ac\", \"Ag\", \"Ir\"]` indicating the first two sites contains the `\"Ac\"` species, while the third and fourth sites contain the `\"Ag\"` and `\"Ir\"` species, respectively.", "nullable": true, - "x-optimade-queryable": "optional", - "x-optimade-support": "should" + "x-optimade-support": "should", + "x-optimade-queryable": "optional" }, "assemblies": { "title": "Assemblies", @@ -3697,8 +3697,8 @@ "$ref": "#/components/schemas/Assembly" }, "description": "A description of groups of sites that are statistically correlated.\n\n- **Type**: list of dictionary with keys:\n - `sites_in_groups`: list of list of integers (REQUIRED)\n - `group_probabilities`: list of floats (REQUIRED)\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - The property SHOULD be `null` for entries that have no partial occupancies.\n - If present, the correct flag MUST be set in the list `structure_features`.\n - Client implementations MUST check its presence (as its presence changes the interpretation of the structure).\n - If present, it MUST be a list of dictionaries, each of which represents an assembly and MUST have the following two keys:\n - **sites_in_groups**: Index of the sites (0-based) that belong to each group for each assembly.\n\n Example: `[[1], [2]]`: two groups, one with the second site, one with the third.\n Example: `[[1,2], [3]]`: one group with the second and third site, one with the fourth.\n\n - **group_probabilities**: Statistical probability of each group. It MUST have the same length as `sites_in_groups`.\n It SHOULD sum to one.\n See below for examples of how to specify the probability of the occurrence of a vacancy.\n The possible reasons for the values not to sum to one are the same as already specified above for the `concentration` of each `species`.\n\n - If a site is not present in any group, it means that it is present with 100 % probability (as if no assembly was specified).\n - A site MUST NOT appear in more than one group.\n\n- **Examples** (for each entry of the assemblies list):\n - `{\"sites_in_groups\": [[0], [1]], \"group_probabilities: [0.3, 0.7]}`: the first site and the second site never occur at the same time in the unit cell.\n Statistically, 30 % of the times the first site is present, while 70 % of the times the second site is present.\n - `{\"sites_in_groups\": [[1,2], [3]], \"group_probabilities: [0.3, 0.7]}`: the second and third site are either present together or not present; they form the first group of atoms for this assembly.\n The second group is formed by the fourth site.\n Sites of the first group (the second and the third) are never present at the same time as the fourth site.\n 30 % of times sites 1 and 2 are present (and site 3 is absent); 70 % of times site 3 is present (and sites 1 and 2 are absent).\n\n- **Notes**:\n - Assemblies are essential to represent, for instance, the situation where an atom can statistically occupy two different positions (sites).\n\n - By defining groups, it is possible to represent, e.g., the case where a functional molecule (and not just one atom) is either present or absent (or the case where it it is present in two conformations)\n\n - Considerations on virtual alloys and on vacancies: In the special case of a virtual alloy, these specifications allow two different, equivalent ways of specifying them.\n For instance, for a site at the origin with 30 % probability of being occupied by Si, 50 % probability of being occupied by Ge, and 20 % of being a vacancy, the following two representations are possible:\n\n - Using a single species:\n ```json\n {\n \"cartesian_site_positions\": [[0,0,0]],\n \"species_at_sites\": [\"SiGe-vac\"],\n \"species\": [\n {\n \"name\": \"SiGe-vac\",\n \"chemical_symbols\": [\"Si\", \"Ge\", \"vacancy\"],\n \"concentration\": [0.3, 0.5, 0.2]\n }\n ]\n // ...\n }\n ```\n\n - Using multiple species and the assemblies:\n ```json\n {\n \"cartesian_site_positions\": [ [0,0,0], [0,0,0], [0,0,0] ],\n \"species_at_sites\": [\"Si\", \"Ge\", \"vac\"],\n \"species\": [\n { \"name\": \"Si\", \"chemical_symbols\": [\"Si\"], \"concentration\": [1.0] },\n { \"name\": \"Ge\", \"chemical_symbols\": [\"Ge\"], \"concentration\": [1.0] },\n { \"name\": \"vac\", \"chemical_symbols\": [\"vacancy\"], \"concentration\": [1.0] }\n ],\n \"assemblies\": [\n {\n \"sites_in_groups\": [ [0], [1], [2] ],\n \"group_probabilities\": [0.3, 0.5, 0.2]\n }\n ]\n // ...\n }\n ```\n\n - It is up to the database provider to decide which representation to use, typically depending on the internal format in which the structure is stored.\n However, given a structure identified by a unique ID, the API implementation MUST always provide the same representation for it.\n\n - The probabilities of occurrence of different assemblies are uncorrelated.\n So, for instance in the following case with two assemblies:\n ```json\n {\n \"assemblies\": [\n {\n \"sites_in_groups\": [ [0], [1] ],\n \"group_probabilities\": [0.2, 0.8],\n },\n {\n \"sites_in_groups\": [ [2], [3] ],\n \"group_probabilities\": [0.3, 0.7]\n }\n ]\n }\n ```\n\n Site 0 is present with a probability of 20 % and site 1 with a probability of 80 %. These two sites are correlated (either site 0 or 1 is present). Similarly, site 2 is present with a probability of 30 % and site 3 with a probability of 70 %.\n These two sites are correlated (either site 2 or 3 is present).\n However, the presence or absence of sites 0 and 1 is not correlated with the presence or absence of sites 2 and 3 (in the specific example, the pair of sites (0, 2) can occur with 0.2*0.3 = 6 % probability; the pair (0, 3) with 0.2*0.7 = 14 % probability; the pair (1, 2) with 0.8*0.3 = 24 % probability; and the pair (1, 3) with 0.8*0.7 = 56 % probability).", - "x-optimade-queryable": "optional", - "x-optimade-support": "optional" + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, "structure_features": { "title": "Structure Features", @@ -3707,8 +3707,8 @@ "$ref": "#/components/schemas/StructureFeatures" }, "description": "A list of strings that flag which special features are used by the structure.\n\n- **Type**: list of strings\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property.\n Filters on the list MUST support all mandatory HAS-type queries.\n Filter operators for comparisons on the string components MUST support equality, support for other comparison operators are OPTIONAL.\n - MUST be an empty list if no special features are used.\n - MUST be sorted alphabetically.\n - If a special feature listed below is used, the list MUST contain the corresponding string.\n - If a special feature listed below is not used, the list MUST NOT contain the corresponding string.\n - **List of strings used to indicate special structure features**:\n - `disorder`: this flag MUST be present if any one entry in the `species` list has a `chemical_symbols` list that is longer than 1 element.\n - `implicit_atoms`: this flag MUST be present if the structure contains atoms that are not assigned to sites via the property `species_at_sites` (e.g., because their positions are unknown).\n When this flag is present, the properties related to the chemical formula will likely not match the type and count of atoms represented by the `species_at_sites`, `species` and `assemblies` properties.\n - `site_attachments`: this flag MUST be present if any one entry in the `species` list includes `attached` and `nattached`.\n - `assemblies`: this flag MUST be present if the property `assemblies` is present.\n\n- **Examples**: A structure having implicit atoms and using assemblies: `[\"assemblies\", \"implicit_atoms\"]`", - "x-optimade-queryable": "must", - "x-optimade-support": "must" + "x-optimade-support": "must", + "x-optimade-queryable": "must" } }, "description": "This class contains the Field for the attributes used to represent a structure, e.g. unit cell, atoms, positions." From 0089390ec42dff8a48db5dca864c23f775d412f7 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 6 Dec 2022 15:46:28 +0000 Subject: [PATCH 4/8] Linting --- optimade/models/__init__.py | 24 +++++++++---------- optimade/models/files.py | 15 ++++-------- optimade/models/responses.py | 2 +- optimade/server/mappers/__init__.py | 4 ++-- optimade/server/mappers/files.py | 2 +- optimade/server/routers/__init__.py | 2 +- optimade/server/routers/files.py | 6 +---- .../test_entry_collections.py | 2 +- tests/server/routers/test_files.py | 6 +---- 9 files changed, 24 insertions(+), 39 deletions(-) diff --git a/optimade/models/__init__.py b/optimade/models/__init__.py index aecd1a6a7..622423d2b 100644 --- a/optimade/models/__init__.py +++ b/optimade/models/__init__.py @@ -1,6 +1,7 @@ # pylint: disable=undefined-variable from .baseinfo import * # noqa: F403 from .entries import * # noqa: F403 +from .files import * # noqa: F403 from .index_metadb import * # noqa: F403 from .jsonapi import * # noqa: F403 from .links import * # noqa: F403 @@ -8,19 +9,18 @@ from .references import * # noqa: F403 from .responses import * # noqa: F403 from .structures import * # noqa: F403 -from .files import * # noqa: F403 from .utils import * # noqa: F403 __all__ = ( - jsonapi.__all__ # noqa: F405 - + utils.__all__ # noqa: F405 - + baseinfo.__all__ # noqa: F405 - + entries.__all__ # noqa: F405 - + index_metadb.__all__ # noqa: F405 - + links.__all__ # noqa: F405 - + optimade_json.__all__ # noqa: F405 - + references.__all__ # noqa: F405 - + responses.__all__ # noqa: F405 - + structures.__all__ # noqa: F405 - + files.__all__ # noqa: F405 + jsonapi.__all__ # type: ignore[name-defined] # noqa: F405 + + utils.__all__ # type: ignore[name-defined] # noqa: F405 + + baseinfo.__all__ # type: ignore[name-defined] # noqa: F405 + + entries.__all__ # type: ignore[name-defined] # noqa: F405 + + index_metadb.__all__ # type: ignore[name-defined] # noqa: F405 + + links.__all__ # type: ignore[name-defined] # noqa: F405 + + optimade_json.__all__ # type: ignore[name-defined] # noqa: F405 + + references.__all__ # type: ignore[name-defined] # noqa: F405 + + responses.__all__ # type: ignore[name-defined] # noqa: F405 + + structures.__all__ # type: ignore[name-defined] # noqa: F405 + + files.__all__ # type: ignore[name-defined] # noqa: F405 ) diff --git a/optimade/models/files.py b/optimade/models/files.py index 96bf4b09c..f72a867df 100644 --- a/optimade/models/files.py +++ b/optimade/models/files.py @@ -1,13 +1,9 @@ # pylint: disable=no-self-argument,line-too-long,no-name-in-module from datetime import datetime -from typing import Optional, Dict -from optimade.models.entries import EntryResourceAttributes, EntryResource -from optimade.models.utils import ( - OptimadeField, - StrictField, - SupportLevel, -) +from typing import Dict, Optional, Set, Tuple +from optimade.models.entries import EntryResource, EntryResourceAttributes +from optimade.models.utils import OptimadeField, StrictField, SupportLevel __all__ = ( "FileResourceAttributes", @@ -15,10 +11,7 @@ ) -CORRELATED_FILE_FIELDS = ( - {}, - {}, -) +CORRELATED_FILE_FIELDS: Tuple[Set[str], ...] class FileResourceAttributes(EntryResourceAttributes): diff --git a/optimade/models/responses.py b/optimade/models/responses.py index da8622a33..f6cd5f1b0 100644 --- a/optimade/models/responses.py +++ b/optimade/models/responses.py @@ -5,13 +5,13 @@ from optimade.models.baseinfo import BaseInfoResource from optimade.models.entries import EntryInfoResource, EntryResource +from optimade.models.files import FileResource from optimade.models.index_metadb import IndexInfoResource from optimade.models.jsonapi import Response from optimade.models.links import LinksResource from optimade.models.optimade_json import OptimadeError, ResponseMeta, Success from optimade.models.references import ReferenceResource from optimade.models.structures import StructureResource -from optimade.models.files import FileResource from optimade.models.utils import StrictField __all__ = ( diff --git a/optimade/server/mappers/__init__.py b/optimade/server/mappers/__init__.py index 27d0e8e44..9693dd9fa 100644 --- a/optimade/server/mappers/__init__.py +++ b/optimade/server/mappers/__init__.py @@ -1,14 +1,14 @@ # pylint: disable=undefined-variable from .entries import * # noqa: F403 +from .files import * # noqa: F403 from .links import * # noqa: F403 from .references import * # noqa: F403 from .structures import * # noqa: F403 -from .files import * # noqa: F403 __all__ = ( entries.__all__ # type: ignore[name-defined] # noqa: F405 + links.__all__ # type: ignore[name-defined] # noqa: F405 + references.__all__ # type: ignore[name-defined] # noqa: F405 + structures.__all__ # type: ignore[name-defined] # noqa: F405 - + files.__all__ # noqa: F405 + + files.__all__ # type: ignore[name-defined] # noqa: F405 ) diff --git a/optimade/server/mappers/files.py b/optimade/server/mappers/files.py index 29b80df6a..0184a36a3 100644 --- a/optimade/server/mappers/files.py +++ b/optimade/server/mappers/files.py @@ -1,5 +1,5 @@ -from optimade.server.mappers.entries import BaseResourceMapper from optimade.models.files import FileResource +from optimade.server.mappers.entries import BaseResourceMapper __all__ = ("FileMapper",) diff --git a/optimade/server/routers/__init__.py b/optimade/server/routers/__init__.py index 3c74f8bf2..a9157cf18 100644 --- a/optimade/server/routers/__init__.py +++ b/optimade/server/routers/__init__.py @@ -1,7 +1,7 @@ +from .files import files_coll from .links import links_coll from .references import references_coll from .structures import structures_coll -from .files import files_coll ENTRY_COLLECTIONS = { "links": links_coll, diff --git a/optimade/server/routers/files.py b/optimade/server/routers/files.py index 3a5846f3d..ef52cec77 100644 --- a/optimade/server/routers/files.py +++ b/optimade/server/routers/files.py @@ -1,10 +1,6 @@ from fastapi import APIRouter, Depends, Request -from optimade.models import ( - FileResource, - FileResponseMany, - FileResponseOne, -) +from optimade.models import FileResource, FileResponseMany, FileResponseOne from optimade.server.config import CONFIG from optimade.server.entry_collections import create_collection from optimade.server.mappers import FileMapper diff --git a/tests/server/entry_collections/test_entry_collections.py b/tests/server/entry_collections/test_entry_collections.py index de820429b..3e9093325 100644 --- a/tests/server/entry_collections/test_entry_collections.py +++ b/tests/server/entry_collections/test_entry_collections.py @@ -4,10 +4,10 @@ def test_get_attribute_fields(): """Test get_attribute_fields() method""" from optimade.models import ( + FileResourceAttributes, LinksResourceAttributes, ReferenceResourceAttributes, StructureResourceAttributes, - FileResourceAttributes, ) from optimade.server.routers import ENTRY_COLLECTIONS diff --git a/tests/server/routers/test_files.py b/tests/server/routers/test_files.py index 406a05446..b613e6976 100644 --- a/tests/server/routers/test_files.py +++ b/tests/server/routers/test_files.py @@ -1,8 +1,4 @@ -from optimade.models import ( - FileResponseMany, - # FileResponseOne, - # FileResource, -) +from optimade.models import FileResponseMany # FileResponseOne,; FileResource, from ..utils import RegularEndpointTests From f37e107f748907d82791e7caf637ca448634e82f Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 6 Dec 2022 15:49:07 +0000 Subject: [PATCH 5/8] Add endpoint to main server --- openapi/openapi.json | 984 +++++++++++++++++++++++++++++++++++----- optimade/server/main.py | 9 +- 2 files changed, 883 insertions(+), 110 deletions(-) diff --git a/openapi/openapi.json b/openapi/openapi.json index b6625003e..857130b5f 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -1300,6 +1300,428 @@ } } }, + "/files": { + "get": { + "tags": [ + "Files" + ], + "summary": "Get Files", + "operationId": "get_files_files_get", + "parameters": [ + { + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification.", + "required": false, + "schema": { + "title": "Filter", + "type": "string", + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification.", + "default": "" + }, + "name": "filter", + "in": "query" + }, + { + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "required": false, + "schema": { + "title": "Response Format", + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json" + }, + "name": "response_format", + "in": "query" + }, + { + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "required": false, + "schema": { + "title": "Email Address", + "type": "string", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "format": "email", + "default": "" + }, + "name": "email_address", + "in": "query" + }, + { + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "required": false, + "schema": { + "title": "Response Fields", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "type": "string", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "" + }, + "name": "response_fields", + "in": "query" + }, + { + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints.", + "required": false, + "schema": { + "title": "Sort", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "type": "string", + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints.", + "default": "" + }, + "name": "sort", + "in": "query" + }, + { + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`", + "required": false, + "schema": { + "title": "Page Limit", + "minimum": 0.0, + "type": "integer", + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`", + "default": 20 + }, + "name": "page_limit", + "in": "query" + }, + { + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`.", + "required": false, + "schema": { + "title": "Page Offset", + "minimum": 0.0, + "type": "integer", + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`.", + "default": 0 + }, + "name": "page_offset", + "in": "query" + }, + { + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`.", + "required": false, + "schema": { + "title": "Page Number", + "type": "integer", + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`." + }, + "name": "page_number", + "in": "query" + }, + { + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED.", + "required": false, + "schema": { + "title": "Page Cursor", + "minimum": 0.0, + "type": "integer", + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED.", + "default": 0 + }, + "name": "page_cursor", + "in": "query" + }, + { + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`.", + "required": false, + "schema": { + "title": "Page Above", + "minimum": 0.0, + "type": "integer", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`.", + "default": 0 + }, + "name": "page_above", + "in": "query" + }, + { + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.", + "required": false, + "schema": { + "title": "Page Below", + "minimum": 0.0, + "type": "integer", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.", + "default": 0 + }, + "name": "page_below", + "in": "query" + }, + { + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "required": false, + "schema": { + "title": "Include", + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references" + }, + "name": "include", + "in": "query" + }, + { + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "required": false, + "schema": { + "title": "Api Hint", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "type": "string", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "" + }, + "name": "api_hint", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/FileResponseMany" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/files/{entry_id}": { + "get": { + "tags": [ + "Files" + ], + "summary": "Get Single File", + "operationId": "get_single_file_files__entry_id__get", + "parameters": [ + { + "required": true, + "schema": { + "title": "Entry Id", + "type": "string" + }, + "name": "entry_id", + "in": "path" + }, + { + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "required": false, + "schema": { + "title": "Response Format", + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json" + }, + "name": "response_format", + "in": "query" + }, + { + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "required": false, + "schema": { + "title": "Email Address", + "type": "string", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "format": "email", + "default": "" + }, + "name": "email_address", + "in": "query" + }, + { + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "required": false, + "schema": { + "title": "Response Fields", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "type": "string", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "" + }, + "name": "response_fields", + "in": "query" + }, + { + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "required": false, + "schema": { + "title": "Include", + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references" + }, + "name": "include", + "in": "query" + }, + { + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "required": false, + "schema": { + "title": "Api Hint", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "type": "string", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "" + }, + "name": "api_hint", + "in": "query" + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/FileResponseOne" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, "/versions": { "get": { "tags": [ @@ -1752,10 +2174,267 @@ "description": "Object containing links to relationships with entries of the `structures` type." } }, - "description": "This model wraps the JSON API Relationships to include type-specific top level keys." + "description": "This model wraps the JSON API Relationships to include type-specific top level keys." + }, + "EntryResource": { + "title": "EntryResource", + "required": [ + "id", + "type", + "attributes" + ], + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string", + "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", + "x-optimade-support": "must", + "x-optimade-queryable": "must" + }, + "type": { + "title": "Type", + "type": "string", + "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Example**: `\"structures\"`", + "x-optimade-support": "must", + "x-optimade-queryable": "must" + }, + "links": { + "title": "Links", + "allOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + } + ], + "description": "a links object containing links related to the resource." + }, + "meta": { + "title": "Meta", + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ], + "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." + }, + "attributes": { + "title": "Attributes", + "allOf": [ + { + "$ref": "#/components/schemas/EntryResourceAttributes" + } + ], + "description": "A dictionary, containing key-value pairs representing the entry's properties, except for `type` and `id`.\nDatabase-provider-specific properties need to include the database-provider-specific prefix (see section on Database-Provider-Specific Namespace Prefixes)." + }, + "relationships": { + "title": "Relationships", + "allOf": [ + { + "$ref": "#/components/schemas/EntryRelationships" + } + ], + "description": "A dictionary containing references to other entries according to the description in section Relationships encoded as [JSON API Relationships](https://jsonapi.org/format/1.0/#document-resource-object-relationships).\nThe OPTIONAL human-readable description of the relationship MAY be provided in the `description` field inside the `meta` dictionary of the JSON API resource identifier object." + } + }, + "description": "The base model for an entry resource." + }, + "EntryResourceAttributes": { + "title": "EntryResourceAttributes", + "required": [ + "last_modified" + ], + "type": "object", + "properties": { + "immutable_id": { + "title": "Immutable Id", + "type": "string", + "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", + "x-optimade-support": "optional", + "x-optimade-queryable": "must" + }, + "last_modified": { + "title": "Last Modified", + "type": "string", + "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", + "format": "date-time", + "x-optimade-support": "should", + "x-optimade-queryable": "must" + } + }, + "description": "Contains key-value pairs representing the entry's properties." + }, + "Error": { + "title": "Error", + "type": "object", + "properties": { + "id": { + "title": "Id", + "type": "string", + "description": "A unique identifier for this particular occurrence of the problem." + }, + "links": { + "title": "Links", + "allOf": [ + { + "$ref": "#/components/schemas/ErrorLinks" + } + ], + "description": "A links object storing about" + }, + "status": { + "title": "Status", + "type": "string", + "description": "the HTTP status code applicable to this problem, expressed as a string value." + }, + "code": { + "title": "Code", + "type": "string", + "description": "an application-specific error code, expressed as a string value." + }, + "title": { + "title": "Title", + "type": "string", + "description": "A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization." + }, + "detail": { + "title": "Detail", + "type": "string", + "description": "A human-readable explanation specific to this occurrence of the problem." + }, + "source": { + "title": "Source", + "allOf": [ + { + "$ref": "#/components/schemas/ErrorSource" + } + ], + "description": "An object containing references to the source of the error" + }, + "meta": { + "title": "Meta", + "allOf": [ + { + "$ref": "#/components/schemas/Meta" + } + ], + "description": "a meta object containing non-standard meta-information about the error." + } + }, + "description": "An error response" + }, + "ErrorLinks": { + "title": "ErrorLinks", + "type": "object", + "properties": { + "about": { + "title": "About", + "anyOf": [ + { + "maxLength": 65536, + "minLength": 1, + "type": "string", + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + } + ], + "description": "A link that leads to further details about this particular occurrence of the problem." + } + }, + "description": "A Links object specific to Error objects" + }, + "ErrorResponse": { + "title": "ErrorResponse", + "required": [ + "meta", + "errors" + ], + "type": "object", + "properties": { + "data": { + "title": "Data", + "uniqueItems": true, + "anyOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/Resource" + } + } + ], + "description": "Outputted Data" + }, + "meta": { + "title": "Meta", + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information." + }, + "errors": { + "title": "Errors", + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/OptimadeError" + }, + "description": "A list of OPTIMADE-specific JSON API error objects, where the field detail MUST be present." + }, + "included": { + "title": "Included", + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/Resource" + }, + "description": "A list of unique included resources" + }, + "links": { + "title": "Links", + "allOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "title": "Jsonapi", + "allOf": [ + { + "$ref": "#/components/schemas/JsonApi" + } + ], + "description": "Information about the JSON API used" + } + }, + "description": "errors MUST be present and data MUST be skipped" + }, + "ErrorSource": { + "title": "ErrorSource", + "type": "object", + "properties": { + "pointer": { + "title": "Pointer", + "type": "string", + "description": "a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute]." + }, + "parameter": { + "title": "Parameter", + "type": "string", + "description": "a string indicating which URI query parameter caused the error." + } + }, + "description": "an object containing references to the source of the error" }, - "EntryResource": { - "title": "EntryResource", + "FileResource": { + "title": "FileResource", "required": [ "id", "type", @@ -1772,8 +2451,10 @@ }, "type": { "title": "Type", + "pattern": "^files$", "type": "string", - "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Example**: `\"structures\"`", + "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Examples**:\n - `\"structures\"`", + "default": "files", "x-optimade-support": "must", "x-optimade-queryable": "must" }, @@ -1796,13 +2477,7 @@ "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." }, "attributes": { - "title": "Attributes", - "allOf": [ - { - "$ref": "#/components/schemas/EntryResourceAttributes" - } - ], - "description": "A dictionary, containing key-value pairs representing the entry's properties, except for `type` and `id`.\nDatabase-provider-specific properties need to include the database-provider-specific prefix (see section on Database-Provider-Specific Namespace Prefixes)." + "$ref": "#/components/schemas/FileResourceAttributes" }, "relationships": { "title": "Relationships", @@ -1814,12 +2489,23 @@ "description": "A dictionary containing references to other entries according to the description in section Relationships encoded as [JSON API Relationships](https://jsonapi.org/format/1.0/#document-resource-object-relationships).\nThe OPTIONAL human-readable description of the relationship MAY be provided in the `description` field inside the `meta` dictionary of the JSON API resource identifier object." } }, - "description": "The base model for an entry resource." + "description": "Representing a structure." }, - "EntryResourceAttributes": { - "title": "EntryResourceAttributes", + "FileResourceAttributes": { + "title": "FileResourceAttributes", "required": [ - "last_modified" + "last_modified", + "url", + "url_stable_until", + "name", + "size", + "media_type", + "modification_timestamp", + "description", + "checksums", + "atime", + "ctime", + "mtime" ], "type": "object", "properties": { @@ -1837,114 +2523,206 @@ "format": "date-time", "x-optimade-support": "should", "x-optimade-queryable": "must" - } - }, - "description": "Contains key-value pairs representing the entry's properties." - }, - "Error": { - "title": "Error", - "type": "object", - "properties": { - "id": { - "title": "Id", + }, + "url": { + "title": "Url", "type": "string", - "description": "A unique identifier for this particular occurrence of the problem." + "description": "The URL to get the contents of a file.\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: MUST be supported by all implementations, MUST NOT be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - **Response**: REQUIRED in the response.\n - The URL MUST point to the actual contents of a file (i.e. byte stream), not an intermediate (preview) representation.\n For example, if referring to a file on GitHub, a link should point to raw contents.\n\n- **Examples**:\n\n - :val:`\"https://example.org/files/cifs/1000000.cif\"`\n", + "x-optimade-support": "must", + "x-optimade-queryable": "optional" }, - "links": { - "title": "Links", - "allOf": [ - { - "$ref": "#/components/schemas/ErrorLinks" - } - ], - "description": "A links object storing about" + "url_stable_until": { + "title": "Url Stable Until", + "type": "string", + "description": "Point in time until which the URL in `url` is guaranteed to stay stable.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - :val:`null` means that there is no stability guarantee for the URL in `url`.\n Indefinite support could be communicated by providing a date sufficiently far in the future, for example, :val:`9999-12-31`.", + "format": "date-time", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, - "status": { - "title": "Status", + "name": { + "title": "Name", "type": "string", - "description": "the HTTP status code applicable to this problem, expressed as a string value." + "description": "Base name of a file.\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: MUST be supported by all implementations, MUST NOT be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - File name extension is an integral part of a file name and, if available, MUST be included.\n\n- **Examples**:\n\n - :val:`\"1000000.cif\"`", + "x-optimade-support": "must", + "x-optimade-queryable": "optional" }, - "code": { - "title": "Code", + "size": { + "title": "Size", + "type": "integer", + "description": "Size of a file in bytes.\n- **Type**: integer\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - If provided, it MUST be guaranteed that either exact size of a file is given or its upper bound.\n This way if a client reserves a static buffer or truncates the download stream after this many bytes the whole file would be received.\n Such provision is included to allow the providers to serve on-the-fly compressed files.", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" + }, + "media_type": { + "title": "Media Type", "type": "string", - "description": "an application-specific error code, expressed as a string value." + "description": "Media type identifier (also known as MIME type), for a file as per `RFC 6838 Media Type Specifications and Registration Procedures `__.\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n\n- **Examples**:\n\n - :val:`\"chemical/x-cif\"`", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, - "title": { - "title": "Title", + "version": { + "title": "Version", "type": "string", - "description": "A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization." + "description": "Version information of a file (e.g. commit, revision, timestamp).\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - If provided, it MUST be guaranteed that file contents pertaining to the same combination of :field:`id` and :field:`version` are the same", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, - "detail": { - "title": "Detail", + "modification_timestamp": { + "title": "Modification Timestamp", "type": "string", - "description": "A human-readable explanation specific to this occurrence of the problem." + "description": "Timestamp of the last modification of file contents.\n A modification is understood as an addition, change or deletion of one or more bytes, resulting in file contents different from the previous.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - Timestamps of subsequent file modifications SHOULD be increasing (not earlier than previous timestamps).", + "format": "date-time", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" }, - "source": { - "title": "Source", - "allOf": [ + "description": { + "title": "Description", + "type": "string", + "description": "Free-form description of a file.\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n\n- **Examples**:\n\n - :val:`\"POSCAR format file\"`", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" + }, + "checksums": { + "title": "Checksums", + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Dictionary providing checksums of file contents.\n* **Type**: dictionary with keys identifying checksum functions and values (strings) giving the actual checksums\n* **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - Supported dictionary keys: :property:`md5`, :property:`sha1`, :property:`sha224`, :property:`sha256`, :property:`sha384`, :property:`sha512`.\n Checksums outside this list MAY be used, but their names MUST be prefixed by database-provider-specific namespace prefix (see appendix `Database-Provider-Specific Namespace Prefixes`_).\n", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" + }, + "atime": { + "title": "Atime", + "type": "string", + "description": "Time of last access of a file as per POSIX standard.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.", + "format": "date-time", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" + }, + "ctime": { + "title": "Ctime", + "type": "string", + "description": "Time of last status change of a file as per POSIX standard.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.", + "format": "date-time", + "x-optimade-unit": "\u00c5", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" + }, + "mtime": { + "title": "Mtime", + "type": "string", + "description": " Time of last modification of a file as per POSIX standard.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - It should be noted that the values of :field:`last_modified`, :field:`modification_timestamp` and :field:`mtime` do not necessary match.\n :field:`last_modified` pertains to the modification of the OPTIMADE metadata, :field:`modification_timestamp` pertains to file contents and :field:`mtime` pertains to the modification of the file (not necessary changing its contents).\n For example, appending an empty string to a file would result in the change of :field:`mtime` in some operating systems, but this would not be deemed as a modification of its contents.\n", + "format": "date-time", + "x-optimade-support": "optional", + "x-optimade-queryable": "optional" + } + }, + "description": "This class contains the Field for the attributes used to represent a file, e.g. ." + }, + "FileResponseMany": { + "title": "FileResponseMany", + "required": [ + "data", + "meta" + ], + "type": "object", + "properties": { + "data": { + "title": "Data", + "uniqueItems": true, + "anyOf": [ { - "$ref": "#/components/schemas/ErrorSource" + "type": "array", + "items": { + "$ref": "#/components/schemas/FileResource" + } + }, + { + "type": "array", + "items": { + "type": "object" + } } ], - "description": "An object containing references to the source of the error" + "description": "List of unique OPTIMADE files entry resource objects." }, "meta": { "title": "Meta", "allOf": [ { - "$ref": "#/components/schemas/Meta" + "$ref": "#/components/schemas/ResponseMeta" } ], - "description": "a meta object containing non-standard meta-information about the error." - } - }, - "description": "An error response" - }, - "ErrorLinks": { - "title": "ErrorLinks", - "type": "object", - "properties": { - "about": { - "title": "About", + "description": "A meta object containing non-standard information" + }, + "errors": { + "title": "Errors", + "uniqueItems": true, + "type": "array", + "items": { + "$ref": "#/components/schemas/Error" + }, + "description": "A list of unique errors" + }, + "included": { + "title": "Included", + "uniqueItems": true, "anyOf": [ { - "maxLength": 65536, - "minLength": 1, - "type": "string", - "format": "uri" + "type": "array", + "items": { + "$ref": "#/components/schemas/EntryResource" + } }, { - "$ref": "#/components/schemas/Link" + "type": "array", + "items": { + "type": "object" + } + } + ] + }, + "links": { + "title": "Links", + "allOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" } ], - "description": "A link that leads to further details about this particular occurrence of the problem." + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "title": "Jsonapi", + "allOf": [ + { + "$ref": "#/components/schemas/JsonApi" + } + ], + "description": "Information about the JSON API used" } }, - "description": "A Links object specific to Error objects" + "description": "errors are not allowed" }, - "ErrorResponse": { - "title": "ErrorResponse", + "FileResponseOne": { + "title": "FileResponseOne", "required": [ - "meta", - "errors" + "data", + "meta" ], "type": "object", "properties": { "data": { "title": "Data", - "uniqueItems": true, "anyOf": [ { - "$ref": "#/components/schemas/Resource" + "$ref": "#/components/schemas/FileResource" }, { - "type": "array", - "items": { - "$ref": "#/components/schemas/Resource" - } + "type": "object" } ], - "description": "Outputted Data" + "description": "A single files entry resource." }, "meta": { "title": "Meta", @@ -1953,25 +2731,34 @@ "$ref": "#/components/schemas/ResponseMeta" } ], - "description": "A meta object containing non-standard information." + "description": "A meta object containing non-standard information" }, "errors": { "title": "Errors", "uniqueItems": true, "type": "array", "items": { - "$ref": "#/components/schemas/OptimadeError" + "$ref": "#/components/schemas/Error" }, - "description": "A list of OPTIMADE-specific JSON API error objects, where the field detail MUST be present." + "description": "A list of unique errors" }, "included": { "title": "Included", "uniqueItems": true, - "type": "array", - "items": { - "$ref": "#/components/schemas/Resource" - }, - "description": "A list of unique included resources" + "anyOf": [ + { + "type": "array", + "items": { + "$ref": "#/components/schemas/EntryResource" + } + }, + { + "type": "array", + "items": { + "type": "object" + } + } + ] }, "links": { "title": "Links", @@ -1992,24 +2779,7 @@ "description": "Information about the JSON API used" } }, - "description": "errors MUST be present and data MUST be skipped" - }, - "ErrorSource": { - "title": "ErrorSource", - "type": "object", - "properties": { - "pointer": { - "title": "Pointer", - "type": "string", - "description": "a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute]." - }, - "parameter": { - "title": "Parameter", - "type": "string", - "description": "a string indicating which URI query parameter caused the error." - } - }, - "description": "an object containing references to the source of the error" + "description": "errors are not allowed" }, "Implementation": { "title": "Implementation", diff --git a/optimade/server/main.py b/optimade/server/main.py index 4f95dcccb..8abd33e14 100644 --- a/optimade/server/main.py +++ b/optimade/server/main.py @@ -22,6 +22,7 @@ from optimade.server.logger import LOGGER from optimade.server.middleware import OPTIMADE_MIDDLEWARE from optimade.server.routers import ( + files, info, landing, links, @@ -31,6 +32,8 @@ ) from optimade.server.routers.utils import BASE_URL_PREFIXES, JSONAPIResponse +ENDPOINTS = (info, landing, links, references, structures, files) + if config_warnings: LOGGER.warn( f"Invalid config file or no config file provided, running server with default settings. Errors: " @@ -103,13 +106,13 @@ def load_entries(endpoint_name: str, endpoint_collection: EntryCollection): app.add_exception_handler(exception, handler) # Add various endpoints to unversioned URL -for endpoint in (info, links, references, structures, landing, versions): +for endpoint in ENDPOINTS + (versions,): app.include_router(endpoint.router) def add_major_version_base_url(app: FastAPI): """Add mandatory vMajor endpoints, i.e. all except versions.""" - for endpoint in (info, links, references, structures, landing): + for endpoint in ENDPOINTS: app.include_router(endpoint.router, prefix=BASE_URL_PREFIXES["major"]) @@ -121,7 +124,7 @@ def add_optional_versioned_base_urls(app: FastAPI): ``` """ for version in ("minor", "patch"): - for endpoint in (info, links, references, structures, landing): + for endpoint in ENDPOINTS: app.include_router(endpoint.router, prefix=BASE_URL_PREFIXES[version]) From 4302b2cd19a1e155a2840f1cff8d7a77366007ad Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 6 Dec 2022 15:53:35 +0000 Subject: [PATCH 6/8] Format test file --- optimade/server/data/test_files.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/optimade/server/data/test_files.json b/optimade/server/data/test_files.json index f56b9db21..2ec844099 100644 --- a/optimade/server/data/test_files.json +++ b/optimade/server/data/test_files.json @@ -1,4 +1,11 @@ -[{"url": "www.example.com/file001.pdb", "name": "file001.pdb", "size": 12536, "media_type": "chemical/x-pdb","modification_timestamp": { - "$date": "2022-08-26T13:09:37.945Z" +[ + { + "url": "www.example.com/file001.pdb", + "name": "file001.pdb", + "size": 12536, + "media_type": "chemical/x-pdb", + "modification_timestamp": { + "$date": "2022-08-26T13:09:37.945Z" + } } -}] +] From 28d4a8b9d81c2918c30e973df30c7aa8aa562dfe Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Tue, 6 Dec 2022 16:05:49 +0000 Subject: [PATCH 7/8] Update elastic_indexes.json with fields from `files` --- .../entry_collections/elastic_indexes.json | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/optimade/server/entry_collections/elastic_indexes.json b/optimade/server/entry_collections/elastic_indexes.json index a6f954582..376657f62 100644 --- a/optimade/server/entry_collections/elastic_indexes.json +++ b/optimade/server/entry_collections/elastic_indexes.json @@ -152,6 +152,60 @@ }, "lattice_vectors": { "type": "float" + }, + "immutable_id": { + "type": "keyword" + }, + "last_modified": { + "type": "date" + }, + "species": { + "type": "object" + } + } + } + }, + "files": { + "mappings": { + "properties": { + "url": { + "type": "keyword" + }, + "url_stable_until": { + "type": "date" + }, + "name": { + "type": "keyword" + }, + "size": { + "type": "integer" + }, + "media_type": { + "type": "str" + }, + "version": { + "type": "keyword" + }, + "modification_timestamp": { + "type": "date" + }, + "checksums": { + "type": "object" + }, + "id": { + "type": "keyword" + }, + "description": { + "type": "integer" + }, + "atime": { + "type": "date" + }, + "ctime": { + "type": "date" + }, + "mtime": { + "type": "date" } } } From ff2db528de526656209882f57ba3d52239c871d2 Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Mon, 26 Aug 2024 13:53:01 +0100 Subject: [PATCH 8/8] Some linting for 2024 --- openapi/openapi.json | 5721 ++++++++++++++++++++++++++++++ optimade/models/files.py | 8 +- optimade/models/responses.py | 4 +- optimade/server/config.py | 22 +- optimade/server/mappers/files.py | 1 - 5 files changed, 5733 insertions(+), 23 deletions(-) diff --git a/openapi/openapi.json b/openapi/openapi.json index e69de29bb..3c46ce875 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -0,0 +1,5721 @@ +{ + "openapi": "3.1.0", + "info": { + "title": "OPTIMADE API", + "description": "The [Open Databases Integration for Materials Design (OPTIMADE) consortium](https://www.optimade.org/) aims to make materials databases interoperational by developing a common REST API.\n\nThis specification is generated using [`optimade-python-tools`](https://github.com/Materials-Consortia/optimade-python-tools/tree/v1.1.1) v1.1.1.", + "version": "1.1.0" + }, + "paths": { + "/info": { + "get": { + "tags": [ + "Info" + ], + "summary": "Get Info", + "operationId": "get_info_info_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/InfoResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/info/{entry}": { + "get": { + "tags": [ + "Info" + ], + "summary": "Get Entry Info", + "operationId": "get_entry_info_info__entry__get", + "parameters": [ + { + "name": "entry", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Entry" + } + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/EntryInfoResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/links": { + "get": { + "tags": [ + "Links" + ], + "summary": "Get Links", + "operationId": "get_links_links_get", + "parameters": [ + { + "name": "filter", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification.", + "default": "", + "title": "Filter" + }, + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification." + }, + { + "name": "response_format", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json", + "title": "Response Format" + }, + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`" + }, + { + "name": "email_address", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "email", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "default": "", + "title": "Email Address" + }, + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`" + }, + { + "name": "response_fields", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "", + "title": "Response Fields" + }, + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`" + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints.", + "default": "", + "title": "Sort" + }, + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints." + }, + { + "name": "page_limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`", + "default": 20, + "title": "Page Limit" + }, + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`" + }, + { + "name": "page_offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`.", + "default": 0, + "title": "Page Offset" + }, + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`." + }, + { + "name": "page_number", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`.", + "title": "Page Number" + }, + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`." + }, + { + "name": "page_cursor", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED.", + "default": 0, + "title": "Page Cursor" + }, + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED." + }, + { + "name": "page_above", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`.", + "title": "Page Above" + }, + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`." + }, + { + "name": "page_below", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.", + "title": "Page Below" + }, + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED." + }, + { + "name": "include", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references", + "title": "Include" + }, + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`." + }, + { + "name": "api_hint", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "", + "title": "Api Hint" + }, + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0." + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/LinksResponse" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/references": { + "get": { + "tags": [ + "References" + ], + "summary": "Get References", + "operationId": "get_references_references_get", + "parameters": [ + { + "name": "filter", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification.", + "default": "", + "title": "Filter" + }, + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification." + }, + { + "name": "response_format", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json", + "title": "Response Format" + }, + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`" + }, + { + "name": "email_address", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "email", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "default": "", + "title": "Email Address" + }, + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`" + }, + { + "name": "response_fields", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "", + "title": "Response Fields" + }, + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`" + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints.", + "default": "", + "title": "Sort" + }, + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints." + }, + { + "name": "page_limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`", + "default": 20, + "title": "Page Limit" + }, + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`" + }, + { + "name": "page_offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`.", + "default": 0, + "title": "Page Offset" + }, + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`." + }, + { + "name": "page_number", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`.", + "title": "Page Number" + }, + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`." + }, + { + "name": "page_cursor", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED.", + "default": 0, + "title": "Page Cursor" + }, + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED." + }, + { + "name": "page_above", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`.", + "title": "Page Above" + }, + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`." + }, + { + "name": "page_below", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.", + "title": "Page Below" + }, + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED." + }, + { + "name": "include", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references", + "title": "Include" + }, + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`." + }, + { + "name": "api_hint", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "", + "title": "Api Hint" + }, + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0." + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ReferenceResponseMany" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/references/{entry_id}": { + "get": { + "tags": [ + "References" + ], + "summary": "Get Single Reference", + "operationId": "get_single_reference_references__entry_id__get", + "parameters": [ + { + "name": "entry_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Entry Id" + } + }, + { + "name": "response_format", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json", + "title": "Response Format" + }, + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`" + }, + { + "name": "email_address", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "email", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "default": "", + "title": "Email Address" + }, + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`" + }, + { + "name": "response_fields", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "", + "title": "Response Fields" + }, + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`" + }, + { + "name": "include", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references", + "title": "Include" + }, + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`." + }, + { + "name": "api_hint", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "", + "title": "Api Hint" + }, + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0." + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ReferenceResponseOne" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/structures": { + "get": { + "tags": [ + "Structures" + ], + "summary": "Get Structures", + "operationId": "get_structures_structures_get", + "parameters": [ + { + "name": "filter", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification.", + "default": "", + "title": "Filter" + }, + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification." + }, + { + "name": "response_format", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json", + "title": "Response Format" + }, + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`" + }, + { + "name": "email_address", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "email", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "default": "", + "title": "Email Address" + }, + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`" + }, + { + "name": "response_fields", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "", + "title": "Response Fields" + }, + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`" + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints.", + "default": "", + "title": "Sort" + }, + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints." + }, + { + "name": "page_limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`", + "default": 20, + "title": "Page Limit" + }, + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`" + }, + { + "name": "page_offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`.", + "default": 0, + "title": "Page Offset" + }, + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`." + }, + { + "name": "page_number", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`.", + "title": "Page Number" + }, + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`." + }, + { + "name": "page_cursor", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED.", + "default": 0, + "title": "Page Cursor" + }, + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED." + }, + { + "name": "page_above", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`.", + "title": "Page Above" + }, + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`." + }, + { + "name": "page_below", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.", + "title": "Page Below" + }, + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED." + }, + { + "name": "include", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references", + "title": "Include" + }, + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`." + }, + { + "name": "api_hint", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "", + "title": "Api Hint" + }, + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0." + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/StructureResponseMany" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/structures/{entry_id}": { + "get": { + "tags": [ + "Structures" + ], + "summary": "Get Single Structure", + "operationId": "get_single_structure_structures__entry_id__get", + "parameters": [ + { + "name": "entry_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Entry Id" + } + }, + { + "name": "response_format", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json", + "title": "Response Format" + }, + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`" + }, + { + "name": "email_address", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "email", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "default": "", + "title": "Email Address" + }, + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`" + }, + { + "name": "response_fields", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "", + "title": "Response Fields" + }, + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`" + }, + { + "name": "include", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references", + "title": "Include" + }, + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`." + }, + { + "name": "api_hint", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "", + "title": "Api Hint" + }, + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0." + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/StructureResponseOne" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/files": { + "get": { + "tags": [ + "Files" + ], + "summary": "Get Files", + "operationId": "get_files_files_get", + "parameters": [ + { + "name": "filter", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification.", + "default": "", + "title": "Filter" + }, + "description": "A filter string, in the format described in section API Filtering Format Specification of the specification." + }, + { + "name": "response_format", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json", + "title": "Response Format" + }, + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`" + }, + { + "name": "email_address", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "email", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "default": "", + "title": "Email Address" + }, + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`" + }, + { + "name": "response_fields", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "", + "title": "Response Fields" + }, + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`" + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints.", + "default": "", + "title": "Sort" + }, + "description": "If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/` endpoint MUST include, for each field name `` in its `data.properties.` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the \"sort fields\" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints." + }, + { + "name": "page_limit", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`", + "default": 20, + "title": "Page Limit" + }, + "description": "Sets a numerical limit on the number of entries returned.\nSee [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-pagination).\nThe API implementation MUST return no more than the number specified.\nIt MAY return fewer.\nThe database MAY have a maximum limit and not accept larger numbers (in which case an error code -- 403 Forbidden -- MUST be returned).\nThe default limit value is up to the API implementation to decide.\nExample: `http://example.com/optimade/v1/structures?page_limit=100`" + }, + { + "name": "page_offset", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`.", + "default": 0, + "title": "Page Offset" + }, + "description": "RECOMMENDED for use with _offset-based_ pagination: using `page_offset` and `page_limit` is RECOMMENDED.\nExample: Skip 50 structures and fetch up to 100: `/structures?page_offset=50&page_limit=100`." + }, + { + "name": "page_number", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`.", + "title": "Page Number" + }, + "description": "RECOMMENDED for use with _page-based_ pagination: using `page_number` and `page_limit` is RECOMMENDED.\nIt is RECOMMENDED that the first page has number 1, i.e., that `page_number` is 1-based.\nExample: Fetch page 2 of up to 50 structures per page: `/structures?page_number=2&page_limit=50`." + }, + { + "name": "page_cursor", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "minimum": 0, + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED.", + "default": 0, + "title": "Page Cursor" + }, + "description": "RECOMMENDED for use with _cursor-based_ pagination: using `page_cursor` and `page_limit` is RECOMMENDED." + }, + { + "name": "page_above", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`.", + "title": "Page Above" + }, + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.\nExample: Fetch up to 100 structures above sort-field value 4000 (in this example, server chooses to fetch results sorted by increasing `id`, so `page_above` value refers to an `id` value): `/structures?page_above=4000&page_limit=100`." + }, + { + "name": "page_below", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED.", + "title": "Page Below" + }, + "description": "RECOMMENDED for use with _value-based_ pagination: using `page_above`/`page_below` and `page_limit` is RECOMMENDED." + }, + { + "name": "include", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references", + "title": "Include" + }, + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`." + }, + { + "name": "api_hint", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "", + "title": "Api Hint" + }, + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0." + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/FileResponseMany" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/files/{entry_id}": { + "get": { + "tags": [ + "Files" + ], + "summary": "Get Single File", + "operationId": "get_single_file_files__entry_id__get", + "parameters": [ + { + "name": "entry_id", + "in": "path", + "required": true, + "schema": { + "type": "string", + "title": "Entry Id" + } + }, + { + "name": "response_format", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`", + "default": "json", + "title": "Response Format" + }, + "description": "The output format requested (see section Response Format).\nDefaults to the format string 'json', which specifies the standard output format described in this specification.\nExample: `http://example.com/v1/structures?response_format=xml`" + }, + { + "name": "email_address", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "email", + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`", + "default": "", + "title": "Email Address" + }, + "description": "An email address of the user making the request.\nThe email SHOULD be that of a person and not an automatic system.\nExample: `http://example.com/v1/structures?email_address=user@example.com`" + }, + { + "name": "response_fields", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", + "default": "", + "title": "Response Fields" + }, + "description": "A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`" + }, + { + "name": "include", + "in": "query", + "required": false, + "schema": { + "type": "string", + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`.", + "default": "references", + "title": "Include" + }, + "description": "A server MAY implement the JSON API concept of returning [compound documents](https://jsonapi.org/format/1.0/#document-compound-documents) by utilizing the `include` query parameter as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-includes).\n\nAll related resource objects MUST be returned as part of an array value for the top-level `included` field, see the section JSON Response Schema: Common Fields.\n\nThe value of `include` MUST be a comma-separated list of \"relationship paths\", as defined in the [JSON API](https://jsonapi.org/format/1.0/#fetching-includes).\nIf relationship paths are not supported, or a server is unable to identify a relationship path a `400 Bad Request` response MUST be made.\n\nThe **default value** for `include` is `references`.\nThis means `references` entries MUST always be included under the top-level field `included` as default, since a server assumes if `include` is not specified by a client in the request, it is still specified as `include=references`.\nNote, if a client explicitly specifies `include` and leaves out `references`, `references` resource objects MUST NOT be included under the top-level field `included`, as per the definition of `included`, see section JSON Response Schema: Common Fields.\n\n> **Note**: A query with the parameter `include` set to the empty string means no related resource objects are to be returned under the top-level field `included`." + }, + { + "name": "api_hint", + "in": "query", + "required": false, + "schema": { + "type": "string", + "pattern": "(v[0-9]+(\\.[0-9]+)?)?", + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0.", + "default": "", + "title": "Api Hint" + }, + "description": "If the client provides the parameter, the value SHOULD have the format `vMAJOR` or `vMAJOR.MINOR`, where MAJOR is a major version and MINOR is a minor version of the API. For example, if a client appends `api_hint=v1.0` to the query string, the hint provided is for major version 1 and minor version 0." + } + ], + "responses": { + "200": { + "description": "Successful Response", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/FileResponseOne" + } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "404": { + "description": "Not Found", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "422": { + "description": "Unprocessable Entity", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "500": { + "description": "Internal Server Error", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "501": { + "description": "Not Implemented", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + }, + "553": { + "description": "Version Not Supported", + "content": { + "application/vnd.api+json": { + "schema": { + "$ref": "#/components/schemas/ErrorResponse" + } + } + } + } + } + } + }, + "/versions": { + "get": { + "tags": [ + "Versions" + ], + "summary": "Get Versions", + "description": "Respond with the text/csv representation for the served versions.", + "operationId": "get_versions_versions_get", + "responses": { + "200": { + "description": "Successful Response", + "content": { + "text/csv; header=present": { + "schema": { + "type": "string" + } + } + } + } + } + } + } + }, + "components": { + "schemas": { + "Aggregate": { + "type": "string", + "enum": [ + "ok", + "test", + "staging", + "no" + ], + "title": "Aggregate", + "description": "Enumeration of aggregate values" + }, + "Assembly": { + "properties": { + "sites_in_groups": { + "items": { + "items": { + "type": "integer" + }, + "type": "array" + }, + "type": "array", + "title": "Sites In Groups", + "description": "Index of the sites (0-based) that belong to each group for each assembly.\n\n- **Examples**:\n - `[[1], [2]]`: two groups, one with the second site, one with the third.\n - `[[1,2], [3]]`: one group with the second and third site, one with the fourth.", + "x-optimade-queryable": "optional", + "x-optimade-support": "must" + }, + "group_probabilities": { + "items": { + "type": "number" + }, + "type": "array", + "title": "Group Probabilities", + "description": "Statistical probability of each group. It MUST have the same length as `sites_in_groups`.\nIt SHOULD sum to one.\nSee below for examples of how to specify the probability of the occurrence of a vacancy.\nThe possible reasons for the values not to sum to one are the same as already specified above for the `concentration` of each `species`.", + "x-optimade-queryable": "optional", + "x-optimade-support": "must" + } + }, + "type": "object", + "required": [ + "sites_in_groups", + "group_probabilities" + ], + "title": "Assembly", + "description": "A description of groups of sites that are statistically correlated.\n\n- **Examples** (for each entry of the assemblies list):\n - `{\"sites_in_groups\": [[0], [1]], \"group_probabilities: [0.3, 0.7]}`: the first site and the second site never occur at the same time in the unit cell.\n Statistically, 30 % of the times the first site is present, while 70 % of the times the second site is present.\n - `{\"sites_in_groups\": [[1,2], [3]], \"group_probabilities: [0.3, 0.7]}`: the second and third site are either present together or not present; they form the first group of atoms for this assembly.\n The second group is formed by the fourth site. Sites of the first group (the second and the third) are never present at the same time as the fourth site.\n 30 % of times sites 1 and 2 are present (and site 3 is absent); 70 % of times site 3 is present (and sites 1 and 2 are absent)." + }, + "Attributes": { + "properties": {}, + "additionalProperties": true, + "type": "object", + "title": "Attributes", + "description": "Members of the attributes object (\"attributes\") represent information about the resource object in which it's defined.\nThe keys for Attributes MUST NOT be:\n relationships\n links\n id\n type" + }, + "AvailableApiVersion": { + "properties": { + "url": { + "type": "string", + "minLength": 1, + "pattern": "^.+/v[0-1](\\.[0-9]+)*/?$", + "format": "uri", + "title": "Url", + "description": "A string specifying a versioned base URL that MUST adhere to the rules in section Base URL" + }, + "version": { + "type": "string", + "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", + "title": "Version", + "description": "A string containing the full version number of the API served at that versioned base URL.\nThe version number string MUST NOT be prefixed by, e.g., 'v'.\nExamples: `1.0.0`, `1.0.0-rc.2`.", + "examples": [ + "0.10.1", + "1.0.0-rc.2", + "1.2.3-rc.5+develop" + ] + } + }, + "type": "object", + "required": [ + "url", + "version" + ], + "title": "AvailableApiVersion", + "description": "A JSON object containing information about an available API version" + }, + "BaseInfoAttributes": { + "properties": { + "api_version": { + "type": "string", + "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", + "title": "Api Version", + "description": "Presently used full version of the OPTIMADE API.\nThe version number string MUST NOT be prefixed by, e.g., \"v\".\nExamples: `1.0.0`, `1.0.0-rc.2`.", + "examples": [ + "0.10.1", + "1.0.0-rc.2", + "1.2.3-rc.5+develop" + ] + }, + "available_api_versions": { + "items": { + "$ref": "#/components/schemas/AvailableApiVersion" + }, + "type": "array", + "title": "Available Api Versions", + "description": "A list of dictionaries of available API versions at other base URLs" + }, + "formats": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Formats", + "description": "List of available output formats.", + "default": [ + "json" + ] + }, + "available_endpoints": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Available Endpoints", + "description": "List of available endpoints (i.e., the string to be appended to the versioned base URL)." + }, + "entry_types_by_format": { + "additionalProperties": { + "items": { + "type": "string" + }, + "type": "array" + }, + "type": "object", + "title": "Entry Types By Format", + "description": "Available entry endpoints as a function of output formats." + }, + "is_index": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Is Index", + "description": "If true, this is an index meta-database base URL (see section Index Meta-Database). If this member is not provided, the client MUST assume this is not an index meta-database base URL (i.e., the default is for `is_index` to be `false`).", + "default": false + } + }, + "type": "object", + "required": [ + "api_version", + "available_api_versions", + "available_endpoints", + "entry_types_by_format" + ], + "title": "BaseInfoAttributes", + "description": "Attributes for Base URL Info endpoint" + }, + "BaseInfoResource": { + "properties": { + "id": { + "type": "string", + "enum": [ + "/" + ], + "const": "/", + "title": "Id", + "default": "/" + }, + "type": { + "type": "string", + "enum": [ + "info" + ], + "const": "info", + "title": "Type", + "default": "info" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing links related to the resource." + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." + }, + "attributes": { + "$ref": "#/components/schemas/BaseInfoAttributes" + }, + "relationships": { + "anyOf": [ + { + "$ref": "#/components/schemas/Relationships" + }, + { + "type": "null" + } + ], + "description": "[Relationships object](https://jsonapi.org/format/1.0/#document-resource-object-relationships)\ndescribing relationships between the resource and other JSON API resources." + } + }, + "type": "object", + "required": [ + "id", + "type", + "attributes" + ], + "title": "BaseInfoResource" + }, + "BaseRelationshipMeta": { + "properties": { + "description": { + "type": "string", + "title": "Description", + "description": "OPTIONAL human-readable description of the relationship." + } + }, + "additionalProperties": true, + "type": "object", + "required": [ + "description" + ], + "title": "BaseRelationshipMeta", + "description": "Specific meta field for base relationship resource" + }, + "BaseRelationshipResource": { + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "Resource ID" + }, + "type": { + "type": "string", + "title": "Type", + "description": "Resource type" + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/BaseRelationshipMeta" + }, + { + "type": "null" + } + ], + "description": "Relationship meta field. MUST contain 'description' if supplied." + } + }, + "type": "object", + "required": [ + "id", + "type" + ], + "title": "BaseRelationshipResource", + "description": "Minimum requirements to represent a relationship resource" + }, + "DataType": { + "type": "string", + "enum": [ + "string", + "integer", + "float", + "boolean", + "timestamp", + "list", + "dictionary", + "unknown" + ], + "title": "DataType", + "description": "Optimade Data types\n\nSee the section \"Data types\" in the OPTIMADE API specification for more information." + }, + "EntryInfoProperty": { + "properties": { + "description": { + "type": "string", + "title": "Description", + "description": "A human-readable description of the entry property" + }, + "unit": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Unit", + "description": "The physical unit of the entry property.\nThis MUST be a valid representation of units according to version 2.1 of [The Unified Code for Units of Measure](https://unitsofmeasure.org/ucum.html).\nIt is RECOMMENDED that non-standard (non-SI) units are described in the description for the property." + }, + "sortable": { + "anyOf": [ + { + "type": "boolean" + }, + { + "type": "null" + } + ], + "title": "Sortable", + "description": "Defines whether the entry property can be used for sorting with the \"sort\" parameter.\nIf the entry listing endpoint supports sorting, this key MUST be present for sortable properties with value `true`." + }, + "type": { + "anyOf": [ + { + "$ref": "#/components/schemas/DataType" + }, + { + "type": "null" + } + ], + "title": "Type", + "description": "The type of the property's value.\nThis MUST be any of the types defined in the Data types section.\nFor the purpose of compatibility with future versions of this specification, a client MUST accept values that are not `string` values specifying any of the OPTIMADE Data types, but MUST then also disregard the `type` field.\nNote, if the value is a nested type, only the outermost type should be reported.\nE.g., for the entry resource `structures`, the `species` property is defined as a list of dictionaries, hence its `type` value would be `list`." + } + }, + "type": "object", + "required": [ + "description" + ], + "title": "EntryInfoProperty" + }, + "EntryInfoResource": { + "properties": { + "formats": { + "items": { + "type": "string" + }, + "type": "array", + "title": "Formats", + "description": "List of output formats available for this type of entry." + }, + "description": { + "type": "string", + "title": "Description", + "description": "Description of the entry." + }, + "properties": { + "patternProperties": { + "^[a-z_][a-z_0-9]+$": { + "$ref": "#/components/schemas/EntryInfoProperty" + } + }, + "type": "object", + "title": "Properties", + "description": "A dictionary describing queryable properties for this entry type, where each key is a property name." + }, + "output_fields_by_format": { + "additionalProperties": { + "items": { + "type": "string", + "pattern": "^[a-z_][a-z_0-9]+$" + }, + "type": "array" + }, + "type": "object", + "title": "Output Fields By Format", + "description": "Dictionary of available output fields for this entry type, where the keys are the values of the `formats` list and the values are the keys of the `properties` dictionary." + } + }, + "type": "object", + "required": [ + "formats", + "description", + "properties", + "output_fields_by_format" + ], + "title": "EntryInfoResource" + }, + "EntryInfoResponse": { + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/EntryInfoResource" + } + ], + "description": "OPTIMADE information for an entry endpoint." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Resource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included resources" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "EntryInfoResponse" + }, + "EntryRelationships": { + "properties": { + "references": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReferenceRelationship" + }, + { + "type": "null" + } + ], + "description": "Object containing links to relationships with entries of the `references` type." + }, + "structures": { + "anyOf": [ + { + "$ref": "#/components/schemas/StructureRelationship" + }, + { + "type": "null" + } + ], + "description": "Object containing links to relationships with entries of the `structures` type." + } + }, + "type": "object", + "title": "EntryRelationships", + "description": "This model wraps the JSON API Relationships to include type-specific top level keys." + }, + "EntryResource": { + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "type": { + "type": "string", + "title": "Type", + "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Example**: `\"structures\"`", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing links related to the resource." + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/EntryResourceAttributes" + } + ], + "description": "A dictionary, containing key-value pairs representing the entry's properties, except for `type` and `id`.\nDatabase-provider-specific properties need to include the database-provider-specific prefix (see section on Database-Provider-Specific Namespace Prefixes)." + }, + "relationships": { + "anyOf": [ + { + "$ref": "#/components/schemas/EntryRelationships" + }, + { + "type": "null" + } + ], + "description": "A dictionary containing references to other entries according to the description in section Relationships encoded as [JSON API Relationships](https://jsonapi.org/format/1.0/#document-resource-object-relationships).\nThe OPTIONAL human-readable description of the relationship MAY be provided in the `description` field inside the `meta` dictionary of the JSON API resource identifier object." + } + }, + "type": "object", + "required": [ + "id", + "type", + "attributes" + ], + "title": "EntryResource", + "description": "The base model for an entry resource." + }, + "EntryResourceAttributes": { + "properties": { + "immutable_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Immutable Id", + "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", + "x-optimade-queryable": "must", + "x-optimade-support": "optional" + }, + "last_modified": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Last Modified", + "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + } + }, + "additionalProperties": true, + "type": "object", + "required": [ + "last_modified" + ], + "title": "EntryResourceAttributes", + "description": "Contains key-value pairs representing the entry's properties." + }, + "Error": { + "properties": { + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id", + "description": "A unique identifier for this particular occurrence of the problem." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ErrorLinks" + }, + { + "type": "null" + } + ], + "description": "A links object storing about" + }, + "status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Status", + "description": "the HTTP status code applicable to this problem, expressed as a string value." + }, + "code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Code", + "description": "an application-specific error code, expressed as a string value." + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Title", + "description": "A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization." + }, + "detail": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Detail", + "description": "A human-readable explanation specific to this occurrence of the problem." + }, + "source": { + "anyOf": [ + { + "$ref": "#/components/schemas/ErrorSource" + }, + { + "type": "null" + } + ], + "description": "An object containing references to the source of the error" + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about the error." + } + }, + "type": "object", + "title": "Error", + "description": "An error response" + }, + "ErrorLinks": { + "properties": { + "about": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "About", + "description": "A link that leads to further details about this particular occurrence of the problem." + } + }, + "type": "object", + "title": "ErrorLinks", + "description": "A Links object specific to Error objects" + }, + "ErrorResponse": { + "properties": { + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "items": { + "$ref": "#/components/schemas/Resource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Data", + "description": "Outputted Data" + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information." + }, + "errors": { + "items": { + "$ref": "#/components/schemas/OptimadeError" + }, + "type": "array", + "uniqueItems": true, + "title": "Errors", + "description": "A list of OPTIMADE-specific JSON API error objects, where the field detail MUST be present." + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Resource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included resources" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "meta", + "errors" + ], + "title": "ErrorResponse", + "description": "errors MUST be present and data MUST be skipped" + }, + "ErrorSource": { + "properties": { + "pointer": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Pointer", + "description": "a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. \"/data\" for a primary data object, or \"/data/attributes/title\" for a specific attribute]." + }, + "parameter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Parameter", + "description": "a string indicating which URI query parameter caused the error." + } + }, + "type": "object", + "title": "ErrorSource", + "description": "an object containing references to the source of the error" + }, + "FileResource": { + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "type": { + "type": "string", + "pattern": "^files$", + "title": "Type", + "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Examples**:\n - `\"structures\"`", + "default": "files", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing links related to the resource." + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." + }, + "attributes": { + "$ref": "#/components/schemas/FileResourceAttributes" + }, + "relationships": { + "anyOf": [ + { + "$ref": "#/components/schemas/EntryRelationships" + }, + { + "type": "null" + } + ], + "description": "A dictionary containing references to other entries according to the description in section Relationships encoded as [JSON API Relationships](https://jsonapi.org/format/1.0/#document-resource-object-relationships).\nThe OPTIONAL human-readable description of the relationship MAY be provided in the `description` field inside the `meta` dictionary of the JSON API resource identifier object." + } + }, + "type": "object", + "required": [ + "id", + "type", + "attributes" + ], + "title": "FileResource", + "description": "Representing a structure." + }, + "FileResourceAttributes": { + "properties": { + "immutable_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Immutable Id", + "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", + "x-optimade-queryable": "must", + "x-optimade-support": "optional" + }, + "last_modified": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Last Modified", + "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "url": { + "type": "string", + "title": "Url", + "description": "The URL to get the contents of a file.\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: MUST be supported by all implementations, MUST NOT be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - **Response**: REQUIRED in the response.\n - The URL MUST point to the actual contents of a file (i.e. byte stream), not an intermediate (preview) representation.\n For example, if referring to a file on GitHub, a link should point to raw contents.\n\n- **Examples**:\n\n - :val:`\"https://example.org/files/cifs/1000000.cif\"`\n", + "x-optimade-queryable": "optional", + "x-optimade-support": "must" + }, + "url_stable_until": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Url Stable Until", + "description": "Point in time until which the URL in `url` is guaranteed to stay stable.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - :val:`null` means that there is no stability guarantee for the URL in `url`.\n Indefinite support could be communicated by providing a date sufficiently far in the future, for example, :val:`9999-12-31`.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "name": { + "type": "string", + "title": "Name", + "description": "Base name of a file.\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: MUST be supported by all implementations, MUST NOT be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - File name extension is an integral part of a file name and, if available, MUST be included.\n\n- **Examples**:\n\n - :val:`\"1000000.cif\"`", + "x-optimade-queryable": "optional", + "x-optimade-support": "must" + }, + "size": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Size", + "description": "Size of a file in bytes.\n- **Type**: integer\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - If provided, it MUST be guaranteed that either exact size of a file is given or its upper bound.\n This way if a client reserves a static buffer or truncates the download stream after this many bytes the whole file would be received.\n Such provision is included to allow the providers to serve on-the-fly compressed files.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "media_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Media Type", + "description": "Media type identifier (also known as MIME type), for a file as per `RFC 6838 Media Type Specifications and Registration Procedures `__.\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n\n- **Examples**:\n\n - :val:`\"chemical/x-cif\"`", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "version": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Version", + "description": "Version information of a file (e.g. commit, revision, timestamp).\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - If provided, it MUST be guaranteed that file contents pertaining to the same combination of :field:`id` and :field:`version` are the same", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "modification_timestamp": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Modification Timestamp", + "description": "Timestamp of the last modification of file contents.\n A modification is understood as an addition, change or deletion of one or more bytes, resulting in file contents different from the previous.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - Timestamps of subsequent file modifications SHOULD be increasing (not earlier than previous timestamps).", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "description": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Description", + "description": "Free-form description of a file.\n- **Type**: string\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n\n- **Examples**:\n\n - :val:`\"POSCAR format file\"`", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "checksums": { + "anyOf": [ + { + "additionalProperties": { + "type": "string" + }, + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Checksums", + "description": "Dictionary providing checksums of file contents.\n* **Type**: dictionary with keys identifying checksum functions and values (strings) giving the actual checksums\n* **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - Supported dictionary keys: :property:`md5`, :property:`sha1`, :property:`sha224`, :property:`sha256`, :property:`sha384`, :property:`sha512`.\n Checksums outside this list MAY be used, but their names MUST be prefixed by database-provider-specific namespace prefix (see appendix `Database-Provider-Specific Namespace Prefixes`_).\n", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "atime": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Atime", + "description": "Time of last access of a file as per POSIX standard.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "ctime": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Ctime", + "description": "Time of last status change of a file as per POSIX standard.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional", + "x-optimade-unit": "\u00c5" + }, + "mtime": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Mtime", + "description": " Time of last modification of a file as per POSIX standard.\n- **Type**: timestamp\n- **Requirements/Conventions**:\n\n - **Support**: OPTIONAL support in implementations, i.e., MAY be :val:`null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - It should be noted that the values of :field:`last_modified`, :field:`modification_timestamp` and :field:`mtime` do not necessary match.\n :field:`last_modified` pertains to the modification of the OPTIMADE metadata, :field:`modification_timestamp` pertains to file contents and :field:`mtime` pertains to the modification of the file (not necessary changing its contents).\n For example, appending an empty string to a file would result in the change of :field:`mtime` in some operating systems, but this would not be deemed as a modification of its contents.\n", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + } + }, + "additionalProperties": true, + "type": "object", + "required": [ + "last_modified", + "url", + "url_stable_until", + "name", + "size", + "media_type", + "modification_timestamp", + "description", + "checksums", + "atime", + "ctime", + "mtime" + ], + "title": "FileResourceAttributes", + "description": "This class contains the Field for the attributes used to represent a file, e.g. ." + }, + "FileResponseMany": { + "properties": { + "data": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/FileResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + } + ], + "uniqueItems": true, + "title": "Data", + "description": "List of unique OPTIMADE files entry resource objects." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/EntryResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included OPTIMADE entry resources." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "FileResponseMany" + }, + "FileResponseOne": { + "properties": { + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/FileResource" + }, + { + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Data", + "description": "A single files entry resource." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/EntryResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included OPTIMADE entry resources." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "FileResponseOne" + }, + "Implementation": { + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Name", + "description": "name of the implementation" + }, + "version": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Version", + "description": "version string of the current implementation" + }, + "homepage": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Homepage", + "description": "A [JSON API links object](http://jsonapi.org/format/1.0/#document-links) pointing to the homepage of the implementation." + }, + "source_url": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Source Url", + "description": "A [JSON API links object](http://jsonapi.org/format/1.0/#document-links) pointing to the implementation source, either downloadable archive or version control system." + }, + "maintainer": { + "anyOf": [ + { + "$ref": "#/components/schemas/ImplementationMaintainer" + }, + { + "type": "null" + } + ], + "description": "A dictionary providing details about the maintainer of the implementation." + }, + "issue_tracker": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Issue Tracker", + "description": "A [JSON API links object](http://jsonapi.org/format/1.0/#document-links) pointing to the implementation's issue tracker." + } + }, + "type": "object", + "title": "Implementation", + "description": "Information on the server implementation" + }, + "ImplementationMaintainer": { + "properties": { + "email": { + "type": "string", + "format": "email", + "title": "Email", + "description": "the maintainer's email address" + } + }, + "type": "object", + "required": [ + "email" + ], + "title": "ImplementationMaintainer", + "description": "Details about the maintainer of the implementation" + }, + "InfoResponse": { + "properties": { + "data": { + "allOf": [ + { + "$ref": "#/components/schemas/BaseInfoResource" + } + ], + "description": "The implementations /info data." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Resource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included resources" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "InfoResponse" + }, + "JsonApi": { + "properties": { + "version": { + "type": "string", + "title": "Version", + "description": "Version of the json API used", + "default": "1.0" + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "Non-standard meta information" + } + }, + "type": "object", + "title": "JsonApi", + "description": "An object describing the server's implementation" + }, + "Link": { + "properties": { + "href": { + "type": "string", + "minLength": 1, + "format": "uri", + "title": "Href", + "description": "a string containing the link's URL." + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about the link." + } + }, + "type": "object", + "required": [ + "href" + ], + "title": "Link", + "description": "A link **MUST** be represented as either: a string containing the link's URL or a link object." + }, + "LinkType": { + "type": "string", + "enum": [ + "child", + "root", + "external", + "providers" + ], + "title": "LinkType", + "description": "Enumeration of link_type values" + }, + "LinksResource": { + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "type": { + "type": "string", + "enum": [ + "links" + ], + "const": "links", + "pattern": "^links$", + "title": "Type", + "description": "These objects are described in detail in the section Links Endpoint", + "default": "links" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing links related to the resource." + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." + }, + "attributes": { + "allOf": [ + { + "$ref": "#/components/schemas/LinksResourceAttributes" + } + ], + "description": "A dictionary containing key-value pairs representing the Links resource's properties." + }, + "relationships": { + "anyOf": [ + { + "$ref": "#/components/schemas/EntryRelationships" + }, + { + "type": "null" + } + ], + "description": "A dictionary containing references to other entries according to the description in section Relationships encoded as [JSON API Relationships](https://jsonapi.org/format/1.0/#document-resource-object-relationships).\nThe OPTIONAL human-readable description of the relationship MAY be provided in the `description` field inside the `meta` dictionary of the JSON API resource identifier object." + } + }, + "type": "object", + "required": [ + "id", + "type", + "attributes" + ], + "title": "LinksResource", + "description": "A Links endpoint resource object" + }, + "LinksResourceAttributes": { + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "Human-readable name for the OPTIMADE API implementation, e.g., for use in clients to show the name to the end-user." + }, + "description": { + "type": "string", + "title": "Description", + "description": "Human-readable description for the OPTIMADE API implementation, e.g., for use in clients to show a description to the end-user." + }, + "base_url": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Base Url", + "description": "JSON API links object, pointing to the base URL for this implementation" + }, + "homepage": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Homepage", + "description": "JSON API links object, pointing to a homepage URL for this implementation" + }, + "link_type": { + "allOf": [ + { + "$ref": "#/components/schemas/LinkType" + } + ], + "title": "Link Type", + "description": "The type of the linked relation.\nMUST be one of these values: 'child', 'root', 'external', 'providers'." + }, + "aggregate": { + "anyOf": [ + { + "$ref": "#/components/schemas/Aggregate" + }, + { + "type": "null" + } + ], + "title": "Aggregate", + "description": "A string indicating whether a client that is following links to aggregate results from different OPTIMADE implementations should follow this link or not.\nThis flag SHOULD NOT be indicated for links where `link_type` is not `child`.\n\nIf not specified, clients MAY assume that the value is `ok`.\nIf specified, and the value is anything different than `ok`, the client MUST assume that the server is suggesting not to follow the link during aggregation by default (also if the value is not among the known ones, in case a future specification adds new accepted values).\n\nSpecific values indicate the reason why the server is providing the suggestion.\nA client MAY follow the link anyway if it has reason to do so (e.g., if the client is looking for all test databases, it MAY follow the links marked with `aggregate`=`test`).\n\nIf specified, it MUST be one of the values listed in section Link Aggregate Options.", + "default": "ok" + }, + "no_aggregate_reason": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "No Aggregate Reason", + "description": "An OPTIONAL human-readable string indicating the reason for suggesting not to aggregate results following the link.\nIt SHOULD NOT be present if `aggregate`=`ok`." + } + }, + "additionalProperties": true, + "type": "object", + "required": [ + "name", + "description", + "base_url", + "homepage", + "link_type" + ], + "title": "LinksResourceAttributes", + "description": "Links endpoint resource object attributes" + }, + "LinksResponse": { + "properties": { + "data": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/LinksResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + } + ], + "uniqueItems": true, + "title": "Data", + "description": "List of unique OPTIMADE links resource objects." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/EntryResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included OPTIMADE entry resources." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "LinksResponse" + }, + "Meta": { + "properties": {}, + "additionalProperties": true, + "type": "object", + "title": "Meta", + "description": "Non-standard meta-information that can not be represented as an attribute or relationship." + }, + "OptimadeError": { + "properties": { + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id", + "description": "A unique identifier for this particular occurrence of the problem." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ErrorLinks" + }, + { + "type": "null" + } + ], + "description": "A links object storing about" + }, + "status": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Status", + "description": "the HTTP status code applicable to this problem, expressed as a string value." + }, + "code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Code", + "description": "an application-specific error code, expressed as a string value." + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Title", + "description": "A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization." + }, + "detail": { + "type": "string", + "title": "Detail", + "description": "A human-readable explanation specific to this occurrence of the problem." + }, + "source": { + "anyOf": [ + { + "$ref": "#/components/schemas/ErrorSource" + }, + { + "type": "null" + } + ], + "description": "An object containing references to the source of the error" + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about the error." + } + }, + "type": "object", + "required": [ + "detail" + ], + "title": "OptimadeError", + "description": "detail MUST be present" + }, + "Periodicity": { + "type": "integer", + "enum": [ + 0, + 1 + ], + "title": "Periodicity", + "description": "Integer enumeration of dimension_types values" + }, + "Person": { + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "Full name of the person, REQUIRED.", + "x-optimade-queryable": "optional", + "x-optimade-support": "must" + }, + "firstname": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Firstname", + "description": "First name of the person.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "lastname": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Lastname", + "description": "Last name of the person.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + } + }, + "type": "object", + "required": [ + "name" + ], + "title": "Person", + "description": "A person, i.e., an author, editor or other." + }, + "Provider": { + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "a short name for the database provider" + }, + "description": { + "type": "string", + "title": "Description", + "description": "a longer description of the database provider" + }, + "prefix": { + "type": "string", + "pattern": "^[a-z]([a-z]|[0-9]|_)*$", + "title": "Prefix", + "description": "database-provider-specific prefix as found in section Database-Provider-Specific Namespace Prefixes." + }, + "homepage": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Homepage", + "description": "a [JSON API links object](http://jsonapi.org/format/1.0#document-links) pointing to homepage of the database provider, either directly as a string, or as a link object." + } + }, + "type": "object", + "required": [ + "name", + "description", + "prefix" + ], + "title": "Provider", + "description": "Information on the database provider of the implementation." + }, + "ReferenceRelationship": { + "properties": { + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/RelationshipLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing at least one of the following: self, related" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/BaseRelationshipResource" + }, + { + "items": { + "$ref": "#/components/schemas/BaseRelationshipResource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Data", + "description": "Resource linkage" + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object that contains non-standard meta-information about the relationship." + } + }, + "type": "object", + "title": "ReferenceRelationship" + }, + "ReferenceResource": { + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "type": { + "type": "string", + "enum": [ + "references" + ], + "const": "references", + "pattern": "^references$", + "title": "Type", + "description": "The name of the type of an entry.\n- **Type**: string.\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type and ID MUST be returned in response to a request for `//` under the versioned base URL.\n- **Example**: `\"structures\"`", + "default": "references", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing links related to the resource." + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." + }, + "attributes": { + "$ref": "#/components/schemas/ReferenceResourceAttributes" + }, + "relationships": { + "anyOf": [ + { + "$ref": "#/components/schemas/EntryRelationships" + }, + { + "type": "null" + } + ], + "description": "A dictionary containing references to other entries according to the description in section Relationships encoded as [JSON API Relationships](https://jsonapi.org/format/1.0/#document-resource-object-relationships).\nThe OPTIONAL human-readable description of the relationship MAY be provided in the `description` field inside the `meta` dictionary of the JSON API resource identifier object." + } + }, + "type": "object", + "required": [ + "id", + "type", + "attributes" + ], + "title": "ReferenceResource", + "description": "The `references` entries describe bibliographic references.\n\nThe following properties are used to provide the bibliographic details:\n\n- **address**, **annote**, **booktitle**, **chapter**, **crossref**, **edition**, **howpublished**, **institution**, **journal**, **key**, **month**, **note**, **number**, **organization**, **pages**, **publisher**, **school**, **series**, **title**, **volume**, **year**: meanings of these properties match the [BibTeX specification](http://bibtexml.sourceforge.net/btxdoc.pdf), values are strings;\n- **bib_type**: type of the reference, corresponding to **type** property in the BibTeX specification, value is string;\n- **authors** and **editors**: lists of *person objects* which are dictionaries with the following keys:\n - **name**: Full name of the person, REQUIRED.\n - **firstname**, **lastname**: Parts of the person's name, OPTIONAL.\n- **doi** and **url**: values are strings.\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., any of the properties MAY be `null`.\n - **Query**: Support for queries on any of these properties is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - Every references entry MUST contain at least one of the properties." + }, + "ReferenceResourceAttributes": { + "properties": { + "immutable_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Immutable Id", + "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", + "x-optimade-queryable": "must", + "x-optimade-support": "optional" + }, + "last_modified": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Last Modified", + "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "authors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Person" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Authors", + "description": "List of person objects containing the authors of the reference.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "editors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Person" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Editors", + "description": "List of person objects containing the editors of the reference.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "doi": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Doi", + "description": "The digital object identifier of the reference.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "url": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "type": "null" + } + ], + "title": "Url", + "description": "The URL of the reference.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "address": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Address", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "annote": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Annote", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "booktitle": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Booktitle", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "chapter": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Chapter", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "crossref": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Crossref", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "edition": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Edition", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "howpublished": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Howpublished", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "institution": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Institution", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "journal": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Journal", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "key": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Key", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "month": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Month", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "note": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Note", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "number": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Number", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "organization": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Organization", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "pages": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Pages", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "publisher": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Publisher", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "school": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "School", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "series": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Series", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Title", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "bib_type": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Bib Type", + "description": "Type of the reference, corresponding to the **type** property in the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "volume": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Volume", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "year": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Year", + "description": "Meaning of property matches the BiBTeX specification.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + } + }, + "additionalProperties": true, + "type": "object", + "required": [ + "last_modified" + ], + "title": "ReferenceResourceAttributes", + "description": "Model that stores the attributes of a reference.\n\nMany properties match the meaning described in the\n[BibTeX specification](http://bibtexml.sourceforge.net/btxdoc.pdf)." + }, + "ReferenceResponseMany": { + "properties": { + "data": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/ReferenceResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + } + ], + "uniqueItems": true, + "title": "Data", + "description": "List of unique OPTIMADE references entry resource objects." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/EntryResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included OPTIMADE entry resources." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "ReferenceResponseMany" + }, + "ReferenceResponseOne": { + "properties": { + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/ReferenceResource" + }, + { + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Data", + "description": "A single references entry resource." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/EntryResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included OPTIMADE entry resources." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "ReferenceResponseOne" + }, + "RelationshipLinks": { + "properties": { + "self": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Self", + "description": "A link for the relationship itself (a 'relationship link').\nThis link allows the client to directly manipulate the relationship.\nWhen fetched successfully, this link returns the [linkage](https://jsonapi.org/format/1.0/#document-resource-object-linkage) for the related resources as its primary data.\n(See [Fetching Relationships](https://jsonapi.org/format/1.0/#fetching-relationships).)" + }, + "related": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Related", + "description": "A [related resource link](https://jsonapi.org/format/1.0/#document-resource-object-related-resource-links)." + } + }, + "type": "object", + "title": "RelationshipLinks", + "description": "A resource object **MAY** contain references to other resource objects (\"relationships\").\nRelationships may be to-one or to-many.\nRelationships can be specified by including a member in a resource's links object." + }, + "Relationships": { + "properties": {}, + "type": "object", + "title": "Relationships", + "description": "Members of the relationships object (\"relationships\") represent references from the resource object in which it's defined to other resource objects.\nKeys MUST NOT be:\n type\n id" + }, + "Resource": { + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "Resource ID" + }, + "type": { + "type": "string", + "title": "Type", + "description": "Resource type" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing links related to the resource." + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." + }, + "attributes": { + "anyOf": [ + { + "$ref": "#/components/schemas/Attributes" + }, + { + "type": "null" + } + ], + "description": "an attributes object representing some of the resource\u2019s data." + }, + "relationships": { + "anyOf": [ + { + "$ref": "#/components/schemas/Relationships" + }, + { + "type": "null" + } + ], + "description": "[Relationships object](https://jsonapi.org/format/1.0/#document-resource-object-relationships)\ndescribing relationships between the resource and other JSON API resources." + } + }, + "type": "object", + "required": [ + "id", + "type" + ], + "title": "Resource", + "description": "Resource objects appear in a JSON API document to represent resources." + }, + "ResourceLinks": { + "properties": { + "self": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Self", + "description": "A link that identifies the resource represented by the resource object." + } + }, + "type": "object", + "title": "ResourceLinks", + "description": "A Resource Links object" + }, + "ResponseMeta": { + "properties": { + "query": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMetaQuery" + } + ], + "description": "Information on the Query that was requested" + }, + "api_version": { + "type": "string", + "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", + "title": "Api Version", + "description": "Presently used full version of the OPTIMADE API.\nThe version number string MUST NOT be prefixed by, e.g., \"v\".\nExamples: `1.0.0`, `1.0.0-rc.2`.", + "examples": [ + "0.10.1", + "1.0.0-rc.2", + "1.2.3-rc.5+develop" + ] + }, + "more_data_available": { + "type": "boolean", + "title": "More Data Available", + "description": "`false` if the response contains all data for the request (e.g., a request issued to a single entry endpoint, or a `filter` query at the last page of a paginated response) and `true` if the response is incomplete in the sense that multiple objects match the request, and not all of them have been included in the response (e.g., a query with multiple pages that is not at the last page)." + }, + "schema": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Schema", + "description": "A [JSON API links object](http://jsonapi.org/format/1.0/#document-links) that points to a schema for the response.\nIf it is a string, or a dictionary containing no `meta` field, the provided URL MUST point at an [OpenAPI](https://swagger.io/specification/) schema.\nIt is possible that future versions of this specification allows for alternative schema types.\nHence, if the `meta` field of the JSON API links object is provided and contains a field `schema_type` that is not equal to the string `OpenAPI` the client MUST not handle failures to parse the schema or to validate the response against the schema as errors." + }, + "time_stamp": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Time Stamp", + "description": "A timestamp containing the date and time at which the query was executed." + }, + "data_returned": { + "anyOf": [ + { + "type": "integer", + "minimum": 0.0 + }, + { + "type": "null" + } + ], + "title": "Data Returned", + "description": "An integer containing the total number of data resource objects returned for the current `filter` query, independent of pagination." + }, + "provider": { + "anyOf": [ + { + "$ref": "#/components/schemas/Provider" + }, + { + "type": "null" + } + ], + "description": "information on the database provider of the implementation." + }, + "data_available": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Data Available", + "description": "An integer containing the total number of data resource objects available in the database for the endpoint." + }, + "last_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Last Id", + "description": "a string containing the last ID returned" + }, + "response_message": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Response Message", + "description": "response string from the server" + }, + "implementation": { + "anyOf": [ + { + "$ref": "#/components/schemas/Implementation" + }, + { + "type": "null" + } + ], + "description": "a dictionary describing the server implementation" + }, + "warnings": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Warnings" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Warnings", + "description": "A list of warning resource objects representing non-critical errors or warnings.\nA warning resource object is defined similarly to a [JSON API error object](http://jsonapi.org/format/1.0/#error-objects), but MUST also include the field `type`, which MUST have the value `\"warning\"`.\nThe field `detail` MUST be present and SHOULD contain a non-critical message, e.g., reporting unrecognized search attributes or deprecated features.\nThe field `status`, representing a HTTP response status code, MUST NOT be present for a warning resource object.\nThis is an exclusive field for error resource objects." + } + }, + "additionalProperties": true, + "type": "object", + "required": [ + "query", + "api_version", + "more_data_available" + ], + "title": "ResponseMeta", + "description": "A [JSON API meta member](https://jsonapi.org/format/1.0#document-meta)\nthat contains JSON API meta objects of non-standard\nmeta-information.\n\nOPTIONAL additional information global to the query that is not\nspecified in this document, MUST start with a\ndatabase-provider-specific prefix." + }, + "ResponseMetaQuery": { + "properties": { + "representation": { + "type": "string", + "title": "Representation", + "description": "A string with the part of the URL following the versioned or unversioned base URL that serves the API.\nQuery parameters that have not been used in processing the request MAY be omitted.\nIn particular, if no query parameters have been involved in processing the request, the query part of the URL MAY be excluded.\nExample: `/structures?filter=nelements=2`" + } + }, + "type": "object", + "required": [ + "representation" + ], + "title": "ResponseMetaQuery", + "description": "Information on the query that was requested." + }, + "Species": { + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "Gives the name of the species; the **name** value MUST be unique in the `species` list.", + "x-optimade-queryable": "optional", + "x-optimade-support": "must" + }, + "chemical_symbols": { + "items": { + "type": "string", + "pattern": "(H|He|Li|Be|B|C|N|O|F|Ne|Na|Mg|Al|Si|P|S|Cl|Ar|K|Ca|Sc|Ti|V|Cr|Mn|Fe|Co|Ni|Cu|Zn|Ga|Ge|As|Se|Br|Kr|Rb|Sr|Y|Zr|Nb|Mo|Tc|Ru|Rh|Pd|Ag|Cd|In|Sn|Sb|Te|I|Xe|Cs|Ba|La|Ce|Pr|Nd|Pm|Sm|Eu|Gd|Tb|Dy|Ho|Er|Tm|Yb|Lu|Hf|Ta|W|Re|Os|Ir|Pt|Au|Hg|Tl|Pb|Bi|Po|At|Rn|Fr|Ra|Ac|Th|Pa|U|Np|Pu|Am|Cm|Bk|Cf|Es|Fm|Md|No|Lr|Rf|Db|Sg|Bh|Hs|Mt|Ds|Rg|Cn|Nh|Fl|Mc|Lv|Ts|Og|X|vacancy)" + }, + "type": "array", + "title": "Chemical Symbols", + "description": "MUST be a list of strings of all chemical elements composing this species. Each item of the list MUST be one of the following:\n\n- a valid chemical-element symbol, or\n- the special value `\"X\"` to represent a non-chemical element, or\n- the special value `\"vacancy\"` to represent that this site has a non-zero probability of having a vacancy (the respective probability is indicated in the `concentration` list, see below).\n\nIf any one entry in the `species` list has a `chemical_symbols` list that is longer than 1 element, the correct flag MUST be set in the list `structure_features`.", + "x-optimade-queryable": "optional", + "x-optimade-support": "must" + }, + "concentration": { + "items": { + "type": "number" + }, + "type": "array", + "title": "Concentration", + "description": "MUST be a list of floats, with same length as `chemical_symbols`. The numbers represent the relative concentration of the corresponding chemical symbol in this species. The numbers SHOULD sum to one. Cases in which the numbers do not sum to one typically fall only in the following two categories:\n\n- Numerical errors when representing float numbers in fixed precision, e.g. for two chemical symbols with concentrations `1/3` and `2/3`, the concentration might look something like `[0.33333333333, 0.66666666666]`. If the client is aware that the sum is not one because of numerical precision, it can renormalize the values so that the sum is exactly one.\n- Experimental errors in the data present in the database. In this case, it is the responsibility of the client to decide how to process the data.\n\nNote that concentrations are uncorrelated between different site (even of the same species).", + "x-optimade-queryable": "optional", + "x-optimade-support": "must" + }, + "mass": { + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Mass", + "description": "If present MUST be a list of floats expressed in a.m.u.\nElements denoting vacancies MUST have masses equal to 0.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional", + "x-optimade-unit": "a.m.u." + }, + "original_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Original Name", + "description": "Can be any valid Unicode string, and SHOULD contain (if specified) the name of the species that is used internally in the source database.\n\nNote: With regards to \"source database\", we refer to the immediate source being queried via the OPTIMADE API implementation.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "attached": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Attached", + "description": "If provided MUST be a list of length 1 or more of strings of chemical symbols for the elements attached to this site, or \"X\" for a non-chemical element.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "nattached": { + "anyOf": [ + { + "items": { + "type": "integer" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Nattached", + "description": "If provided MUST be a list of length 1 or more of integers indicating the number of attached atoms of the kind specified in the value of the :field:`attached` key.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + } + }, + "type": "object", + "required": [ + "name", + "chemical_symbols", + "concentration" + ], + "title": "Species", + "description": "A list describing the species of the sites of this structure.\n\nSpecies can represent pure chemical elements, virtual-crystal atoms representing a\nstatistical occupation of a given site by multiple chemical elements, and/or a\nlocation to which there are attached atoms, i.e., atoms whose precise location are\nunknown beyond that they are attached to that position (frequently used to indicate\nhydrogen atoms attached to another element, e.g., a carbon with three attached\nhydrogens might represent a methyl group, -CH3).\n\n- **Examples**:\n - `[ {\"name\": \"Ti\", \"chemical_symbols\": [\"Ti\"], \"concentration\": [1.0]} ]`: any site with this species is occupied by a Ti atom.\n - `[ {\"name\": \"Ti\", \"chemical_symbols\": [\"Ti\", \"vacancy\"], \"concentration\": [0.9, 0.1]} ]`: any site with this species is occupied by a Ti atom with 90 % probability, and has a vacancy with 10 % probability.\n - `[ {\"name\": \"BaCa\", \"chemical_symbols\": [\"vacancy\", \"Ba\", \"Ca\"], \"concentration\": [0.05, 0.45, 0.5], \"mass\": [0.0, 137.327, 40.078]} ]`: any site with this species is occupied by a Ba atom with 45 % probability, a Ca atom with 50 % probability, and by a vacancy with 5 % probability. The mass of this site is (on average) 88.5 a.m.u.\n - `[ {\"name\": \"C12\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"mass\": [12.0]} ]`: any site with this species is occupied by a carbon isotope with mass 12.\n - `[ {\"name\": \"C13\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"mass\": [13.0]} ]`: any site with this species is occupied by a carbon isotope with mass 13.\n - `[ {\"name\": \"CH3\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"attached\": [\"H\"], \"nattached\": [3]} ]`: any site with this species is occupied by a methyl group, -CH3, which is represented without specifying precise positions of the hydrogen atoms." + }, + "StructureFeatures": { + "type": "string", + "enum": [ + "disorder", + "implicit_atoms", + "site_attachments", + "assemblies" + ], + "title": "StructureFeatures", + "description": "Enumeration of structure_features values" + }, + "StructureRelationship": { + "properties": { + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/RelationshipLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing at least one of the following: self, related" + }, + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/BaseRelationshipResource" + }, + { + "items": { + "$ref": "#/components/schemas/BaseRelationshipResource" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Data", + "description": "Resource linkage" + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object that contains non-standard meta-information about the relationship." + } + }, + "type": "object", + "title": "StructureRelationship" + }, + "StructureResource": { + "properties": { + "id": { + "type": "string", + "title": "Id", + "description": "An entry's ID as defined in section Definition of Terms.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n\n- **Examples**:\n - `\"db/1234567\"`\n - `\"cod/2000000\"`\n - `\"cod/2000000@1234567\"`\n - `\"nomad/L1234567890\"`\n - `\"42\"`", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "type": { + "type": "string", + "enum": [ + "structures" + ], + "const": "structures", + "pattern": "^structures$", + "title": "Type", + "description": "The name of the type of an entry.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response.\n - MUST be an existing entry type.\n - The entry of type `` and ID `` MUST be returned in response to a request for `//` under the versioned base URL.\n\n- **Examples**:\n - `\"structures\"`", + "default": "structures", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ResourceLinks" + }, + { + "type": "null" + } + ], + "description": "a links object containing links related to the resource." + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship." + }, + "attributes": { + "$ref": "#/components/schemas/StructureResourceAttributes" + }, + "relationships": { + "anyOf": [ + { + "$ref": "#/components/schemas/EntryRelationships" + }, + { + "type": "null" + } + ], + "description": "A dictionary containing references to other entries according to the description in section Relationships encoded as [JSON API Relationships](https://jsonapi.org/format/1.0/#document-resource-object-relationships).\nThe OPTIONAL human-readable description of the relationship MAY be provided in the `description` field inside the `meta` dictionary of the JSON API resource identifier object." + } + }, + "type": "object", + "required": [ + "id", + "type", + "attributes" + ], + "title": "StructureResource", + "description": "Representing a structure." + }, + "StructureResourceAttributes": { + "properties": { + "immutable_id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Immutable Id", + "description": "The entry's immutable ID (e.g., an UUID). This is important for databases having preferred IDs that point to \"the latest version\" of a record, but still offer access to older variants. This ID maps to the version-specific record, in case it changes in the future.\n\n- **Type**: string.\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `\"8bd3e750-b477-41a0-9b11-3a799f21b44f\"`\n - `\"fjeiwoj,54;@=%<>#32\"` (Strings that are not URL-safe are allowed.)", + "x-optimade-queryable": "must", + "x-optimade-support": "optional" + }, + "last_modified": { + "anyOf": [ + { + "type": "string", + "format": "date-time" + }, + { + "type": "null" + } + ], + "title": "Last Modified", + "description": "Date and time representing when the entry was last modified.\n\n- **Type**: timestamp.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - **Response**: REQUIRED in the response unless the query parameter `response_fields` is present and does not include this property.\n\n- **Example**:\n - As part of JSON response format: `\"2007-04-05T14:30:20Z\"` (i.e., encoded as an [RFC 3339 Internet Date/Time Format](https://tools.ietf.org/html/rfc3339#section-5.6) string.)", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "elements": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Elements", + "description": "The chemical symbols of the different elements present in the structure.\n\n- **Type**: list of strings.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - The strings are the chemical symbols, i.e., either a single uppercase letter or an uppercase letter followed by a number of lowercase letters.\n - The order MUST be alphabetical.\n - MUST refer to the same elements in the same order, and therefore be of the same length, as `elements_ratios`, if the latter is provided.\n - Note: This property SHOULD NOT contain the string \"X\" to indicate non-chemical elements or \"vacancy\" to indicate vacancies (in contrast to the field `chemical_symbols` for the `species` property).\n\n- **Examples**:\n - `[\"Si\"]`\n - `[\"Al\",\"O\",\"Si\"]`\n\n- **Query examples**:\n - A filter that matches all records of structures that contain Si, Al **and** O, and possibly other elements: `elements HAS ALL \"Si\", \"Al\", \"O\"`.\n - To match structures with exactly these three elements, use `elements HAS ALL \"Si\", \"Al\", \"O\" AND elements LENGTH 3`.\n - Note: length queries on this property can be equivalently formulated by filtering on the `nelements`_ property directly.", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "nelements": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Nelements", + "description": "Number of different elements in the structure as an integer.\n\n- **Type**: integer\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - MUST be equal to the lengths of the list properties `elements` and `elements_ratios`, if they are provided.\n\n- **Examples**:\n - `3`\n\n- **Querying**:\n - Note: queries on this property can equivalently be formulated using `elements LENGTH`.\n - A filter that matches structures that have exactly 4 elements: `nelements=4`.\n - A filter that matches structures that have between 2 and 7 elements: `nelements>=2 AND nelements<=7`.", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "elements_ratios": { + "anyOf": [ + { + "items": { + "type": "number" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Elements Ratios", + "description": "Relative proportions of different elements in the structure.\n\n- **Type**: list of floats\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - Composed by the proportions of elements in the structure as a list of floating point numbers.\n - The sum of the numbers MUST be 1.0 (within floating point accuracy)\n - MUST refer to the same elements in the same order, and therefore be of the same length, as `elements`, if the latter is provided.\n\n- **Examples**:\n - `[1.0]`\n - `[0.3333333333333333, 0.2222222222222222, 0.4444444444444444]`\n\n- **Query examples**:\n - Note: Useful filters can be formulated using the set operator syntax for correlated values.\n However, since the values are floating point values, the use of equality comparisons is generally inadvisable.\n - OPTIONAL: a filter that matches structures where approximately 1/3 of the atoms in the structure are the element Al is: `elements:elements_ratios HAS ALL \"Al\":>0.3333, \"Al\":<0.3334`.", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "chemical_formula_descriptive": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Chemical Formula Descriptive", + "description": "The chemical formula for a structure as a string in a form chosen by the API implementation.\n\n- **Type**: string\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - The chemical formula is given as a string consisting of properly capitalized element symbols followed by integers or decimal numbers, balanced parentheses, square, and curly brackets `(`,`)`, `[`,`]`, `{`, `}`, commas, the `+`, `-`, `:` and `=` symbols. The parentheses are allowed to be followed by a number. Spaces are allowed anywhere except within chemical symbols. The order of elements and any groupings indicated by parentheses or brackets are chosen freely by the API implementation.\n - The string SHOULD be arithmetically consistent with the element ratios in the `chemical_formula_reduced` property.\n - It is RECOMMENDED, but not mandatory, that symbols, parentheses and brackets, if used, are used with the meanings prescribed by [IUPAC's Nomenclature of Organic Chemistry](https://www.qmul.ac.uk/sbcs/iupac/bibliog/blue.html).\n\n- **Examples**:\n - `\"(H2O)2 Na\"`\n - `\"NaCl\"`\n - `\"CaCO3\"`\n - `\"CCaO3\"`\n - `\"(CH3)3N+ - [CH2]2-OH = Me3N+ - CH2 - CH2OH\"`\n\n- **Query examples**:\n - Note: the free-form nature of this property is likely to make queries on it across different databases inconsistent.\n - A filter that matches an exactly given formula: `chemical_formula_descriptive=\"(H2O)2 Na\"`.\n - A filter that does a partial match: `chemical_formula_descriptive CONTAINS \"H2O\"`.", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "chemical_formula_reduced": { + "anyOf": [ + { + "type": "string", + "pattern": "(^$)|^([A-Z][a-z]?([2-9]|[1-9]\\d+)?)+$" + }, + { + "type": "null" + } + ], + "pattern": "(^$)|^([A-Z][a-z]?([2-9]|[1-9]\\d+)?)+$", + "title": "Chemical Formula Reduced", + "description": "The reduced chemical formula for a structure as a string with element symbols and integer chemical proportion numbers.\nThe proportion number MUST be omitted if it is 1.\n\n- **Type**: string\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property.\n However, support for filters using partial string matching with this property is OPTIONAL (i.e., BEGINS WITH, ENDS WITH, and CONTAINS).\n Intricate queries on formula components are instead suggested to be formulated using set-type filter operators on the multi valued `elements` and `elements_ratios` properties.\n - Element symbols MUST have proper capitalization (e.g., `\"Si\"`, not `\"SI\"` for \"silicon\").\n - Elements MUST be placed in alphabetical order, followed by their integer chemical proportion number.\n - For structures with no partial occupation, the chemical proportion numbers are the smallest integers for which the chemical proportion is exactly correct.\n - For structures with partial occupation, the chemical proportion numbers are integers that within reasonable approximation indicate the correct chemical proportions. The precise details of how to perform the rounding is chosen by the API implementation.\n - No spaces or separators are allowed.\n\n- **Examples**:\n - `\"H2NaO\"`\n - `\"ClNa\"`\n - `\"CCaO3\"`\n\n- **Query examples**:\n - A filter that matches an exactly given formula is `chemical_formula_reduced=\"H2NaO\"`.", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "chemical_formula_hill": { + "anyOf": [ + { + "type": "string", + "pattern": "(^$)|^([A-Z][a-z]?([2-9]|[1-9]\\d+)?)+$" + }, + { + "type": "null" + } + ], + "pattern": "(^$)|^([A-Z][a-z]?([2-9]|[1-9]\\d+)?)+$", + "title": "Chemical Formula Hill", + "description": "The chemical formula for a structure in [Hill form](https://dx.doi.org/10.1021/ja02046a005) with element symbols followed by integer chemical proportion numbers. The proportion number MUST be omitted if it is 1.\n\n- **Type**: string\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, only a subset of the filter features MAY be supported.\n - The overall scale factor of the chemical proportions is chosen such that the resulting values are integers that indicate the most chemically relevant unit of which the system is composed.\n For example, if the structure is a repeating unit cell with four hydrogens and four oxygens that represents two hydroperoxide molecules, `chemical_formula_hill` is `\"H2O2\"` (i.e., not `\"HO\"`, nor `\"H4O4\"`).\n - If the chemical insight needed to ascribe a Hill formula to the system is not present, the property MUST be handled as unset.\n - Element symbols MUST have proper capitalization (e.g., `\"Si\"`, not `\"SI\"` for \"silicon\").\n - Elements MUST be placed in [Hill order](https://dx.doi.org/10.1021/ja02046a005), followed by their integer chemical proportion number.\n Hill order means: if carbon is present, it is placed first, and if also present, hydrogen is placed second.\n After that, all other elements are ordered alphabetically.\n If carbon is not present, all elements are ordered alphabetically.\n - If the system has sites with partial occupation and the total occupations of each element do not all sum up to integers, then the Hill formula SHOULD be handled as unset.\n - No spaces or separators are allowed.\n\n- **Examples**:\n - `\"H2O2\"`\n\n- **Query examples**:\n - A filter that matches an exactly given formula is `chemical_formula_hill=\"H2O2\"`.", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "chemical_formula_anonymous": { + "anyOf": [ + { + "type": "string", + "pattern": "(^$)|^([A-Z][a-z]?([2-9]|[1-9]\\d+)?)+$" + }, + { + "type": "null" + } + ], + "pattern": "(^$)|^([A-Z][a-z]?([2-9]|[1-9]\\d+)?)+$", + "title": "Chemical Formula Anonymous", + "description": "The anonymous formula is the `chemical_formula_reduced`, but where the elements are instead first ordered by their chemical proportion number, and then, in order left to right, replaced by anonymous symbols A, B, C, ..., Z, Aa, Ba, ..., Za, Ab, Bb, ... and so on.\n\n- **Type**: string\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property.\n However, support for filters using partial string matching with this property is OPTIONAL (i.e., BEGINS WITH, ENDS WITH, and CONTAINS).\n\n- **Examples**:\n - `\"A2B\"`\n - `\"A42B42C16D12E10F9G5\"`\n\n- **Querying**:\n - A filter that matches an exactly given formula is `chemical_formula_anonymous=\"A2B\"`.", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "dimension_types": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Periodicity" + }, + "type": "array", + "maxItems": 3, + "minItems": 3 + }, + { + "type": "null" + } + ], + "title": "Dimension Types", + "description": "List of three integers.\nFor each of the three directions indicated by the three lattice vectors (see property `lattice_vectors`), this list indicates if the direction is periodic (value `1`) or non-periodic (value `0`).\nNote: the elements in this list each refer to the direction of the corresponding entry in `lattice_vectors` and *not* the Cartesian x, y, z directions.\n\n- **Type**: list of integers.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n - MUST be a list of length 3.\n - Each integer element MUST assume only the value 0 or 1.\n\n- **Examples**:\n - For a molecule: `[0, 0, 0]`\n - For a wire along the direction specified by the third lattice vector: `[0, 0, 1]`\n - For a 2D surface/slab, periodic on the plane defined by the first and third lattice vectors: `[1, 0, 1]`\n - For a bulk 3D system: `[1, 1, 1]`", + "x-optimade-queryable": "optional", + "x-optimade-support": "should" + }, + "nperiodic_dimensions": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Nperiodic Dimensions", + "description": "An integer specifying the number of periodic dimensions in the structure, equivalent to the number of non-zero entries in `dimension_types`.\n\n- **Type**: integer\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n - The integer value MUST be between 0 and 3 inclusive and MUST be equal to the sum of the items in the `dimension_types` property.\n - This property only reflects the treatment of the lattice vectors provided for the structure, and not any physical interpretation of the dimensionality of its contents.\n\n- **Examples**:\n - `2` should be indicated in cases where `dimension_types` is any of `[1, 1, 0]`, `[1, 0, 1]`, `[0, 1, 1]`.\n\n- **Query examples**:\n - Match only structures with exactly 3 periodic dimensions: `nperiodic_dimensions=3`\n - Match all structures with 2 or fewer periodic dimensions: `nperiodic_dimensions<=2`", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "lattice_vectors": { + "anyOf": [ + { + "items": { + "items": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ] + }, + "type": "array", + "maxItems": 3, + "minItems": 3 + }, + "type": "array", + "maxItems": 3, + "minItems": 3 + }, + { + "type": "null" + } + ], + "title": "Lattice Vectors", + "description": "The three lattice vectors in Cartesian coordinates, in \u00e5ngstr\u00f6m (\u00c5).\n\n- **Type**: list of list of floats or unknown values.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - MUST be a list of three vectors *a*, *b*, and *c*, where each of the vectors MUST BE a list of the vector's coordinates along the x, y, and z Cartesian coordinates.\n (Therefore, the first index runs over the three lattice vectors and the second index runs over the x, y, z Cartesian coordinates).\n - For databases that do not define an absolute Cartesian system (e.g., only defining the length and angles between vectors), the first lattice vector SHOULD be set along *x* and the second on the *xy*-plane.\n - MUST always contain three vectors of three coordinates each, independently of the elements of property `dimension_types`.\n The vectors SHOULD by convention be chosen so the determinant of the `lattice_vectors` matrix is different from zero.\n The vectors in the non-periodic directions have no significance beyond fulfilling these requirements.\n - The coordinates of the lattice vectors of non-periodic dimensions (i.e., those dimensions for which `dimension_types` is `0`) MAY be given as a list of all `null` values.\n If a lattice vector contains the value `null`, all coordinates of that lattice vector MUST be `null`.\n\n- **Examples**:\n - `[[4.0,0.0,0.0],[0.0,4.0,0.0],[0.0,1.0,4.0]]` represents a cell, where the first vector is `(4, 0, 0)`, i.e., a vector aligned along the `x` axis of length 4 \u00c5; the second vector is `(0, 4, 0)`; and the third vector is `(0, 1, 4)`.", + "x-optimade-queryable": "optional", + "x-optimade-support": "should", + "x-optimade-unit": "\u00c5" + }, + "cartesian_site_positions": { + "anyOf": [ + { + "items": { + "items": { + "type": "number" + }, + "type": "array", + "maxItems": 3, + "minItems": 3 + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Cartesian Site Positions", + "description": "Cartesian positions of each site in the structure.\nA site is usually used to describe positions of atoms; what atoms can be encountered at a given site is conveyed by the `species_at_sites` property, and the species themselves are described in the `species` property.\n\n- **Type**: list of list of floats\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - It MUST be a list of length equal to the number of sites in the structure, where every element is a list of the three Cartesian coordinates of a site expressed as float values in the unit angstrom (\u00c5).\n - An entry MAY have multiple sites at the same Cartesian position (for a relevant use of this, see e.g., the property `assemblies`).\n\n- **Examples**:\n - `[[0,0,0],[0,0,2]]` indicates a structure with two sites, one sitting at the origin and one along the (positive) *z*-axis, 2 \u00c5 away from the origin.", + "x-optimade-queryable": "optional", + "x-optimade-support": "should", + "x-optimade-unit": "\u00c5" + }, + "nsites": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "title": "Nsites", + "description": "An integer specifying the length of the `cartesian_site_positions` property.\n\n- **Type**: integer\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: MUST be a queryable property with support for all mandatory filter features.\n\n- **Examples**:\n - `42`\n\n- **Query examples**:\n - Match only structures with exactly 4 sites: `nsites=4`\n - Match structures that have between 2 and 7 sites: `nsites>=2 AND nsites<=7`", + "x-optimade-queryable": "must", + "x-optimade-support": "should" + }, + "species": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Species" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Species", + "description": "A list describing the species of the sites of this structure.\nSpecies can represent pure chemical elements, virtual-crystal atoms representing a statistical occupation of a given site by multiple chemical elements, and/or a location to which there are attached atoms, i.e., atoms whose precise location are unknown beyond that they are attached to that position (frequently used to indicate hydrogen atoms attached to another element, e.g., a carbon with three attached hydrogens might represent a methyl group, -CH3).\n\n- **Type**: list of dictionary with keys:\n - `name`: string (REQUIRED)\n - `chemical_symbols`: list of strings (REQUIRED)\n - `concentration`: list of float (REQUIRED)\n - `attached`: list of strings (REQUIRED)\n - `nattached`: list of integers (OPTIONAL)\n - `mass`: list of floats (OPTIONAL)\n - `original_name`: string (OPTIONAL).\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - Each list member MUST be a dictionary with the following keys:\n - **name**: REQUIRED; gives the name of the species; the **name** value MUST be unique in the `species` list;\n - **chemical_symbols**: REQUIRED; MUST be a list of strings of all chemical elements composing this species.\n Each item of the list MUST be one of the following:\n - a valid chemical-element symbol, or\n - the special value `\"X\"` to represent a non-chemical element, or\n - the special value `\"vacancy\"` to represent that this site has a non-zero probability of having a vacancy (the respective probability is indicated in the `concentration` list, see below).\n\n If any one entry in the `species` list has a `chemical_symbols` list that is longer than 1 element, the correct flag MUST be set in the list `structure_features`.\n\n - **concentration**: REQUIRED; MUST be a list of floats, with same length as `chemical_symbols`.\n The numbers represent the relative concentration of the corresponding chemical symbol in this species.\n The numbers SHOULD sum to one. Cases in which the numbers do not sum to one typically fall only in the following two categories:\n\n - Numerical errors when representing float numbers in fixed precision, e.g. for two chemical symbols with concentrations `1/3` and `2/3`, the concentration might look something like `[0.33333333333, 0.66666666666]`. If the client is aware that the sum is not one because of numerical precision, it can renormalize the values so that the sum is exactly one.\n - Experimental errors in the data present in the database. In this case, it is the responsibility of the client to decide how to process the data.\n\n Note that concentrations are uncorrelated between different sites (even of the same species).\n\n - **attached**: OPTIONAL; if provided MUST be a list of length 1 or more of strings of chemical symbols for the elements attached to this site, or \"X\" for a non-chemical element.\n\n - **nattached**: OPTIONAL; if provided MUST be a list of length 1 or more of integers indicating the number of attached atoms of the kind specified in the value of the `attached` key.\n\n The implementation MUST include either both or none of the `attached` and `nattached` keys, and if they are provided, they MUST be of the same length.\n Furthermore, if they are provided, the `structure_features` property MUST include the string `site_attachments`.\n\n - **mass**: OPTIONAL. If present MUST be a list of floats, with the same length as `chemical_symbols`, providing element masses expressed in a.m.u.\n Elements denoting vacancies MUST have masses equal to 0.\n\n - **original_name**: OPTIONAL. Can be any valid Unicode string, and SHOULD contain (if specified) the name of the species that is used internally in the source database.\n\n Note: With regards to \"source database\", we refer to the immediate source being queried via the OPTIMADE API implementation.\n\n The main use of this field is for source databases that use species names, containing characters that are not allowed (see description of the list property `species_at_sites`).\n\n - For systems that have only species formed by a single chemical symbol, and that have at most one species per chemical symbol, SHOULD use the chemical symbol as species name (e.g., `\"Ti\"` for titanium, `\"O\"` for oxygen, etc.)\n However, note that this is OPTIONAL, and client implementations MUST NOT assume that the key corresponds to a chemical symbol, nor assume that if the species name is a valid chemical symbol, that it represents a species with that chemical symbol.\n This means that a species `{\"name\": \"C\", \"chemical_symbols\": [\"Ti\"], \"concentration\": [1.0]}` is valid and represents a titanium species (and *not* a carbon species).\n - It is NOT RECOMMENDED that a structure includes species that do not have at least one corresponding site.\n\n- **Examples**:\n - `[ {\"name\": \"Ti\", \"chemical_symbols\": [\"Ti\"], \"concentration\": [1.0]} ]`: any site with this species is occupied by a Ti atom.\n - `[ {\"name\": \"Ti\", \"chemical_symbols\": [\"Ti\", \"vacancy\"], \"concentration\": [0.9, 0.1]} ]`: any site with this species is occupied by a Ti atom with 90 % probability, and has a vacancy with 10 % probability.\n - `[ {\"name\": \"BaCa\", \"chemical_symbols\": [\"vacancy\", \"Ba\", \"Ca\"], \"concentration\": [0.05, 0.45, 0.5], \"mass\": [0.0, 137.327, 40.078]} ]`: any site with this species is occupied by a Ba atom with 45 % probability, a Ca atom with 50 % probability, and by a vacancy with 5 % probability. The mass of this site is (on average) 88.5 a.m.u.\n - `[ {\"name\": \"C12\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"mass\": [12.0]} ]`: any site with this species is occupied by a carbon isotope with mass 12.\n - `[ {\"name\": \"C13\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"mass\": [13.0]} ]`: any site with this species is occupied by a carbon isotope with mass 13.\n - `[ {\"name\": \"CH3\", \"chemical_symbols\": [\"C\"], \"concentration\": [1.0], \"attached\": [\"H\"], \"nattached\": [3]} ]`: any site with this species is occupied by a methyl group, -CH3, which is represented without specifying precise positions of the hydrogen atoms.", + "x-optimade-queryable": "optional", + "x-optimade-support": "should" + }, + "species_at_sites": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Species At Sites", + "description": "Name of the species at each site (where values for sites are specified with the same order of the property `cartesian_site_positions`).\nThe properties of the species are found in the property `species`.\n\n- **Type**: list of strings.\n\n- **Requirements/Conventions**:\n - **Support**: SHOULD be supported by all implementations, i.e., SHOULD NOT be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - MUST have length equal to the number of sites in the structure (first dimension of the list property `cartesian_site_positions`).\n - Each species name mentioned in the `species_at_sites` list MUST be described in the list property `species` (i.e. for each value in the `species_at_sites` list there MUST exist exactly one dictionary in the `species` list with the `name` attribute equal to the corresponding `species_at_sites` value).\n - Each site MUST be associated only to a single species.\n **Note**: However, species can represent mixtures of atoms, and multiple species MAY be defined for the same chemical element.\n This latter case is useful when different atoms of the same type need to be grouped or distinguished, for instance in simulation codes to assign different initial spin states.\n\n- **Examples**:\n - `[\"Ti\",\"O2\"]` indicates that the first site is hosting a species labeled `\"Ti\"` and the second a species labeled `\"O2\"`.\n - `[\"Ac\", \"Ac\", \"Ag\", \"Ir\"]` indicating the first two sites contains the `\"Ac\"` species, while the third and fourth sites contain the `\"Ag\"` and `\"Ir\"` species, respectively.", + "x-optimade-queryable": "optional", + "x-optimade-support": "should" + }, + "assemblies": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Assembly" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "title": "Assemblies", + "description": "A description of groups of sites that are statistically correlated.\n\n- **Type**: list of dictionary with keys:\n - `sites_in_groups`: list of list of integers (REQUIRED)\n - `group_probabilities`: list of floats (REQUIRED)\n\n- **Requirements/Conventions**:\n - **Support**: OPTIONAL support in implementations, i.e., MAY be `null`.\n - **Query**: Support for queries on this property is OPTIONAL.\n If supported, filters MAY support only a subset of comparison operators.\n - The property SHOULD be `null` for entries that have no partial occupancies.\n - If present, the correct flag MUST be set in the list `structure_features`.\n - Client implementations MUST check its presence (as its presence changes the interpretation of the structure).\n - If present, it MUST be a list of dictionaries, each of which represents an assembly and MUST have the following two keys:\n - **sites_in_groups**: Index of the sites (0-based) that belong to each group for each assembly.\n\n Example: `[[1], [2]]`: two groups, one with the second site, one with the third.\n Example: `[[1,2], [3]]`: one group with the second and third site, one with the fourth.\n\n - **group_probabilities**: Statistical probability of each group. It MUST have the same length as `sites_in_groups`.\n It SHOULD sum to one.\n See below for examples of how to specify the probability of the occurrence of a vacancy.\n The possible reasons for the values not to sum to one are the same as already specified above for the `concentration` of each `species`.\n\n - If a site is not present in any group, it means that it is present with 100 % probability (as if no assembly was specified).\n - A site MUST NOT appear in more than one group.\n\n- **Examples** (for each entry of the assemblies list):\n - `{\"sites_in_groups\": [[0], [1]], \"group_probabilities: [0.3, 0.7]}`: the first site and the second site never occur at the same time in the unit cell.\n Statistically, 30 % of the times the first site is present, while 70 % of the times the second site is present.\n - `{\"sites_in_groups\": [[1,2], [3]], \"group_probabilities: [0.3, 0.7]}`: the second and third site are either present together or not present; they form the first group of atoms for this assembly.\n The second group is formed by the fourth site.\n Sites of the first group (the second and the third) are never present at the same time as the fourth site.\n 30 % of times sites 1 and 2 are present (and site 3 is absent); 70 % of times site 3 is present (and sites 1 and 2 are absent).\n\n- **Notes**:\n - Assemblies are essential to represent, for instance, the situation where an atom can statistically occupy two different positions (sites).\n\n - By defining groups, it is possible to represent, e.g., the case where a functional molecule (and not just one atom) is either present or absent (or the case where it it is present in two conformations)\n\n - Considerations on virtual alloys and on vacancies: In the special case of a virtual alloy, these specifications allow two different, equivalent ways of specifying them.\n For instance, for a site at the origin with 30 % probability of being occupied by Si, 50 % probability of being occupied by Ge, and 20 % of being a vacancy, the following two representations are possible:\n\n - Using a single species:\n ```json\n {\n \"cartesian_site_positions\": [[0,0,0]],\n \"species_at_sites\": [\"SiGe-vac\"],\n \"species\": [\n {\n \"name\": \"SiGe-vac\",\n \"chemical_symbols\": [\"Si\", \"Ge\", \"vacancy\"],\n \"concentration\": [0.3, 0.5, 0.2]\n }\n ]\n // ...\n }\n ```\n\n - Using multiple species and the assemblies:\n ```json\n {\n \"cartesian_site_positions\": [ [0,0,0], [0,0,0], [0,0,0] ],\n \"species_at_sites\": [\"Si\", \"Ge\", \"vac\"],\n \"species\": [\n { \"name\": \"Si\", \"chemical_symbols\": [\"Si\"], \"concentration\": [1.0] },\n { \"name\": \"Ge\", \"chemical_symbols\": [\"Ge\"], \"concentration\": [1.0] },\n { \"name\": \"vac\", \"chemical_symbols\": [\"vacancy\"], \"concentration\": [1.0] }\n ],\n \"assemblies\": [\n {\n \"sites_in_groups\": [ [0], [1], [2] ],\n \"group_probabilities\": [0.3, 0.5, 0.2]\n }\n ]\n // ...\n }\n ```\n\n - It is up to the database provider to decide which representation to use, typically depending on the internal format in which the structure is stored.\n However, given a structure identified by a unique ID, the API implementation MUST always provide the same representation for it.\n\n - The probabilities of occurrence of different assemblies are uncorrelated.\n So, for instance in the following case with two assemblies:\n ```json\n {\n \"assemblies\": [\n {\n \"sites_in_groups\": [ [0], [1] ],\n \"group_probabilities\": [0.2, 0.8],\n },\n {\n \"sites_in_groups\": [ [2], [3] ],\n \"group_probabilities\": [0.3, 0.7]\n }\n ]\n }\n ```\n\n Site 0 is present with a probability of 20 % and site 1 with a probability of 80 %. These two sites are correlated (either site 0 or 1 is present). Similarly, site 2 is present with a probability of 30 % and site 3 with a probability of 70 %.\n These two sites are correlated (either site 2 or 3 is present).\n However, the presence or absence of sites 0 and 1 is not correlated with the presence or absence of sites 2 and 3 (in the specific example, the pair of sites (0, 2) can occur with 0.2*0.3 = 6 % probability; the pair (0, 3) with 0.2*0.7 = 14 % probability; the pair (1, 2) with 0.8*0.3 = 24 % probability; and the pair (1, 3) with 0.8*0.7 = 56 % probability).", + "x-optimade-queryable": "optional", + "x-optimade-support": "optional" + }, + "structure_features": { + "items": { + "$ref": "#/components/schemas/StructureFeatures" + }, + "type": "array", + "title": "Structure Features", + "description": "A list of strings that flag which special features are used by the structure.\n\n- **Type**: list of strings\n\n- **Requirements/Conventions**:\n - **Support**: MUST be supported by all implementations, MUST NOT be `null`.\n - **Query**: MUST be a queryable property.\n Filters on the list MUST support all mandatory HAS-type queries.\n Filter operators for comparisons on the string components MUST support equality, support for other comparison operators are OPTIONAL.\n - MUST be an empty list if no special features are used.\n - MUST be sorted alphabetically.\n - If a special feature listed below is used, the list MUST contain the corresponding string.\n - If a special feature listed below is not used, the list MUST NOT contain the corresponding string.\n - **List of strings used to indicate special structure features**:\n - `disorder`: this flag MUST be present if any one entry in the `species` list has a `chemical_symbols` list that is longer than 1 element.\n - `implicit_atoms`: this flag MUST be present if the structure contains atoms that are not assigned to sites via the property `species_at_sites` (e.g., because their positions are unknown).\n When this flag is present, the properties related to the chemical formula will likely not match the type and count of atoms represented by the `species_at_sites`, `species` and `assemblies` properties.\n - `site_attachments`: this flag MUST be present if any one entry in the `species` list includes `attached` and `nattached`.\n - `assemblies`: this flag MUST be present if the property `assemblies` is present.\n\n- **Examples**: A structure having implicit atoms and using assemblies: `[\"assemblies\", \"implicit_atoms\"]`", + "x-optimade-queryable": "must", + "x-optimade-support": "must" + } + }, + "additionalProperties": true, + "type": "object", + "required": [ + "last_modified", + "structure_features" + ], + "title": "StructureResourceAttributes", + "description": "This class contains the Field for the attributes used to represent a structure, e.g. unit cell, atoms, positions." + }, + "StructureResponseMany": { + "properties": { + "data": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/StructureResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + } + ], + "uniqueItems": true, + "title": "Data", + "description": "List of unique OPTIMADE structures entry resource objects." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/EntryResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included OPTIMADE entry resources." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "StructureResponseMany" + }, + "StructureResponseOne": { + "properties": { + "data": { + "anyOf": [ + { + "$ref": "#/components/schemas/StructureResource" + }, + { + "type": "object" + }, + { + "type": "null" + } + ], + "title": "Data", + "description": "A single structures entry resource." + }, + "meta": { + "allOf": [ + { + "$ref": "#/components/schemas/ResponseMeta" + } + ], + "description": "A meta object containing non-standard information" + }, + "errors": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/Error" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Errors", + "description": "A list of unique errors" + }, + "included": { + "anyOf": [ + { + "items": { + "$ref": "#/components/schemas/EntryResource" + }, + "type": "array" + }, + { + "items": { + "type": "object" + }, + "type": "array" + }, + { + "type": "null" + } + ], + "uniqueItems": true, + "title": "Included", + "description": "A list of unique included OPTIMADE entry resources." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ToplevelLinks" + }, + { + "type": "null" + } + ], + "description": "Links associated with the primary data or errors" + }, + "jsonapi": { + "anyOf": [ + { + "$ref": "#/components/schemas/JsonApi" + }, + { + "type": "null" + } + ], + "description": "Information about the JSON API used" + } + }, + "type": "object", + "required": [ + "data", + "meta" + ], + "title": "StructureResponseOne" + }, + "ToplevelLinks": { + "properties": { + "self": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Self", + "description": "A link to itself" + }, + "related": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Related", + "description": "A related resource link" + }, + "first": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "First", + "description": "The first page of data" + }, + "last": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Last", + "description": "The last page of data" + }, + "prev": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Prev", + "description": "The previous page of data" + }, + "next": { + "anyOf": [ + { + "type": "string", + "minLength": 1, + "format": "uri" + }, + { + "$ref": "#/components/schemas/Link" + }, + { + "type": "null" + } + ], + "title": "Next", + "description": "The next page of data" + } + }, + "additionalProperties": true, + "type": "object", + "title": "ToplevelLinks", + "description": "A set of Links objects, possibly including pagination" + }, + "Warnings": { + "properties": { + "id": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Id", + "description": "A unique identifier for this particular occurrence of the problem." + }, + "links": { + "anyOf": [ + { + "$ref": "#/components/schemas/ErrorLinks" + }, + { + "type": "null" + } + ], + "description": "A links object storing about" + }, + "code": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Code", + "description": "an application-specific error code, expressed as a string value." + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Title", + "description": "A short, human-readable summary of the problem. It **SHOULD NOT** change from occurrence to occurrence of the problem, except for purposes of localization." + }, + "detail": { + "type": "string", + "title": "Detail", + "description": "A human-readable explanation specific to this occurrence of the problem." + }, + "source": { + "anyOf": [ + { + "$ref": "#/components/schemas/ErrorSource" + }, + { + "type": "null" + } + ], + "description": "An object containing references to the source of the error" + }, + "meta": { + "anyOf": [ + { + "$ref": "#/components/schemas/Meta" + }, + { + "type": "null" + } + ], + "description": "a meta object containing non-standard meta-information about the error." + }, + "type": { + "type": "string", + "enum": [ + "warning" + ], + "const": "warning", + "pattern": "^warning$", + "title": "Type", + "description": "Warnings must be of type \"warning\"", + "default": "warning" + } + }, + "type": "object", + "required": [ + "detail", + "type" + ], + "title": "Warnings", + "description": "OPTIMADE-specific warning class based on OPTIMADE-specific JSON API Error.\n\nFrom the specification:\n\nA warning resource object is defined similarly to a JSON API error object, but MUST also include the field type, which MUST have the value \"warning\".\nThe field detail MUST be present and SHOULD contain a non-critical message, e.g., reporting unrecognized search attributes or deprecated features.\n\nNote: Must be named \"Warnings\", since \"Warning\" is a built-in Python class." + } + } + } +} diff --git a/optimade/models/files.py b/optimade/models/files.py index f72a867df..9f57e092c 100644 --- a/optimade/models/files.py +++ b/optimade/models/files.py @@ -1,6 +1,6 @@ # pylint: disable=no-self-argument,line-too-long,no-name-in-module from datetime import datetime -from typing import Dict, Optional, Set, Tuple +from typing import Optional from optimade.models.entries import EntryResource, EntryResourceAttributes from optimade.models.utils import OptimadeField, StrictField, SupportLevel @@ -11,7 +11,7 @@ ) -CORRELATED_FILE_FIELDS: Tuple[Set[str], ...] +CORRELATED_FILE_FIELDS: tuple[set[str], ...] class FileResourceAttributes(EntryResourceAttributes): @@ -142,7 +142,7 @@ class FileResourceAttributes(EntryResourceAttributes): queryable=SupportLevel.OPTIONAL, ) - checksums: Optional[Dict[str, str]] = OptimadeField( + checksums: Optional[dict[str, str]] = OptimadeField( ..., description="""Dictionary providing checksums of file contents. * **Type**: dictionary with keys identifying checksum functions and values (strings) giving the actual checksums @@ -217,7 +217,7 @@ class FileResource(EntryResource): - **Examples**: - `"structures"`""", - regex="^files$", + pattern="^files$", support=SupportLevel.MUST, queryable=SupportLevel.MUST, ) diff --git a/optimade/models/responses.py b/optimade/models/responses.py index 077c10ec0..3111a8b48 100644 --- a/optimade/models/responses.py +++ b/optimade/models/responses.py @@ -141,13 +141,13 @@ class StructureResponseMany(EntryResponseMany): class FileResponseOne(EntryResponseOne): - data: Union[FileResource, Dict[str, Any], None] = StrictField( + data: Union[FileResource, dict[str, Any], None] = StrictField( ..., description="A single files entry resource." ) class FileResponseMany(EntryResponseMany): - data: Union[List[FileResource], List[Dict[str, Any]]] = StrictField( + data: Union[list[FileResource], list[dict[str, Any]]] = StrictField( ..., description="List of unique OPTIMADE files entry resource objects.", uniqueItems=True, diff --git a/optimade/server/config.py b/optimade/server/config.py index 488404ac9..f93039e7e 100644 --- a/optimade/server/config.py +++ b/optimade/server/config.py @@ -218,22 +218,12 @@ class ServerConfig(BaseSettings): mongo_uri: Annotated[str, Field(description="URI for the Mongo server")] = ( "localhost:27017" ) - - page_limit: int = Field(20, description="Default number of resources per page") - page_limit_max: int = Field( - 500, description="Max allowed number of resources per page" - ) - default_db: str = Field( - "test_server", - description=( - "ID of /links endpoint resource for the chosen default OPTIMADE implementation (only " - "relevant for the index meta-database)" - ) - ) - files_collection: str = Field( - "files", - description="Mongo collection name for /files endpoint resources", - ) + files_collection: Annotated[ + str, + Field( + description="Mongo collection name for /files endpoint resources", + ), + ] = "files" links_collection: Annotated[ str, Field(description="Mongo collection name for /links endpoint resources") ] = "links" diff --git a/optimade/server/mappers/files.py b/optimade/server/mappers/files.py index 0184a36a3..7d7760d8e 100644 --- a/optimade/server/mappers/files.py +++ b/optimade/server/mappers/files.py @@ -5,5 +5,4 @@ class FileMapper(BaseResourceMapper): - ENTRY_RESOURCE_CLASS = FileResource