schemas¶
ENTRY_INFO_SCHEMAS: Dict[str, Callable[[None], Dict]] = {'structures': StructureResource.schema, 'references': ReferenceResource.schema}
module-attribute
¶
This dictionary is used to define the /info/<entry_type>
endpoints.
retrieve_queryable_properties(schema, queryable_properties=None, entry_type=None)
¶
Recursively loops through the schema of a pydantic model and resolves all references, returning a dictionary of all the OPTIMADE-queryable properties of that model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schema |
dict
|
The schema of the pydantic model. |
required |
queryable_properties |
list
|
The list of properties to find in the schema. |
None
|
entry_type |
str
|
An optional entry type for the model. Will be used to lookup schemas for any config-defined fields. |
None
|
Returns:
Type | Description |
---|---|
dict
|
A flat dictionary with properties as keys, containing the field |
dict
|
description, unit, sortability, support level, queryability |
dict
|
and type, where provided. |
Source code in optimade/server/schemas.py
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|