Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2 staging arena #1427

Draft
wants to merge 21 commits into
base: 0.25.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ea2009b
Add `space_group_hall` and `space_group_it_number` to structure model
ml-evs Dec 6, 2022
8b14431
Merge branch '0.25.x' into ml-evs/add_space_group_support
ml-evs Dec 20, 2023
4b64b9a
Add new space group fields and outline tests
ml-evs Dec 20, 2023
6b9e36a
Use constr for pydantic v1 instead of field regexp
ml-evs Dec 23, 2023
b883af7
Add test cases for fuzzy list comparison in grammar
ml-evs Dec 6, 2022
6a8726f
Initial implementation of recursive JSONSchema-based property definit…
ml-evs Dec 6, 2022
27736fa
Add `license` and `available_licenses` info fields.
ml-evs Dec 6, 2022
aae5733
Add configurable `license` value and use it in the `/info` response
ml-evs Dec 6, 2022
3c42b32
Add configurable `request_delay` support to server and models
ml-evs Dec 6, 2022
4b5c088
Added model for files endpoint.
JPBergsma Aug 26, 2022
b165e36
Storing intermediate code state in implementing the files endpoint.
JPBergsma Sep 2, 2022
59ed1f6
Linting
ml-evs Dec 6, 2022
71cdd23
Add endpoint to main server
ml-evs Dec 6, 2022
8cebb18
Format test file
ml-evs Dec 6, 2022
1b27478
Update elastic_indexes.json with fields from `files`
ml-evs Dec 6, 2022
82d49e4
Update OpenAPI JSON after merge
ml-evs Dec 23, 2023
b8abdc7
Remove space from regexp
ml-evs Dec 23, 2023
8168f73
Remove space from regexp
ml-evs Dec 23, 2023
fb581b8
Fix outstanding discrepancies with specification
ml-evs Jan 4, 2024
0480e57
Update test with new number of properties
ml-evs Jan 4, 2024
e34ef6a
Merge branch 'ml-evs/add_space_group_support' into v1.2_staging_arena
ml-evs Jan 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/api_reference/models/files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# files

::: optimade.models.files
options:
show_if_no_docstring: true
3 changes: 3 additions & 0 deletions docs/api_reference/server/mappers/files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# files

::: optimade.server.mappers.files
3 changes: 3 additions & 0 deletions docs/api_reference/server/routers/files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# files

::: optimade.server.routers.files
33 changes: 32 additions & 1 deletion openapi/index_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,29 @@
"title": "Entry Types By Format",
"description": "Available entry endpoints as a function of output formats."
},
"license": {
"anyOf": [
{
"$ref": "#/components/schemas/Link"
},
{
"type": "string",
"maxLength": 65536,
"minLength": 1,
"format": "uri"
}
],
"title": "License",
"description": "A [JSON API links object](http://jsonapi.org/format/1.0/#document-links) giving a URL to a web page containing a human-readable text describing the license (or licensing options if there are multiple) covering all the data and metadata provided by this database.\nClients are advised not to try automated parsing of this link or its content, but rather rely on the field `available_licenses` instead."
},
"available_licenses": {
"items": {
"type": "string"
},
"type": "array",
"title": "Available Licenses",
"description": "List of [SPDX license identifiers](https://spdx.org/licenses/) specifying a set of alternative licenses under which the client is granted access to all the data and metadata in this database.\n\nIf the data and metadata is available under multiple alternative licenses, identifiers of these multiple licenses SHOULD be provided to let clients know under which conditions the data and metadata can be used.\nInclusion of a license identifier in the list is a commitment of the database that the rights are in place to grant clients access to all the data and metadata according to the terms of either of these licenses (at the choice of the client).\nIf the licensing information provided via the field `license` omits licensing options specified in `available_licenses`, or if it otherwise contradicts them, a client MUST still be allowed to interpret the inclusion of a license in `available_licenses` as a full commitment from the database that the data and metadata is available, without exceptions, under the respective licenses.\nIf the database cannot make that commitment, e.g., if only part of the data is available under a license, the corresponding license identifier MUST NOT appear in `available_licenses` (but, rather, the field `license` is to be used to clarify the licensing situation.)\nAn empty list indicates that none of the SPDX licenses apply for the entirety of the database and that the licensing situation is clarified in human readable form in the field `license`."
},
"is_index": {
"type": "boolean",
"title": "Is Index",
Expand All @@ -899,7 +922,9 @@
"api_version",
"available_api_versions",
"available_endpoints",
"entry_types_by_format"
"entry_types_by_format",
"license",
"available_licenses"
],
"title": "IndexInfoAttributes",
"description": "Attributes for Base URL Info endpoint for an Index Meta-Database"
Expand Down Expand Up @@ -1699,6 +1724,12 @@
"title": "Response Message",
"description": "response string from the server"
},
"request_delay": {
"type": "number",
"minimum": 0.0,
"title": "Request Delay",
"description": "A non-negative float giving time in seconds that the client is suggested to wait before issuing a subsequent request."
},
"implementation": {
"allOf": [
{
Expand Down
1,851 changes: 1,489 additions & 362 deletions openapi/openapi.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions optimade/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,4 +22,5 @@
+ 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
)
19 changes: 17 additions & 2 deletions optimade/models/baseinfo.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# pylint: disable=no-self-argument,no-name-in-module
import re
from typing import Optional
from typing import Dict, List, Optional, Union

from pydantic import AnyHttpUrl, BaseModel, Field, root_validator, validator

from optimade.models.jsonapi import Resource
from optimade.models.jsonapi import Link, Resource
from optimade.models.utils import SemanticVersion, StrictField

__all__ = ("AvailableApiVersion", "BaseInfoAttributes", "BaseInfoResource")
Expand Down Expand Up @@ -78,6 +78,21 @@ class BaseInfoAttributes(BaseModel):
entry_types_by_format: dict[str, list[str]] = StrictField(
..., description="Available entry endpoints as a function of output formats."
)
license: Union[Link, AnyHttpUrl] = StrictField(
...,
description="""A [JSON API links object](http://jsonapi.org/format/1.0/#document-links) giving a URL to a web page containing a human-readable text describing the license (or licensing options if there are multiple) covering all the data and metadata provided by this database.
Clients are advised not to try automated parsing of this link or its content, but rather rely on the field `available_licenses` instead.""",
)
available_licenses: Optional[List[str]] = StrictField(
...,
description="""List of [SPDX license identifiers](https://spdx.org/licenses/) specifying a set of alternative licenses under which the client is granted access to all the data and metadata in this database.

If the data and metadata is available under multiple alternative licenses, identifiers of these multiple licenses SHOULD be provided to let clients know under which conditions the data and metadata can be used.
Inclusion of a license identifier in the list is a commitment of the database that the rights are in place to grant clients access to all the data and metadata according to the terms of either of these licenses (at the choice of the client).
If the licensing information provided via the field `license` omits licensing options specified in `available_licenses`, or if it otherwise contradicts them, a client MUST still be allowed to interpret the inclusion of a license in `available_licenses` as a full commitment from the database that the data and metadata is available, without exceptions, under the respective licenses.
If the database cannot make that commitment, e.g., if only part of the data is available under a license, the corresponding license identifier MUST NOT appear in `available_licenses` (but, rather, the field `license` is to be used to clarify the licensing situation.)
An empty list indicates that none of the SPDX licenses apply for the entirety of the database and that the licensing situation is clarified in human readable form in the field `license`.""",
)
is_index: Optional[bool] = StrictField(
default=False,
description="If true, this is an index meta-database base URL (see section Index Meta-Database). "
Expand Down
Loading
Loading