The `references` entries describe bibliographic references. The following properties are used to provide the bibliographic details: - **address**, **annote**, **booktitle**, **chapter**, **crossref**, **edition**, **howpublished**, **institution**, **journal**, **key**, **month**, **note**
| 283 | |
| 284 | |
| 285 | class ReferenceResource(EntryResource): |
| 286 | """The `references` entries describe bibliographic references. |
| 287 | |
| 288 | The following properties are used to provide the bibliographic details: |
| 289 | |
| 290 | - **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; |
| 291 | - **bib_type**: type of the reference, corresponding to **type** property in the BibTeX specification, value is string; |
| 292 | - **authors** and **editors**: lists of *person objects* which are dictionaries with the following keys: |
| 293 | - **name**: Full name of the person, REQUIRED. |
| 294 | - **firstname**, **lastname**: Parts of the person's name, OPTIONAL. |
| 295 | - **doi** and **url**: values are strings. |
| 296 | - **Requirements/Conventions**: |
| 297 | - **Support**: OPTIONAL support in implementations, i.e., any of the properties MAY be `null`. |
| 298 | - **Query**: Support for queries on any of these properties is OPTIONAL. |
| 299 | If supported, filters MAY support only a subset of comparison operators. |
| 300 | - Every references entry MUST contain at least one of the properties. |
| 301 | |
| 302 | """ |
| 303 | |
| 304 | type: Annotated[ |
| 305 | Literal["references"], |
| 306 | OptimadeField( |
| 307 | description="""The name of the type of an entry. |
| 308 | - **Type**: string. |
| 309 | - **Requirements/Conventions**: |
| 310 | - **Support**: MUST be supported by all implementations, MUST NOT be `null`. |
| 311 | - **Query**: MUST be a queryable property with support for all mandatory filter features. |
| 312 | - **Response**: REQUIRED in the response. |
| 313 | - MUST be an existing entry type. |
| 314 | - The entry of type <type> and ID <id> MUST be returned in response to a request for `/<type>/<id>` under the versioned base URL. |
| 315 | - **Example**: `"structures"`""", |
| 316 | pattern="^references$", |
| 317 | support=SupportLevel.MUST, |
| 318 | queryable=SupportLevel.MUST, |
| 319 | ), |
| 320 | ] = "references" |
| 321 | attributes: ReferenceResourceAttributes |
| 322 | |
| 323 | @field_validator("attributes", mode="before") |
| 324 | @classmethod |
| 325 | def validate_attributes(cls, value: Any) -> dict[str, Any]: |
| 326 | if not isinstance(value, dict): |
| 327 | if isinstance(value, BaseModel): |
| 328 | value = value.model_dump() |
| 329 | else: |
| 330 | raise TypeError("attributes field must be a mapping") |
| 331 | if not any(prop[1] is not None for prop in value): |
| 332 | raise ValueError("reference object must have at least one field defined") |
| 333 | return value |