Skip to content

Commit 27a0904

Browse files
mrtnzlmlkodiakhq[bot]
authored andcommitted
YCR: bootstrap SDUI GraphQL schema
The server now knows how to return `SDUIComponent` union including filter of supported components via `supported` arg.
1 parent b5434fc commit 27a0904

22 files changed

+202
-69
lines changed

src/ya-comiste-react-native/schema.graphql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
type Query {
2-
mobileEntrypointSections(
3-
id: String! # TODO: limit to only supported pages? (com.yaComiste.Explore)
4-
): [SDUISection!]!
2+
mobileEntrypointSections(id: String!): [SDUISection!]!
53
}
64

75
type SDUISection {

src/ya-comiste-rust/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,16 @@ Example query:
3333
{
3434
mobileEntrypointSections(key: "com.yaComiste.Explore") {
3535
id
36-
title
36+
__typename
37+
component(supported: ["SDUIScrollViewHorizontalComponent"]) {
38+
__typename
39+
... on SDUICardComponent {
40+
id
41+
}
42+
... on SDUIScrollViewHorizontalComponent {
43+
id
44+
}
45+
}
3746
}
3847
}
3948
```
@@ -42,6 +51,8 @@ Example query:
4251

4352
- setup CI for Rust
4453
- DB strings and source-code translations
54+
- dataloaders
55+
- DB schema validations
4556

4657
# ArangoDB
4758

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"database":"_system","lastTickAtDumpStart":"90475","properties":{"id":"1","name":"_system","isSystem":true}}
1+
{"database":"_system","lastTickAtDumpStart":"132102","properties":{"id":"1","name":"_system","isSystem":true}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"database":"ya-comiste","lastTickAtDumpStart":"90477","properties":{"id":"84144","name":"ya-comiste","isSystem":false}}
1+
{"database":"ya-comiste","lastTickAtDumpStart":"132104","properties":{"id":"84144","name":"ya-comiste","isSystem":false}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
{"type":2300,"data":{"_key":"89538","_id":"entrypoint_sections/89538","_from":"entrypoints/com.yaComiste.Explore","_to":"sections/10771","_rev":"_bff4636---"}}
2-
{"type":2300,"data":{"_key":"89458","_id":"entrypoint_sections/89458","_from":"entrypoints/com.yaComiste.Explore","_to":"sections/9810","_rev":"_bfgGf26---","user":"users/87047"}}
2+
{"type":2300,"data":{"_key":"89458","_id":"entrypoint_sections/89458","_from":"entrypoints/com.yaComiste.Explore","_to":"sections/9810","_rev":"_bgJE1wa---"}}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
{"type":2300,"data":{"_key":"9810","_id":"sections/9810","_rev":"_bff1zcW---","section_order":1,"title":"Places nearby","type":"SDUIScrollViewHorizontalComponent"}}
2-
{"type":2300,"data":{"_key":"10771","_id":"sections/10771","_rev":"_bff2ICi---","section_order":2,"title":"Bakeries nearby","type":"SDUIScrollViewHorizontalComponent"}}
1+
{"type":2300,"data":{"_key":"9810","_id":"sections/9810","_rev":"_bgLK4YO---","order":1,"component":{"typename":"SDUIScrollViewHorizontalComponent"}}}
2+
{"type":2300,"data":{"_key":"10771","_id":"sections/10771","_rev":"_bgLL-8W---","order":2,"component":{"typename":"SDUIScrollViewHorizontalComponent"}}}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"indexes":[],"parameters":{"allowUserKeys":true,"cacheEnabled":false,"cid":"85191","deleted":false,"globallyUniqueId":"hC8B4EB76885F/9751","id":"85191","isDisjoint":false,"isSmart":false,"isSmartChild":false,"isSystem":false,"keyOptions":{"allowUserKeys":true,"type":"traditional","lastValue":11596},"minReplicationFactor":1,"name":"sections","numberOfShards":1,"planId":"9751","replicationFactor":1,"schema":{"message":"","level":"strict","rule":{"type":"object","oneOf":[{"properties":{"section_order":{"type":"number"},"type":{"const":"SDUIScrollViewHorizontalComponent"},"title":{"type":"string"}},"additionalProperties":false,"required":["section_order","type","title"]},{"properties":{"section_order":{"type":"number"},"type":{"const":"SDUICardComponent"}},"additionalProperties":false,"required":["section_order","type"]}]}},"shardKeys":["_key"],"shards":{},"status":3,"tempObjectId":"0","type":2,"version":9,"waitForSync":false,"writeConcern":1}}
1+
{"indexes":[],"parameters":{"allowUserKeys":true,"cacheEnabled":false,"cid":"85191","deleted":false,"globallyUniqueId":"hC8B4EB76885F/9751","id":"85191","isDisjoint":false,"isSmart":false,"isSmartChild":false,"isSystem":false,"keyOptions":{"allowUserKeys":true,"type":"traditional","lastValue":11596},"minReplicationFactor":1,"name":"sections","numberOfShards":1,"planId":"9751","replicationFactor":1,"schema":null,"shardKeys":["_key"],"shards":{},"status":3,"tempObjectId":"0","type":2,"version":9,"waitForSync":false,"writeConcern":1}}
Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
1-
use graphql::graphql_context::Context;
2-
31
/// TODO: maybe `MobileEntrypoint` would be a better name so we are future proof?
42
#[derive(Clone, Debug, serde::Deserialize)]
53
pub struct Entrypoint {
6-
pub _id: juniper::ID,
4+
pub _id: String,
75
pub _key: String,
86
}
9-
10-
#[juniper::graphql_object(context = Context)]
11-
impl Entrypoint {
12-
fn id(&self) -> &str {
13-
&self._id
14-
}
15-
}

src/ya-comiste-rust/crates/sdui/src/errors.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/// use sdui::errors::ModelError;
55
/// assert_eq!(format!("{}", ModelError::LogicError("ups".to_string())), "Logic error: ups")
66
/// ```
7+
#[derive(Debug)]
78
pub enum ModelError {
89
// TODO: naming (SDUIError?)
910
DatabaseError(arangors::ClientError),

src/ya-comiste-rust/crates/sdui/src/lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@ pub mod entrypoint;
22
pub mod errors;
33
pub mod model;
44
pub mod sdui_section;
5+
6+
mod sdui_card_component;
7+
mod sdui_component;
8+
mod sdui_description_component;
9+
mod sdui_jumbotron_component;
10+
mod sdui_scrollview_horizontal_component;

0 commit comments

Comments
 (0)