Skip to content

Commit

Permalink
Add helpful exception message for length_op_rhs
Browse files Browse the repository at this point in the history
Co-Authored-By: Matthew Evans <7916000+ml-evs@users.noreply.github.com>
  • Loading branch information
CasperWA and ml-evs committed Jan 8, 2020
1 parent bdef029 commit 9cd2929
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 37 deletions.
16 changes: 8 additions & 8 deletions openapi/index_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@
"Info"
],
"summary": "Get Info",
"operationId": "get_info_index_optimade_v0.10.1_info_get",
"operationId": "get_info_index_optimade_v0_10_1_info_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"title": "Response Get Info Index Optimade V0.10.1 Info Get",
"title": "Response Get Info Index Optimade V0 10 1 Info Get",
"anyOf": [
{
"$ref": "#/components/schemas/IndexInfoResponse"
Expand All @@ -230,7 +230,7 @@
"Links"
],
"summary": "Get Links",
"operationId": "get_links_index_optimade_v0.10.1_links_get",
"operationId": "get_links_index_optimade_v0_10_1_links_get",
"parameters": [
{
"description": "See [the full and latest OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst) for filter query syntax.\n\nExample: `chemical_formula = \"Al\" OR (prototype_formula = \"AB\" AND elements HAS Si, Al, O)`.\n",
Expand Down Expand Up @@ -358,7 +358,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Links Index Optimade V0.10.1 Links Get",
"title": "Response Get Links Index Optimade V0 10 1 Links Get",
"anyOf": [
{
"$ref": "#/components/schemas/LinksResponse"
Expand Down Expand Up @@ -390,14 +390,14 @@
"Info"
],
"summary": "Get Info",
"operationId": "get_info_index_optimade_v0.10_info_get",
"operationId": "get_info_index_optimade_v0_10_info_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"title": "Response Get Info Index Optimade V0.10 Info Get",
"title": "Response Get Info Index Optimade V0 10 Info Get",
"anyOf": [
{
"$ref": "#/components/schemas/IndexInfoResponse"
Expand All @@ -419,7 +419,7 @@
"Links"
],
"summary": "Get Links",
"operationId": "get_links_index_optimade_v0.10_links_get",
"operationId": "get_links_index_optimade_v0_10_links_get",
"parameters": [
{
"description": "See [the full and latest OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst) for filter query syntax.\n\nExample: `chemical_formula = \"Al\" OR (prototype_formula = \"AB\" AND elements HAS Si, Al, O)`.\n",
Expand Down Expand Up @@ -547,7 +547,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Links Index Optimade V0.10 Links Get",
"title": "Response Get Links Index Optimade V0 10 Links Get",
"anyOf": [
{
"$ref": "#/components/schemas/LinksResponse"
Expand Down
56 changes: 28 additions & 28 deletions openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -733,14 +733,14 @@
"Info"
],
"summary": "Get Info",
"operationId": "get_info_optimade_v0.10.1_info_get",
"operationId": "get_info_optimade_v0_10_1_info_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"title": "Response Get Info Optimade V0.10.1 Info Get",
"title": "Response Get Info Optimade V0 10 1 Info Get",
"anyOf": [
{
"$ref": "#/components/schemas/InfoResponse"
Expand All @@ -762,7 +762,7 @@
"Info"
],
"summary": "Get Entry Info",
"operationId": "get_entry_info_optimade_v0.10.1_info__entry__get",
"operationId": "get_entry_info_optimade_v0_10_1_info__entry__get",
"parameters": [
{
"required": true,
Expand All @@ -780,7 +780,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Entry Info Optimade V0.10.1 Info Entry Get",
"title": "Response Get Entry Info Optimade V0 10 1 Info Entry Get",
"anyOf": [
{
"$ref": "#/components/schemas/EntryInfoResponse"
Expand Down Expand Up @@ -812,7 +812,7 @@
"Links"
],
"summary": "Get Links",
"operationId": "get_links_optimade_v0.10.1_links_get",
"operationId": "get_links_optimade_v0_10_1_links_get",
"parameters": [
{
"description": "See [the full and latest OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst) for filter query syntax.\n\nExample: `chemical_formula = \"Al\" OR (prototype_formula = \"AB\" AND elements HAS Si, Al, O)`.\n",
Expand Down Expand Up @@ -940,7 +940,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Links Optimade V0.10.1 Links Get",
"title": "Response Get Links Optimade V0 10 1 Links Get",
"anyOf": [
{
"$ref": "#/components/schemas/LinksResponse"
Expand Down Expand Up @@ -972,7 +972,7 @@
"References"
],
"summary": "Get References",
"operationId": "get_references_optimade_v0.10.1_references_get",
"operationId": "get_references_optimade_v0_10_1_references_get",
"parameters": [
{
"description": "See [the full and latest OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst) for filter query syntax.\n\nExample: `chemical_formula = \"Al\" OR (prototype_formula = \"AB\" AND elements HAS Si, Al, O)`.\n",
Expand Down Expand Up @@ -1100,7 +1100,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get References Optimade V0.10.1 References Get",
"title": "Response Get References Optimade V0 10 1 References Get",
"anyOf": [
{
"$ref": "#/components/schemas/ReferenceResponseMany"
Expand Down Expand Up @@ -1132,7 +1132,7 @@
"References"
],
"summary": "Get Single Reference",
"operationId": "get_single_reference_optimade_v0.10.1_references__entry_id__get",
"operationId": "get_single_reference_optimade_v0_10_1_references__entry_id__get",
"parameters": [
{
"required": true,
Expand Down Expand Up @@ -1181,7 +1181,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Single Reference Optimade V0.10.1 References Entry Id Get",
"title": "Response Get Single Reference Optimade V0 10 1 References Entry Id Get",
"anyOf": [
{
"$ref": "#/components/schemas/ReferenceResponseOne"
Expand Down Expand Up @@ -1213,7 +1213,7 @@
"Structures"
],
"summary": "Get Structures",
"operationId": "get_structures_optimade_v0.10.1_structures_get",
"operationId": "get_structures_optimade_v0_10_1_structures_get",
"parameters": [
{
"description": "See [the full and latest OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst) for filter query syntax.\n\nExample: `chemical_formula = \"Al\" OR (prototype_formula = \"AB\" AND elements HAS Si, Al, O)`.\n",
Expand Down Expand Up @@ -1341,7 +1341,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Structures Optimade V0.10.1 Structures Get",
"title": "Response Get Structures Optimade V0 10 1 Structures Get",
"anyOf": [
{
"$ref": "#/components/schemas/StructureResponseMany"
Expand Down Expand Up @@ -1373,7 +1373,7 @@
"Structures"
],
"summary": "Get Single Structure",
"operationId": "get_single_structure_optimade_v0.10.1_structures__entry_id__get",
"operationId": "get_single_structure_optimade_v0_10_1_structures__entry_id__get",
"parameters": [
{
"required": true,
Expand Down Expand Up @@ -1422,7 +1422,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Single Structure Optimade V0.10.1 Structures Entry Id Get",
"title": "Response Get Single Structure Optimade V0 10 1 Structures Entry Id Get",
"anyOf": [
{
"$ref": "#/components/schemas/StructureResponseOne"
Expand Down Expand Up @@ -1454,14 +1454,14 @@
"Info"
],
"summary": "Get Info",
"operationId": "get_info_optimade_v0.10_info_get",
"operationId": "get_info_optimade_v0_10_info_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"title": "Response Get Info Optimade V0.10 Info Get",
"title": "Response Get Info Optimade V0 10 Info Get",
"anyOf": [
{
"$ref": "#/components/schemas/InfoResponse"
Expand All @@ -1483,7 +1483,7 @@
"Info"
],
"summary": "Get Entry Info",
"operationId": "get_entry_info_optimade_v0.10_info__entry__get",
"operationId": "get_entry_info_optimade_v0_10_info__entry__get",
"parameters": [
{
"required": true,
Expand All @@ -1501,7 +1501,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Entry Info Optimade V0.10 Info Entry Get",
"title": "Response Get Entry Info Optimade V0 10 Info Entry Get",
"anyOf": [
{
"$ref": "#/components/schemas/EntryInfoResponse"
Expand Down Expand Up @@ -1533,7 +1533,7 @@
"Links"
],
"summary": "Get Links",
"operationId": "get_links_optimade_v0.10_links_get",
"operationId": "get_links_optimade_v0_10_links_get",
"parameters": [
{
"description": "See [the full and latest OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst) for filter query syntax.\n\nExample: `chemical_formula = \"Al\" OR (prototype_formula = \"AB\" AND elements HAS Si, Al, O)`.\n",
Expand Down Expand Up @@ -1661,7 +1661,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Links Optimade V0.10 Links Get",
"title": "Response Get Links Optimade V0 10 Links Get",
"anyOf": [
{
"$ref": "#/components/schemas/LinksResponse"
Expand Down Expand Up @@ -1693,7 +1693,7 @@
"References"
],
"summary": "Get References",
"operationId": "get_references_optimade_v0.10_references_get",
"operationId": "get_references_optimade_v0_10_references_get",
"parameters": [
{
"description": "See [the full and latest OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst) for filter query syntax.\n\nExample: `chemical_formula = \"Al\" OR (prototype_formula = \"AB\" AND elements HAS Si, Al, O)`.\n",
Expand Down Expand Up @@ -1821,7 +1821,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get References Optimade V0.10 References Get",
"title": "Response Get References Optimade V0 10 References Get",
"anyOf": [
{
"$ref": "#/components/schemas/ReferenceResponseMany"
Expand Down Expand Up @@ -1853,7 +1853,7 @@
"References"
],
"summary": "Get Single Reference",
"operationId": "get_single_reference_optimade_v0.10_references__entry_id__get",
"operationId": "get_single_reference_optimade_v0_10_references__entry_id__get",
"parameters": [
{
"required": true,
Expand Down Expand Up @@ -1902,7 +1902,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Single Reference Optimade V0.10 References Entry Id Get",
"title": "Response Get Single Reference Optimade V0 10 References Entry Id Get",
"anyOf": [
{
"$ref": "#/components/schemas/ReferenceResponseOne"
Expand Down Expand Up @@ -1934,7 +1934,7 @@
"Structures"
],
"summary": "Get Structures",
"operationId": "get_structures_optimade_v0.10_structures_get",
"operationId": "get_structures_optimade_v0_10_structures_get",
"parameters": [
{
"description": "See [the full and latest OPTiMaDe spec](https://github.com/Materials-Consortia/OPTiMaDe/blob/develop/optimade.rst) for filter query syntax.\n\nExample: `chemical_formula = \"Al\" OR (prototype_formula = \"AB\" AND elements HAS Si, Al, O)`.\n",
Expand Down Expand Up @@ -2062,7 +2062,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Structures Optimade V0.10 Structures Get",
"title": "Response Get Structures Optimade V0 10 Structures Get",
"anyOf": [
{
"$ref": "#/components/schemas/StructureResponseMany"
Expand Down Expand Up @@ -2094,7 +2094,7 @@
"Structures"
],
"summary": "Get Single Structure",
"operationId": "get_single_structure_optimade_v0.10_structures__entry_id__get",
"operationId": "get_single_structure_optimade_v0_10_structures__entry_id__get",
"parameters": [
{
"required": true,
Expand Down Expand Up @@ -2143,7 +2143,7 @@
"content": {
"application/json": {
"schema": {
"title": "Response Get Single Structure Optimade V0.10 Structures Entry Id Get",
"title": "Response Get Single Structure Optimade V0 10 Structures Entry Id Get",
"anyOf": [
{
"$ref": "#/components/schemas/StructureResponseOne"
Expand Down
4 changes: 3 additions & 1 deletion optimade/filtertransformers/mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ def length_op_rhs(self, arg):
if len(arg) == 2 or (len(arg) == 3 and arg[1] == "="):
return {"$size": arg[-1]}

raise NotImplementedError
raise NotImplementedError(
f"Operator {arg[1]} not implemented for LENGTH filter."
)

def property_zip_addon(self, arg):
# property_zip_addon: ":" property (":" property)*
Expand Down

0 comments on commit 9cd2929

Please sign in to comment.