Skip to content

Commit c83a9bf

Browse files
committed
Readme
1 parent cb9db55 commit c83a9bf

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

docs/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
|[**override\_subgraph\_urls**](#override_subgraph_urls)|`object`|Configuration for overriding subgraph URLs.<br/>Default: `{}`<br/>||
1616
|[**query\_planner**](#query_planner)|`object`|Query planning configuration.<br/>Default: `{"allow_expose":false,"timeout":"10s"}`<br/>||
1717
|[**supergraph**](#supergraph)|`object`|Configuration for the Federation supergraph source. By default, the router will use a local file-based supergraph source (`./supergraph.graphql`).<br/>||
18-
|[**traffic\_shaping**](#traffic_shaping)|`object`|Configuration for the traffic-shaper executor. Use these configurations to control how requests are being executed to subgraphs.<br/>Default: `{"dedupe_enabled":true,"max_connections_per_host":100,"pool_idle_timeout_seconds":50}`<br/>||
18+
|[**traffic\_shaping**](#traffic_shaping)|`object`|Configuration for the traffic-shaping of the executor. Use these configurations to control how requests are being executed to subgraphs.<br/>Default: `{"dedupe_enabled":true,"max_connections_per_host":100,"pool_idle_timeout_seconds":50}`<br/>||
1919

2020
**Additional Properties:** not allowed
2121
**Example**
@@ -641,7 +641,7 @@ For more information on the available functions and syntax, see the
641641

642642
|Name|Type|Description|Required|
643643
|----|----|-----------|--------|
644-
|**expression**|`string`||yes|
644+
|**expression**|`string`|The VRL expression string.<br/>|yes|
645645

646646

647647
<a name="headersallresponse"></a>
@@ -863,7 +863,7 @@ For more information on the available functions and syntax, see the
863863

864864
|Name|Type|Description|Required|
865865
|----|----|-----------|--------|
866-
|**expression**|`string`||yes|
866+
|**expression**|`string`|The VRL expression string.<br/>|yes|
867867

868868

869869
<a name="headerssubgraphs"></a>
@@ -1116,7 +1116,7 @@ For more information on the available functions and syntax, see the
11161116

11171117
|Name|Type|Description|Required|
11181118
|----|----|-----------|--------|
1119-
|**expression**|`string`||yes|
1119+
|**expression**|`string`|The VRL expression string.<br/>|yes|
11201120

11211121

11221122
<a name="headerssubgraphsadditionalpropertiesresponse"></a>
@@ -1338,7 +1338,7 @@ For more information on the available functions and syntax, see the
13381338

13391339
|Name|Type|Description|Required|
13401340
|----|----|-----------|--------|
1341-
|**expression**|`string`||yes|
1341+
|**expression**|`string`|The VRL expression string.<br/>|yes|
13421342

13431343

13441344
<a name="http"></a>
@@ -1808,7 +1808,7 @@ Request timeout for the Hive Console CDN requests.
18081808
<a name="traffic_shaping"></a>
18091809
## traffic\_shaping: object
18101810

1811-
Configuration for the traffic-shaper executor. Use these configurations to control how requests are being executed to subgraphs.
1811+
Configuration for the traffic-shaping of the executor. Use these configurations to control how requests are being executed to subgraphs.
18121812

18131813

18141814
**Properties**

lib/router-config/src/primitives/expression.rs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use once_cell::sync::Lazy;
2-
use schemars::{JsonSchema, Schema, SchemaGenerator};
3-
use serde::{Deserialize, Serialize};
2+
use schemars::{JsonSchema, Schema, SchemaGenerator, json_schema};
3+
use serde::{Deserialize, Serialize, ser::SerializeStruct};
44
use std::{borrow::Cow, collections::BTreeMap};
55
use vrl::{
66
compiler::{compile as vrl_compile, Program as VrlProgram, TargetValue as VrlTargetValue},
@@ -109,7 +109,9 @@ impl Serialize for Expression {
109109
where
110110
S: serde::Serializer,
111111
{
112-
serializer.serialize_str(&self.expression)
112+
let mut state = serializer.serialize_struct("Expression", 1)?;
113+
state.serialize_field("expression", &self.expression)?;
114+
state.end()
113115
}
114116
}
115117

@@ -118,8 +120,19 @@ impl JsonSchema for Expression {
118120
"Expression".into()
119121
}
120122

121-
fn json_schema(gen: &mut SchemaGenerator) -> Schema {
122-
String::json_schema(gen)
123+
fn json_schema(_gen: &mut SchemaGenerator) -> Schema {
124+
json_schema!({
125+
"type": "object",
126+
"description": "A VRL expression used for dynamic evaluations.",
127+
"properties": {
128+
"expression": {
129+
"type": "string",
130+
"description": "The VRL expression string."
131+
}
132+
},
133+
"required": ["expression"],
134+
"additionalProperties": false
135+
})
123136
}
124137
}
125138

0 commit comments

Comments
 (0)