vovk 3.0.0-draft.324 → 3.0.0-draft.325

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.
@@ -15,8 +15,8 @@ function createCodeExamples({ handlerName, handlerSchema, controllerSchema, pack
15
15
  const outputValidation = handlerSchema?.validation?.output;
16
16
  const iterationValidation = handlerSchema?.validation?.iteration;
17
17
  const getTsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: true, indent: indent ?? 4 });
18
- const getPySample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 4, comment: '#' });
19
- const getRsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 4 });
18
+ const getPySample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 2, comment: '#' });
19
+ const getRsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 2 });
20
20
  const hasArg = !!queryValidation || !!bodyValidation || !!paramsValidation;
21
21
  const rpcName = controllerSchema.rpcModuleName;
22
22
  const handlerNameSnake = toSnakeCase(handlerName);
@@ -55,13 +55,15 @@ for await (const item of response) {
55
55
  const PY_CODE = `from ${packageJson?.py_name ?? packageNameSnake} import ${rpcName}
56
56
 
57
57
  response = ${rpcName}.${handlerNameSnake}(${hasArg
58
- ? [
59
- bodyValidation ? ` body=${getPySample(bodyValidation)},` : null,
60
- queryValidation ? ` query=${getPySample(queryValidation)},` : null,
61
- paramsValidation ? ` params=${getPySample(paramsValidation)},` : null,
62
- ]
63
- .filter(Boolean)
64
- .join('\n')
58
+ ? '\n' +
59
+ [
60
+ bodyValidation ? ` body=${getPySample(bodyValidation)},` : null,
61
+ queryValidation ? ` query=${getPySample(queryValidation)},` : null,
62
+ paramsValidation ? ` params=${getPySample(paramsValidation)},` : null,
63
+ ]
64
+ .filter(Boolean)
65
+ .join('\n') +
66
+ '\n'
65
67
  : ''})
66
68
 
67
69
  ${outputValidation ? `print(response)\n${getPySample(outputValidation, 0)}` : ''}${iterationValidation
@@ -98,7 +100,7 @@ pub fn main() {
98
100
  for (i, item) in stream.enumerate() {
99
101
  println!("#{}: {:?}", i, item);
100
102
  /*
101
- #0: iteration ${getTsSample(iterationValidation, 6)}
103
+ #0: iteration ${getTsSample(iterationValidation, 4)}
102
104
  */
103
105
  }
104
106
  },
@@ -15,8 +15,8 @@ function createCodeExamples({ handlerName, handlerSchema, controllerSchema, pack
15
15
  const outputValidation = handlerSchema?.validation?.output;
16
16
  const iterationValidation = handlerSchema?.validation?.iteration;
17
17
  const getTsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: true, indent: indent ?? 4 });
18
- const getPySample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 4, comment: '#' });
19
- const getRsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 4 });
18
+ const getPySample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 2, comment: '#' });
19
+ const getRsSample = (schema, indent) => (0, getJSONSchemaExample_1.getJSONSchemaExample)(schema, { stripQuotes: false, indent: indent ?? 2 });
20
20
  const hasArg = !!queryValidation || !!bodyValidation || !!paramsValidation;
21
21
  const rpcName = controllerSchema.rpcModuleName;
22
22
  const handlerNameSnake = toSnakeCase(handlerName);
@@ -55,13 +55,15 @@ for await (const item of response) {
55
55
  const PY_CODE = `from ${packageJson?.py_name ?? packageNameSnake} import ${rpcName}
56
56
 
57
57
  response = ${rpcName}.${handlerNameSnake}(${hasArg
58
- ? [
59
- bodyValidation ? ` body=${getPySample(bodyValidation)},` : null,
60
- queryValidation ? ` query=${getPySample(queryValidation)},` : null,
61
- paramsValidation ? ` params=${getPySample(paramsValidation)},` : null,
62
- ]
63
- .filter(Boolean)
64
- .join('\n')
58
+ ? '\n' +
59
+ [
60
+ bodyValidation ? ` body=${getPySample(bodyValidation)},` : null,
61
+ queryValidation ? ` query=${getPySample(queryValidation)},` : null,
62
+ paramsValidation ? ` params=${getPySample(paramsValidation)},` : null,
63
+ ]
64
+ .filter(Boolean)
65
+ .join('\n') +
66
+ '\n'
65
67
  : ''})
66
68
 
67
69
  ${outputValidation ? `print(response)\n${getPySample(outputValidation, 0)}` : ''}${iterationValidation
@@ -98,7 +100,7 @@ pub fn main() {
98
100
  for (i, item) in stream.enumerate() {
99
101
  println!("#{}: {:?}", i, item);
100
102
  /*
101
- #0: iteration ${getTsSample(iterationValidation, 6)}
103
+ #0: iteration ${getTsSample(iterationValidation, 4)}
102
104
  */
103
105
  }
104
106
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "3.0.0-draft.324",
3
+ "version": "3.0.0-draft.325",
4
4
  "main": "./cjs/index.js",
5
5
  "module": "./mjs/index.js",
6
6
  "types": "./mjs/index.d.ts",