119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198 | class ValidatorConfig(BaseSettings):
"""This class stores validator config parameters in a way that
can be easily modified for testing niche implementations. Many
of these fields are determined by the specification directly,
but it may be desirable to modify them in certain cases.
"""
response_classes: dict[str, Any] = Field(
_RESPONSE_CLASSES,
description="Dictionary containing the mapping between endpoints and response classes for the main database",
)
response_classes_index: dict[str, Any] = Field(
_RESPONSE_CLASSES_INDEX,
description="Dictionary containing the mapping between endpoints and response classes for the index meta-database",
)
entry_schemas: dict[str, Any] = Field(
_ENTRY_SCHEMAS, description="The entry listing endpoint schemas"
)
entry_endpoints: set[str] = Field(
_ENTRY_ENDPOINTS,
description="The entry endpoints to validate, if present in the API's `/info` response `entry_types_by_format['json']`",
)
unique_properties: set[str] = Field(
_UNIQUE_PROPERTIES,
description=(
"Fields that should be treated as unique indexes for all endpoints, "
"i.e. fields on which filters should return at most one entry."
),
)
inclusive_operators: dict[DataType, set[str]] = Field(
_INCLUSIVE_OPERATORS,
description=(
"Dictionary mapping OPTIMADE `DataType`s to a list of operators that are 'inclusive', "
"i.e. those that should return entries with the matching value from the filter."
),
)
exclusive_operators: dict[DataType, set[str]] = Field(
_EXCLUSIVE_OPERATORS,
description=(
"Dictionary mapping OPTIMADE `DataType`s to a list of operators that are 'exclusive', "
"i.e. those that should not return entries with the matching value from the filter."
),
)
field_specific_overrides: dict[str, dict[SupportLevel, Container[str]]] = Field(
_FIELD_SPECIFIC_OVERRIDES,
description=(
"Some fields do not require all type comparison operators to be supported. "
"This dictionary allows overriding the list of supported operators for a field, using "
"the field name as a key, and the support level of different operators with a subkey. "
"Queries on fields listed in this way will pass the validator provided the server returns a 501 status."
),
)
links_endpoint: str = Field("links", description="The name of the links endpoint")
versions_endpoint: str = Field(
"versions", description="The name of the versions endpoint"
)
info_endpoint: str = Field("info", description="The name of the info endpoint")
non_entry_endpoints: set[str] = Field(
_NON_ENTRY_ENDPOINTS,
description="The list specification-mandated endpoint names that do not contain entries",
)
top_level_non_attribute_fields: set[str] = Field(
BaseResourceMapper.TOP_LEVEL_NON_ATTRIBUTES_FIELDS,
description="Field names to treat as top-level",
)
enum_fallback_values: dict[str, dict[str, list[str]]] = Field(
_ENUM_DUMMY_VALUES,
description="Provide fallback values for enum fields to use when validating filters.",
)
|