Skip to content

Commit

Permalink
feat: Query JSON Schema (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-martinez authored May 4, 2022
1 parent d57c35f commit eb6f644
Show file tree
Hide file tree
Showing 13 changed files with 164 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/query/and.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "and.schema.json",
"title": "And",
"description": "And query identifier",
"type": "array",
"items": {
"$ref": "query/shortAnd.schema.json"
}
}
11 changes: 11 additions & 0 deletions api/query/arrayValue.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "arrayValue.schema.json",
"title": "ArrayValue",
"description": "ArrayValue query identifier",
"type": "array",
"items": {
"$ref": "query/value.schema.json"
},
"additionalProperties": false
}
11 changes: 11 additions & 0 deletions api/query/binaryFunction.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "binaryFunction.schema.json",
"title": "Binary Function",
"description": "Binary Function query identifier",
"oneOf": [
{
"$ref": "query/eq.schema.json"
}
]
}
13 changes: 13 additions & 0 deletions api/query/eq.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "eq.schema.json",
"title": "Eq",
"description": "Eq query identifier",
"type": "object",
"properties": {
"$eq": {
"$ref": "query/value.schema.json"
}
},
"additionalProperties": false
}
7 changes: 7 additions & 0 deletions api/query/find.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "find.schema.json",
"title": "Find",
"description": "Find query identifier",
"$ref": "query/shortAnd.schema.json"
}
19 changes: 19 additions & 0 deletions api/query/keyValue.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "keyValue.schema.json",
"title": "KeyValue",
"description": "KeyValue query identifier",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"oneOf": [
{
"$ref": "query/value.schema.json"
},
{
"$ref": "query/binaryFunction.schema.json"
}
]
}
}
}
9 changes: 9 additions & 0 deletions api/query/meRef.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "meRef.schema.json",
"title": "MeRef",
"description": "MeRef query identifier",
"type": "string",
"pattern": "^@me$",
"additionalProperties": false
}
8 changes: 8 additions & 0 deletions api/query/numberValue.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "numberValue.schema.json",
"title": "NumberValue",
"description": "NumberValue query identifier",
"type": "number",
"additionalProperties": false
}
13 changes: 13 additions & 0 deletions api/query/query.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "query.schema.json",
"title": "Query",
"description": "Query query identifier",
"type": "object",
"properties": {
"$find": {
"$ref": "query/find.schema.json"
}
},
"additionalProperties": false
}
28 changes: 28 additions & 0 deletions api/query/shortAnd.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "shortAnd.schema.json",
"title": "ShortAnd",
"description": "ShortAnd query identifier",
"type": "object",
"properties": {
"$and": {
"$ref": "query/and.schema.json"
}
},
"patternProperties": {
"^[a-zA-Z0-9_]+$": {
"oneOf": [
{
"$ref": "query/value.schema.json"
},
{
"$ref": "query/binaryFunction.schema.json"
},
{
"$ref": "query/shortAndFunctions.schema.json"
}
]
}
},
"additionalProperties": false
}
13 changes: 13 additions & 0 deletions api/query/shortAndFunctions.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "shortAndFunctions.schema.json",
"title": "ShortAndFunctions",
"description": "ShortAndFunctions query identifier",
"type": "object",
"properties": {
"$and": {
"$ref": "query/and.schema.json"
}
},
"additionalProperties": false
}
9 changes: 9 additions & 0 deletions api/query/stringValue.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "stringValue.schema.json",
"title": "StringValue",
"description": "StringValue query identifier",
"type": "string",
"pattern": "^[^@].*",
"additionalProperties": false
}
13 changes: 13 additions & 0 deletions api/query/value.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://raw.githubusercontent.com/lenra-io/ex_component_schema/beta/priv/static/draft-lenra.json",
"$id": "value.schema.json",
"title": "Value",
"description": "Value query identifier",
"oneOf": [
{"$ref": "query/arrayValue.schema.json"},
{"$ref": "query/meRef.schema.json"},
{"$ref": "query/stringValue.schema.json"},
{"$ref": "query/numberValue.schema.json"}
],
"additionalProperties": false
}

0 comments on commit eb6f644

Please sign in to comment.