vovk 3.0.0-draft.325 → 3.0.0-draft.326
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14,7 +14,7 @@ function createCodeExamples({ handlerName, handlerSchema, controllerSchema, pack
|
|
|
14
14
|
const paramsValidation = handlerSchema?.validation?.params;
|
|
15
15
|
const outputValidation = handlerSchema?.validation?.output;
|
|
16
16
|
const iterationValidation = handlerSchema?.validation?.iteration;
|
|
17
|
-
const getTsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: true, indent: indent ??
|
|
17
|
+
const getTsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: true, indent: indent ?? 2 });
|
|
18
18
|
const getPySample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 2, comment: '#' });
|
|
19
19
|
const getRsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 2 });
|
|
20
20
|
const hasArg = !!queryValidation || !!bodyValidation || !!paramsValidation;
|
|
@@ -70,7 +70,7 @@ ${outputValidation ? `print(response)\n${getPySample(outputValidation, 0)}` : ''
|
|
|
70
70
|
? `for i, item in enumerate(response):
|
|
71
71
|
print(f"iteration #{i}:\\n {item}")
|
|
72
72
|
# iteration #0:
|
|
73
|
-
${getPySample(iterationValidation
|
|
73
|
+
${getPySample(iterationValidation)}`
|
|
74
74
|
: ''}`;
|
|
75
75
|
const serdeUnwrap = (fake) => `from_value(json!(${fake})).unwrap()`;
|
|
76
76
|
const RS_CODE = `use ${packageJson?.rs_name ?? packageNameSnake}::${rpcNameSnake};
|
|
@@ -90,7 +90,7 @@ pub fn main() {
|
|
|
90
90
|
? `match response {
|
|
91
91
|
Ok(output) => println!("{:?}", output),
|
|
92
92
|
/*
|
|
93
|
-
output ${getTsSample(outputValidation
|
|
93
|
+
output ${getTsSample(outputValidation)}
|
|
94
94
|
*/
|
|
95
95
|
Err(e) => println!("error: {:?}", e),
|
|
96
96
|
}`
|
|
@@ -100,7 +100,7 @@ pub fn main() {
|
|
|
100
100
|
for (i, item) in stream.enumerate() {
|
|
101
101
|
println!("#{}: {:?}", i, item);
|
|
102
102
|
/*
|
|
103
|
-
#0: iteration ${getTsSample(iterationValidation,
|
|
103
|
+
#0: iteration ${getTsSample(iterationValidation, 3)}
|
|
104
104
|
*/
|
|
105
105
|
}
|
|
106
106
|
},
|
|
@@ -14,7 +14,7 @@ function createCodeExamples({ handlerName, handlerSchema, controllerSchema, pack
|
|
|
14
14
|
const paramsValidation = handlerSchema?.validation?.params;
|
|
15
15
|
const outputValidation = handlerSchema?.validation?.output;
|
|
16
16
|
const iterationValidation = handlerSchema?.validation?.iteration;
|
|
17
|
-
const getTsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: true, indent: indent ??
|
|
17
|
+
const getTsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: true, indent: indent ?? 2 });
|
|
18
18
|
const getPySample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 2, comment: '#' });
|
|
19
19
|
const getRsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 2 });
|
|
20
20
|
const hasArg = !!queryValidation || !!bodyValidation || !!paramsValidation;
|
|
@@ -70,7 +70,7 @@ ${outputValidation ? `print(response)\n${getPySample(outputValidation, 0)}` : ''
|
|
|
70
70
|
? `for i, item in enumerate(response):
|
|
71
71
|
print(f"iteration #{i}:\\n {item}")
|
|
72
72
|
# iteration #0:
|
|
73
|
-
${getPySample(iterationValidation
|
|
73
|
+
${getPySample(iterationValidation)}`
|
|
74
74
|
: ''}`;
|
|
75
75
|
const serdeUnwrap = (fake) => `from_value(json!(${fake})).unwrap()`;
|
|
76
76
|
const RS_CODE = `use ${packageJson?.rs_name ?? packageNameSnake}::${rpcNameSnake};
|
|
@@ -90,7 +90,7 @@ pub fn main() {
|
|
|
90
90
|
? `match response {
|
|
91
91
|
Ok(output) => println!("{:?}", output),
|
|
92
92
|
/*
|
|
93
|
-
output ${getTsSample(outputValidation
|
|
93
|
+
output ${getTsSample(outputValidation)}
|
|
94
94
|
*/
|
|
95
95
|
Err(e) => println!("error: {:?}", e),
|
|
96
96
|
}`
|
|
@@ -100,7 +100,7 @@ pub fn main() {
|
|
|
100
100
|
for (i, item) in stream.enumerate() {
|
|
101
101
|
println!("#{}: {:?}", i, item);
|
|
102
102
|
/*
|
|
103
|
-
#0: iteration ${getTsSample(iterationValidation,
|
|
103
|
+
#0: iteration ${getTsSample(iterationValidation, 3)}
|
|
104
104
|
*/
|
|
105
105
|
}
|
|
106
106
|
},
|