Repository navigation
Conversation
…utils file for serialize specific kinds of data
… more utils to serialize
JavierRibaldelRio
left a comment
There was a problem hiding this comment.
In general the module is fine, however there are critical mistakes that must be solved.
May be it is better o include adj/http inside of model instead of adj as you commented in the workshop.
| mod info; | ||
| mod raw; | ||
|
|
||
| #[cfg(feature = "http")] |
There was a problem hiding this comment.
Add comment above this line stateing why it is required to use a feature
| pub mod http; | ||
|
|
||
| #[cfg(feature = "git")] | ||
| use std::path::PathBuf; |
There was a problem hiding this comment.
idem here (even though it's from a previous module)
| @@ -0,0 +1,39 @@ | |||
| # ADJ HTTP (`adj::http`) | |||
|
|
|||
| Builds serializable HTTP response bodies from a loaded `Adj`, without modifying | |||
There was a problem hiding this comment.
Right now it just only contains the structure of the answer,
There was a problem hiding this comment.
Add JSON structure, not just refer to example
| pub info: AdjInfo, | ||
| } | ||
|
|
||
| #[cfg(feature = "http")] |
There was a problem hiding this comment.
Is there a way of moving all this logic inside a file inside adj/?
| // A remote derive keeps the JSON representation here, without changing model. | ||
| #[derive(Serialize)] | ||
| #[serde(remote = "ProtectionKind", tag = "type", rename_all = "snake_case")] | ||
| enum ProtectionKindDef { |
There was a problem hiding this comment.
- ProtectionKind sale en snake_case ("not_equal") en /OrderPackets y en PascalCase ("NotEqual") en /ProtectionPackets.
| pub struct OrderProtectionResponse { | ||
| /// One-based protection position within its measurement, not a packet id. | ||
| #[serde(serialize_with = "serialize_adj_id")] | ||
| pub id: AdjId, |
There was a problem hiding this comment.
IMPORTANT this is logically wrong ADJId will be always an ADJid not a proteccion
| }, | ||
| "protections": [ | ||
| { | ||
| "id": 1, |
| /// Preserves the entry point used by the test startup code. Upgrade requests | ||
| /// to `/backend` receive `503` until [`serve_with_websocket`] is used with a | ||
| /// channel connected to the future WebSocket module. | ||
| pub async fn serve(listener: TcpListener, adj: &Adj) -> io::Result<()> { |
There was a problem hiding this comment.
No entiendo nada la verdad, has definido una función que te permite configuar y luego no la utilizas, esto marea mucho
serve (http.rs) ─┐
└─ serve_with_websocket ─┤─► router_with_cache(.., Unspecified) → sin CORS, sin caché
(server.rs) │
configure_server (configure.rs) ─┘─► router_with_cache(.., config.cache) + CorsLayer
| alias: measurement.alias.clone(), | ||
| name: measurement.name.clone(), | ||
| display_units: measurement.display_units.clone(), | ||
| kind: match &measurement.kind { |
There was a problem hiding this comment.
This match is identical in adj.rs:160-174, dentro de order_response
Features
software-corehttpfeature:src/adj/http/example/.Adjmethods to build the response catalogs.utilsmodule with serialization helpers.station/backend/adj/DataPackets/backend/adj/OrderPackets/backend/adj/ProtectionPackets/backend, forwarding connections to a channel for future message handling.main.rsfor manual testing.