baseinfo¶
SemanticVersion = Annotated[str, Field(pattern=SEMVER_PATTERN, examples=['0.10.1', '1.0.0-rc.2', '1.2.3-rc.5+develop'])]
module-attribute
¶
VERSIONED_BASE_URL_PATTERN = '^.+/v[0-1](\\.[0-9]+)*/?$'
module-attribute
¶
__all__ = ('AvailableApiVersion', 'BaseInfoAttributes', 'BaseInfoResource')
module-attribute
¶
AvailableApiVersion
¶
Bases: BaseModel
A JSON object containing information about an available API version
Source code in optimade/models/baseinfo.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
url: Annotated[AnyHttpUrl, StrictField(description='A string specifying a versioned base URL that MUST adhere to the rules in section Base URL', json_schema_extra={pattern: VERSIONED_BASE_URL_PATTERN})]
instance-attribute
¶
version: Annotated[SemanticVersion, StrictField(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`.")]
instance-attribute
¶
crosscheck_url_and_version()
¶
Check that URL version and API version are compatible.
Source code in optimade/models/baseinfo.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
url_must_be_versioned_base_Url(value)
classmethod
¶
The URL must be a versioned base URL
Source code in optimade/models/baseinfo.py
39 40 41 42 43 44 45 46 47 48 |
|
BaseInfoAttributes
¶
Bases: BaseModel
Attributes for Base URL Info endpoint
Source code in optimade/models/baseinfo.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
api_version: Annotated[SemanticVersion, StrictField(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`.')]
instance-attribute
¶
available_api_versions: Annotated[list[AvailableApiVersion], StrictField(description='A list of dictionaries of available API versions at other base URLs')]
instance-attribute
¶
available_endpoints: Annotated[list[str], StrictField(description='List of available endpoints (i.e., the string to be appended to the versioned base URL).')]
instance-attribute
¶
entry_types_by_format: Annotated[dict[str, list[str]], StrictField(description='Available entry endpoints as a function of output formats.')]
instance-attribute
¶
formats: Annotated[list[str], StrictField(description='List of available output formats.')] = ['json']
class-attribute
instance-attribute
¶
is_index: Annotated[Optional[bool], StrictField(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`).')] = False
class-attribute
instance-attribute
¶
formats_and_endpoints_must_be_valid()
¶
Source code in optimade/models/baseinfo.py
113 114 115 116 117 118 119 120 121 122 123 |
|
BaseInfoResource
¶
Bases: Resource
Source code in optimade/models/baseinfo.py
126 127 128 129 |
|
attributes: BaseInfoAttributes
instance-attribute
¶
id: Literal['/'] = '/'
class-attribute
instance-attribute
¶
links: Annotated[Optional[ResourceLinks], StrictField(description='a links object containing links related to the resource.')] = None
class-attribute
instance-attribute
¶
meta: Annotated[Optional[Meta], StrictField(description='a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship.')] = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_schema_extra=resource_json_schema_extra)
class-attribute
instance-attribute
¶
relationships: Annotated[Optional[Relationships], StrictField(description='[Relationships object](https://jsonapi.org/format/1.0/#document-resource-object-relationships)\ndescribing relationships between the resource and other JSON API resources.')] = None
class-attribute
instance-attribute
¶
type: Literal['info'] = 'info'
class-attribute
instance-attribute
¶
Resource
¶
Bases: BaseResource
Resource objects appear in a JSON API document to represent resources.
Source code in optimade/models/jsonapi.py
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
|
attributes: Annotated[Optional[Attributes], StrictField(description='an attributes object representing some of the resource’s data.')] = None
class-attribute
instance-attribute
¶
id: Annotated[str, StrictField(description='Resource ID')]
instance-attribute
¶
links: Annotated[Optional[ResourceLinks], StrictField(description='a links object containing links related to the resource.')] = None
class-attribute
instance-attribute
¶
meta: Annotated[Optional[Meta], StrictField(description='a meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship.')] = None
class-attribute
instance-attribute
¶
model_config = ConfigDict(json_schema_extra=resource_json_schema_extra)
class-attribute
instance-attribute
¶
relationships: Annotated[Optional[Relationships], StrictField(description='[Relationships object](https://jsonapi.org/format/1.0/#document-resource-object-relationships)\ndescribing relationships between the resource and other JSON API resources.')] = None
class-attribute
instance-attribute
¶
type: Annotated[str, StrictField(description='Resource type')]
instance-attribute
¶
StrictField(default=PydanticUndefined, *, description=None, **kwargs)
¶
A wrapper around pydantic.Field
that does the following:
- Forbids any "extra" keys that would be passed to
pydantic.Field
, except those used elsewhere to modify the schema in-place, e.g. "uniqueItems", "pattern" and those added by OptimadeField, e.g. "unit", "queryable" and "sortable". - Emits a warning when no description is provided.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
default |
Any
|
The only non-keyword argument allowed for Field. |
PydanticUndefined
|
description |
Optional[str]
|
The description of the |
None
|
**kwargs |
Any
|
Extra keyword arguments to be passed to |
{}
|
Raises:
Type | Description |
---|---|
RuntimeError
|
If |
Returns:
Type | Description |
---|---|
Any
|
The pydantic |
Source code in optimade/models/utils.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|