-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Labels
ergonomicsFeatures that improve the usability of the packageFeatures that improve the usability of the packagegood first issueGood for newcomersGood for newcomersmodelsFor issues related to the pydantic models directlyFor issues related to the pydantic models directlypriority/lowIssue or PR with a consensus of low priorityIssue or PR with a consensus of low priorityschemaConcerns the schema modelsConcerns the schema modelssuggestions
Description
Currently our regexes for response_fields and sort allow e.g. response_fields="chemical_formula_anonymous" through, where the field is treated as the quoted string '"chemical_formula_anonymous"'.
This is not ideal and can be fixed in the model regexes directly (which we should then push upstream for v1.0.1 of the spec).
optimade-python-tools/optimade/server/query_params.py
Lines 110 to 119 in ce8b4dd
| response_fields: str = Query( | |
| "", | |
| description="A comma-delimited set of fields to be provided in the output.\nIf provided, these fields MUST be returned along with the REQUIRED fields.\nOther OPTIONAL fields MUST NOT be returned when this parameter is present.\nExample: `http://example.com/v1/structures?response_fields=last_modified,nsites`", | |
| regex=r"([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", | |
| ), | |
| sort: str = Query( | |
| "", | |
| description='If supporting sortable queries, an implementation MUST use the `sort` query parameter with format as specified by [JSON API 1.0](https://jsonapi.org/format/1.0/#fetching-sorting).\n\nAn implementation MAY support multiple sort fields for a single query.\nIf it does, it again MUST conform to the JSON API 1.0 specification.\n\nIf an implementation supports sorting for an entry listing endpoint, then the `/info/<entries>` endpoint MUST include, for each field name `<fieldname>` in its `data.properties.<fieldname>` response value that can be used for sorting, the key `sortable` with value `true`.\nIf a field name under an entry listing endpoint supporting sorting cannot be used for sorting, the server MUST either leave out the `sortable` key or set it equal to `false` for the specific field name.\nThe set of field names, with `sortable` equal to `true` are allowed to be used in the "sort fields" list according to its definition in the JSON API 1.0 specification.\nThe field `sortable` is in addition to each property description and other OPTIONAL fields.\nAn example is shown in the section Entry Listing Info Endpoints.', | |
| regex=r"([a-z_][a-z_0-9]*(,[a-z_][a-z_0-9]*)*)?", | |
| ), |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ergonomicsFeatures that improve the usability of the packageFeatures that improve the usability of the packagegood first issueGood for newcomersGood for newcomersmodelsFor issues related to the pydantic models directlyFor issues related to the pydantic models directlypriority/lowIssue or PR with a consensus of low priorityIssue or PR with a consensus of low priorityschemaConcerns the schema modelsConcerns the schema modelssuggestions