@voxgig/sdkgen 4.2.0 → 4.2.2
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.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/helpers/canonType.d.ts +2 -1
- package/dist/helpers/canonType.js +36 -0
- package/dist/helpers/canonType.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -2
- package/dist/sdkgen.js +3 -2
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/project/.sdk/src/cmp/c/ReadmeEntity_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeHowto_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeRef_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeTopTest_c.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeHowto_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeRef_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeTopQuick_clojure.ts +2 -2
- package/project/.sdk/src/cmp/clojure/ReadmeTopTest_clojure.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeEntity_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeHowto_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeRef_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeTopQuick_cpp.ts +2 -2
- package/project/.sdk/src/cmp/cpp/ReadmeTopTest_cpp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeEntity_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeHowto_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeRef_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeTopQuick_csharp.ts +2 -2
- package/project/.sdk/src/cmp/csharp/ReadmeTopTest_csharp.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeEntity_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeHowto_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeQuick_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeRef_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeTopQuick_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/ReadmeTopTest_dart.ts +2 -2
- package/project/.sdk/src/cmp/dart/TestEntity_dart.ts +6 -3
- package/project/.sdk/src/cmp/elixir/utility_elixir.ts +2 -1
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +2 -2
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +2 -2
- package/project/.sdk/src/cmp/go/utility_go.ts +10 -1
- package/project/.sdk/src/cmp/java/ReadmeEntity_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeHowto_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeRef_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeTopQuick_java.ts +2 -2
- package/project/.sdk/src/cmp/java/ReadmeTopTest_java.ts +2 -2
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +13 -1
- package/project/.sdk/src/cmp/js/utility_js.ts +10 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeEntity_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeHowto_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeRef_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeTopQuick_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/ReadmeTopTest_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +2 -2
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/lua/ReadmeEntity_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeRef_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +2 -2
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeEntity_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeHowto_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeRef_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeTopQuick_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/ocaml/ReadmeTopTest_ocaml.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeEntity_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeHowto_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeRef_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeTopQuick_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/ReadmeTopTest_perl.ts +2 -2
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +6 -1
- package/project/.sdk/src/cmp/php/ReadmeEntity_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeRef_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +2 -2
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeEntity_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeRef_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +2 -2
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeEntity_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeRef_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +2 -2
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeEntity_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeHowto_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeRef_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeTopQuick_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/ReadmeTopTest_rust.ts +2 -2
- package/project/.sdk/src/cmp/rust/utility_rust.ts +8 -1
- package/project/.sdk/src/cmp/scala/ReadmeEntity_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeHowto_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeTopQuick_scala.ts +2 -2
- package/project/.sdk/src/cmp/scala/ReadmeTopTest_scala.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeEntity_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeHowto_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/ReadmeTopTest_swift.ts +2 -2
- package/project/.sdk/src/cmp/swift/utility_swift.ts +16 -2
- package/project/.sdk/src/cmp/ts/utility_ts.ts +10 -1
- package/project/.sdk/src/cmp/zig/ReadmeEntity_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeHowto_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeRef_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
- package/project/.sdk/src/cmp/zig/ReadmeTopTest_zig.ts +2 -2
- package/project/.sdk/tm/elixir/lib/utility/struct/voxgig_struct.ex +13 -1
- package/project/sdkgen-package.json +1 -1
- package/src/helpers/canonType.ts +38 -0
- package/src/sdkgen.ts +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
// A type-correct Clojure literal for a field's canonical type. The create
|
|
11
11
|
// example builds a real struct map, so array/object render as (vs/jt)/(vs/jm).
|
|
12
12
|
function cljLit(type: any, placeholder: string = 'example'): string {
|
|
13
|
-
const k =
|
|
13
|
+
const k = canonScalarKey(type)
|
|
14
14
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
15
15
|
if ('BOOLEAN' === k) return 'true'
|
|
16
16
|
if ('ARRAY' === k) return '(vs/jt)'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
// A type-correct Clojure literal for a field's canonical type.
|
|
11
11
|
function cljLit(type: any): string {
|
|
12
|
-
const k =
|
|
12
|
+
const k = canonScalarKey(type)
|
|
13
13
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
14
14
|
if ('BOOLEAN' === k) return 'true'
|
|
15
15
|
if ('ARRAY' === k) return '(vs/jt)'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityDataIdField, entityOps } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -31,7 +31,7 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
|
31
31
|
|
|
32
32
|
// A type-correct Clojure literal for a param.
|
|
33
33
|
const cljLit = (type: any, placeholder: string = 'example'): string => {
|
|
34
|
-
const k =
|
|
34
|
+
const k = canonScalarKey(type)
|
|
35
35
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
36
36
|
if ('BOOLEAN' === k) return 'true'
|
|
37
37
|
if ('ARRAY' === k) return '(vs/jt)'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
// A type-correct Clojure literal for a field's canonical type.
|
|
11
11
|
function cljLit(type: any, placeholder: string = 'example'): string {
|
|
12
|
-
const k =
|
|
12
|
+
const k = canonScalarKey(type)
|
|
13
13
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
14
14
|
if ('BOOLEAN' === k) return 'true'
|
|
15
15
|
if ('ARRAY' === k) return '(vs/jt)'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
// A type-correct Clojure literal for a param: numeric/boolean/array/object
|
|
12
12
|
// params render a typed literal; strings render the quoted placeholder.
|
|
13
13
|
function cljLit(type: any, placeholder: string = 'example'): string {
|
|
14
|
-
const k =
|
|
14
|
+
const k = canonScalarKey(type)
|
|
15
15
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
16
16
|
if ('BOOLEAN' === k) return 'true'
|
|
17
17
|
if ('ARRAY' === k) return '(vs/jt)'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
// A type-correct Clojure literal for a field's canonical type.
|
|
11
11
|
function cljLit(type: any): string {
|
|
12
|
-
const k =
|
|
12
|
+
const k = canonScalarKey(type)
|
|
13
13
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
14
14
|
if ('BOOLEAN' === k) return 'true'
|
|
15
15
|
if ('ARRAY' === k) return '(vs/jt)'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -13,7 +13,7 @@ import { cppVarName } from './utility_cpp'
|
|
|
13
13
|
|
|
14
14
|
// A type-correct C++ literal for a field's canonical type.
|
|
15
15
|
function cppLit(type: any, placeholder: string = 'example'): string {
|
|
16
|
-
const k =
|
|
16
|
+
const k = canonScalarKey(type)
|
|
17
17
|
if ('INTEGER' === k || 'NUMBER' === k) return 'Value(1)'
|
|
18
18
|
if ('BOOLEAN' === k) return 'Value(true)'
|
|
19
19
|
if ('ARRAY' === k) return 'vlist()'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -11,7 +11,7 @@ import { cppVarName } from './utility_cpp'
|
|
|
11
11
|
|
|
12
12
|
// A type-correct C++ literal for a field's canonical type.
|
|
13
13
|
function cppLit(type: any): string {
|
|
14
|
-
const k =
|
|
14
|
+
const k = canonScalarKey(type)
|
|
15
15
|
if ('INTEGER' === k || 'NUMBER' === k) return 'Value(1)'
|
|
16
16
|
if ('BOOLEAN' === k) return 'Value(true)'
|
|
17
17
|
if ('ARRAY' === k) return 'vlist()'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityDataIdField, entityOps } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -56,7 +56,7 @@ ${ctor}
|
|
|
56
56
|
// A type-correct C++ literal for a param: numeric/boolean/array/object
|
|
57
57
|
// params render a typed sdk::Value; strings render the quoted placeholder.
|
|
58
58
|
const cppLit = (type: any, placeholder: string = 'example'): string => {
|
|
59
|
-
const k =
|
|
59
|
+
const k = canonScalarKey(type)
|
|
60
60
|
if ('INTEGER' === k || 'NUMBER' === k) return 'Value(1)'
|
|
61
61
|
if ('BOOLEAN' === k) return 'Value(true)'
|
|
62
62
|
if ('ARRAY' === k) return 'vlist()'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -13,7 +13,7 @@ import { cppVarName } from './utility_cpp'
|
|
|
13
13
|
|
|
14
14
|
// A type-correct C++ literal for a field's canonical type.
|
|
15
15
|
function cppLit(type: any, placeholder: string = 'example'): string {
|
|
16
|
-
const k =
|
|
16
|
+
const k = canonScalarKey(type)
|
|
17
17
|
if ('INTEGER' === k || 'NUMBER' === k) return 'Value(1)'
|
|
18
18
|
if ('BOOLEAN' === k) return 'Value(true)'
|
|
19
19
|
if ('ARRAY' === k) return 'vlist()'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -11,7 +11,7 @@ import { cppVarName } from './utility_cpp'
|
|
|
11
11
|
|
|
12
12
|
// A type-correct C++ literal for a param.
|
|
13
13
|
function cppLit(type: any, placeholder: string = 'example'): string {
|
|
14
|
-
const k =
|
|
14
|
+
const k = canonScalarKey(type)
|
|
15
15
|
if ('INTEGER' === k || 'NUMBER' === k) return 'Value(1)'
|
|
16
16
|
if ('BOOLEAN' === k) return 'Value(true)'
|
|
17
17
|
if ('ARRAY' === k) return 'vlist()'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -11,7 +11,7 @@ import { cppVarName } from './utility_cpp'
|
|
|
11
11
|
|
|
12
12
|
// A type-correct C++ literal for a field's canonical type.
|
|
13
13
|
function cppLit(type: any): string {
|
|
14
|
-
const k =
|
|
14
|
+
const k = canonScalarKey(type)
|
|
15
15
|
if ('INTEGER' === k || 'NUMBER' === k) return 'Value(1)'
|
|
16
16
|
if ('BOOLEAN' === k) return 'Value(true)'
|
|
17
17
|
if ('ARRAY' === k) return 'vlist()'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -13,7 +13,7 @@ import { csVarName } from './utility_csharp'
|
|
|
13
13
|
|
|
14
14
|
// A type-correct, JSON-serialisable C# literal for a field's canonical type.
|
|
15
15
|
function csLit(type: any, placeholder: string = 'example'): string {
|
|
16
|
-
const k =
|
|
16
|
+
const k = canonScalarKey(type)
|
|
17
17
|
if ('INTEGER' === k) return '1L'
|
|
18
18
|
if ('NUMBER' === k) return '1.0'
|
|
19
19
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -12,7 +12,7 @@ import { csVarName } from './utility_csharp'
|
|
|
12
12
|
|
|
13
13
|
// A type-correct C# literal for a field's canonical type.
|
|
14
14
|
function csLit(type: any): string {
|
|
15
|
-
const k =
|
|
15
|
+
const k = canonScalarKey(type)
|
|
16
16
|
if ('INTEGER' === k) return '1L'
|
|
17
17
|
if ('NUMBER' === k) return '1.0'
|
|
18
18
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -56,7 +56,7 @@ var client = ${ctor};
|
|
|
56
56
|
|
|
57
57
|
// A type-correct C# literal for a param.
|
|
58
58
|
const csLit = (type: any, placeholder: string = 'example'): string => {
|
|
59
|
-
const k =
|
|
59
|
+
const k = canonScalarKey(type)
|
|
60
60
|
if ('INTEGER' === k) return '1L'
|
|
61
61
|
if ('NUMBER' === k) return '1.0'
|
|
62
62
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -13,7 +13,7 @@ import { csVarName } from './utility_csharp'
|
|
|
13
13
|
|
|
14
14
|
// A type-correct C# literal for a field's canonical type.
|
|
15
15
|
function csLit(type: any, placeholder: string = 'example'): string {
|
|
16
|
-
const k =
|
|
16
|
+
const k = canonScalarKey(type)
|
|
17
17
|
if ('INTEGER' === k) return '1L'
|
|
18
18
|
if ('NUMBER' === k) return '1.0'
|
|
19
19
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -14,7 +14,7 @@ import { csVarName } from './utility_csharp'
|
|
|
14
14
|
// render a typed literal; strings render the quoted placeholder. The SDK's
|
|
15
15
|
// loose object model means all values live in Dictionary<string, object?>.
|
|
16
16
|
function csLit(type: any, placeholder: string = 'example'): string {
|
|
17
|
-
const k =
|
|
17
|
+
const k = canonScalarKey(type)
|
|
18
18
|
if ('INTEGER' === k) return '1L'
|
|
19
19
|
if ('NUMBER' === k) return '1.0'
|
|
20
20
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -12,7 +12,7 @@ import { csVarName } from './utility_csharp'
|
|
|
12
12
|
|
|
13
13
|
// A type-correct C# literal for a field's canonical type.
|
|
14
14
|
function csLit(type: any): string {
|
|
15
|
-
const k =
|
|
15
|
+
const k = canonScalarKey(type)
|
|
16
16
|
if ('INTEGER' === k) return '1L'
|
|
17
17
|
if ('NUMBER' === k) return '1.0'
|
|
18
18
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
// A type-correct Dart literal for a field's canonical type. Strings render
|
|
13
13
|
// the quoted placeholder (single-quoted, matching the generated Dart style).
|
|
14
14
|
function dartLit(type: any, placeholder: string = 'example'): string {
|
|
15
|
-
const k =
|
|
15
|
+
const k = canonScalarKey(type)
|
|
16
16
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
17
17
|
if ('BOOLEAN' === k) return 'true'
|
|
18
18
|
if ('ARRAY' === k) return '<dynamic>[]'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
// A type-correct Dart literal for a field's canonical type.
|
|
12
12
|
function dartLit(type: any): string {
|
|
13
|
-
const k =
|
|
13
|
+
const k = canonScalarKey(type)
|
|
14
14
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
15
15
|
if ('BOOLEAN' === k) return 'true'
|
|
16
16
|
if ('ARRAY' === k) return '<dynamic>[]'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityDataIdField, entityOps, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -69,7 +69,7 @@ final client = ${ctor};
|
|
|
69
69
|
|
|
70
70
|
// A type-correct, executable Dart literal for a param.
|
|
71
71
|
const dartLit = (type: any, placeholder: string = 'example'): string => {
|
|
72
|
-
const k =
|
|
72
|
+
const k = canonScalarKey(type)
|
|
73
73
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
74
74
|
if ('BOOLEAN' === k) return 'true'
|
|
75
75
|
if ('ARRAY' === k) return '<dynamic>[]'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -14,7 +14,7 @@ import { dartPackageName } from './Package_dart'
|
|
|
14
14
|
// A type-correct Dart literal for a field's canonical type. Strings render
|
|
15
15
|
// the quoted placeholder (single-quoted, matching the generated Dart style).
|
|
16
16
|
function dartLit(type: any, placeholder: string = 'example'): string {
|
|
17
|
-
const k =
|
|
17
|
+
const k = canonScalarKey(type)
|
|
18
18
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
19
19
|
if ('BOOLEAN' === k) return 'true'
|
|
20
20
|
if ('ARRAY' === k) return '<dynamic>[]'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape, safeVarName, exampleVarName, matchArg, idLiteral } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -14,7 +14,7 @@ import { dartPackageName } from './Package_dart'
|
|
|
14
14
|
// array/object params render a typed literal; strings render the quoted
|
|
15
15
|
// placeholder (single-quoted, matching the generated Dart style).
|
|
16
16
|
function dartLit(type: any, placeholder: string = 'example'): string {
|
|
17
|
-
const k =
|
|
17
|
+
const k = canonScalarKey(type)
|
|
18
18
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
19
19
|
if ('BOOLEAN' === k) return 'true'
|
|
20
20
|
if ('ARRAY' === k) return '<dynamic>[]'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, safeVarName, exampleVarName } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -12,7 +12,7 @@ import { dartPackageName } from './Package_dart'
|
|
|
12
12
|
|
|
13
13
|
// A type-correct Dart literal for a field's canonical type.
|
|
14
14
|
function dartLit(type: any): string {
|
|
15
|
-
const k =
|
|
15
|
+
const k = canonScalarKey(type)
|
|
16
16
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
17
17
|
if ('BOOLEAN' === k) return 'true'
|
|
18
18
|
if ('ARRAY' === k) return '<dynamic>[]'
|
|
@@ -382,18 +382,21 @@ const generateList: OpGen = (ctx, step, index) => {
|
|
|
382
382
|
const hasRefData = validRef && allSteps.some(s => 'create' === s.op &&
|
|
383
383
|
((s.input.ref ?? entity.name + '_ref01') === validRef))
|
|
384
384
|
|
|
385
|
-
//
|
|
385
|
+
// listvar is ALREADY a list of data maps — the list call above maps
|
|
386
|
+
// .data() over the entity instances. Mapping .data() a second time here
|
|
387
|
+
// called it on a plain Map and every entity test died at runtime with
|
|
388
|
+
// "Class '_Map<String, dynamic>' has no instance method 'data'".
|
|
386
389
|
if ('ItemExists' === validator.apply && hasRefData) {
|
|
387
390
|
Content(`
|
|
388
391
|
ok(!isempty(select(
|
|
389
|
-
|
|
392
|
+
${listvar},
|
|
390
393
|
{'id': ${validRef}_data['id']})));
|
|
391
394
|
`)
|
|
392
395
|
}
|
|
393
396
|
else if ('ItemNotExists' === validator.apply && hasRefData) {
|
|
394
397
|
Content(`
|
|
395
398
|
ok(isempty(select(
|
|
396
|
-
|
|
399
|
+
${listvar},
|
|
397
400
|
{'id': ${validRef}_data['id']})));
|
|
398
401
|
`)
|
|
399
402
|
}
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
10
|
canonKey,
|
|
11
|
+
canonScalarKey,
|
|
11
12
|
canonToType,
|
|
12
13
|
} from '@voxgig/sdkgen'
|
|
13
14
|
|
|
@@ -26,7 +27,7 @@ function elixirType(sentinel: unknown): string {
|
|
|
26
27
|
// canonical type. Strings render the quoted placeholder; numeric/boolean/
|
|
27
28
|
// collection types render a real literal so example blocks parse and run.
|
|
28
29
|
function elixirLit(sentinel: unknown, placeholder: string = 'example'): string {
|
|
29
|
-
switch (
|
|
30
|
+
switch (canonScalarKey(sentinel)) {
|
|
30
31
|
case 'INTEGER':
|
|
31
32
|
case 'NUMBER': return '1'
|
|
32
33
|
case 'BOOLEAN': return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape, goModule } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, goModule } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -12,7 +12,7 @@ import { goVarName } from './utility_go'
|
|
|
12
12
|
|
|
13
13
|
// A type-correct Go literal for a field's canonical type.
|
|
14
14
|
function goLit(type: any): string {
|
|
15
|
-
const k =
|
|
15
|
+
const k = canonScalarKey(type)
|
|
16
16
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
17
17
|
if ('BOOLEAN' === k) return 'true'
|
|
18
18
|
if ('ARRAY' === k) return '[]any{}'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape, goModule } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape, goModule } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
// A type-correct Go literal for a field's canonical type.
|
|
12
12
|
function goLit(type: any): string {
|
|
13
|
-
const k =
|
|
13
|
+
const k = canonScalarKey(type)
|
|
14
14
|
if ('INTEGER' === k || 'NUMBER' === k) return '1'
|
|
15
15
|
if ('BOOLEAN' === k) return 'true'
|
|
16
16
|
if ('ARRAY' === k) return '[]any{}'
|
|
@@ -5,6 +5,7 @@ import * as Path from 'node:path'
|
|
|
5
5
|
import {
|
|
6
6
|
camelify,
|
|
7
7
|
canonKey,
|
|
8
|
+
canonScalarKey,
|
|
8
9
|
each,
|
|
9
10
|
exampleVarName,
|
|
10
11
|
names,
|
|
@@ -55,7 +56,12 @@ function paramCanonType(entity: any, op: any, paramName: string): unknown {
|
|
|
55
56
|
// the empty `map[string]any{}`, everything else (STRING, unknown, missing)
|
|
56
57
|
// as the quoted `placeholder`.
|
|
57
58
|
function exampleValue(entity: any, op: any, paramName: string, placeholder: string): string {
|
|
58
|
-
|
|
59
|
+
// canonScalarKey, not canonKey: a nullable field's sentinel is the union
|
|
60
|
+
// ['`$ONE`', ['`$NUMBER`','`$NULL`']], which canonKey stringifies into
|
|
61
|
+
// nothing recognizable — so a `number | null` id fell through to the
|
|
62
|
+
// quoted placeholder and the example failed to compile against the type
|
|
63
|
+
// generated from that very sentinel.
|
|
64
|
+
const key = canonScalarKey(paramCanonType(entity, op, paramName))
|
|
59
65
|
if ('INTEGER' === key || 'NUMBER' === key) {
|
|
60
66
|
return '1'
|
|
61
67
|
}
|
|
@@ -68,6 +74,9 @@ function exampleValue(entity: any, op: any, paramName: string, placeholder: stri
|
|
|
68
74
|
if ('OBJECT' === key) {
|
|
69
75
|
return 'map[string]any{}'
|
|
70
76
|
}
|
|
77
|
+
if ('NULL' === key) {
|
|
78
|
+
return 'nil'
|
|
79
|
+
}
|
|
71
80
|
return `"${placeholder}"`
|
|
72
81
|
}
|
|
73
82
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -13,7 +13,7 @@ import { javaVarName } from './utility_java'
|
|
|
13
13
|
|
|
14
14
|
// A type-correct, JSON-serialisable Java literal for a field's canonical type.
|
|
15
15
|
function javaLit(type: any, placeholder: string = 'example'): string {
|
|
16
|
-
const k =
|
|
16
|
+
const k = canonScalarKey(type)
|
|
17
17
|
if ('INTEGER' === k) return '1L'
|
|
18
18
|
if ('NUMBER' === k) return '1.0'
|
|
19
19
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -11,7 +11,7 @@ import { javaVarName } from './utility_java'
|
|
|
11
11
|
|
|
12
12
|
// A type-correct Java literal for a field's canonical type.
|
|
13
13
|
function javaLit(type: any): string {
|
|
14
|
-
const k =
|
|
14
|
+
const k = canonScalarKey(type)
|
|
15
15
|
if ('INTEGER' === k) return '1L'
|
|
16
16
|
if ('NUMBER' === k) return '1.0'
|
|
17
17
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, opRequestShape, entityIdField, entityOps } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, opRequestShape, entityIdField, entityOps } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -35,7 +35,7 @@ const ReadmeQuick = cmp(function ReadmeQuick(props: any) {
|
|
|
35
35
|
// A type-correct Java literal for a param — the loose object model means
|
|
36
36
|
// all values live in a Map<String, Object>.
|
|
37
37
|
const javaLit = (type: any, placeholder: string = 'example'): string => {
|
|
38
|
-
const k =
|
|
38
|
+
const k = canonScalarKey(type)
|
|
39
39
|
if ('INTEGER' === k) return '1L'
|
|
40
40
|
if ('NUMBER' === k) return '1.0'
|
|
41
41
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, each, Content, canonToType, canonKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, each, Content, canonToType, canonKey, canonScalarKey, File, isAuthActive, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -13,7 +13,7 @@ import { javaVarName } from './utility_java'
|
|
|
13
13
|
|
|
14
14
|
// A type-correct Java literal for a field's canonical type.
|
|
15
15
|
function javaLit(type: any, placeholder: string = 'example'): string {
|
|
16
|
-
const k =
|
|
16
|
+
const k = canonScalarKey(type)
|
|
17
17
|
if ('INTEGER' === k) return '1L'
|
|
18
18
|
if ('NUMBER' === k) return '1.0'
|
|
19
19
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, isAuthActive, envName, canonKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, isAuthActive, envName, canonKey, canonScalarKey, entityIdField, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -14,7 +14,7 @@ import { javaVarName, javaPackage } from './utility_java'
|
|
|
14
14
|
// render a typed literal; strings render the quoted placeholder. The SDK's
|
|
15
15
|
// loose object model means all values live in Map<String, Object>.
|
|
16
16
|
function javaLit(type: any, placeholder: string = 'example'): string {
|
|
17
|
-
const k =
|
|
17
|
+
const k = canonScalarKey(type)
|
|
18
18
|
if ('INTEGER' === k) return '1L'
|
|
19
19
|
if ('NUMBER' === k) return '1.0'
|
|
20
20
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { cmp, Content, canonKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
2
|
+
import { cmp, Content, canonKey, canonScalarKey, entityIdField, pickExampleEntity, opRequestShape } from '@voxgig/sdkgen'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
KIT,
|
|
@@ -11,7 +11,7 @@ import { javaVarName } from './utility_java'
|
|
|
11
11
|
|
|
12
12
|
// A type-correct Java literal for a field's canonical type.
|
|
13
13
|
function javaLit(type: any): string {
|
|
14
|
-
const k =
|
|
14
|
+
const k = canonScalarKey(type)
|
|
15
15
|
if ('INTEGER' === k) return '1L'
|
|
16
16
|
if ('NUMBER' === k) return '1.0'
|
|
17
17
|
if ('BOOLEAN' === k) return 'true'
|
|
@@ -55,9 +55,21 @@ function normalizePathParams(
|
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
// Render a JSON value as a Java literal for query examples.
|
|
58
|
+
// A Java source literal for an example value from the model.
|
|
59
|
+
//
|
|
60
|
+
// An integer beyond Java's int range needs the L suffix: javac rejects a bare
|
|
61
|
+
// 120615523104 outright ("integer number too large"), so one large id in a
|
|
62
|
+
// spec's example makes the whole generated test package fail to compile.
|
|
63
|
+
// A non-integral double is fine unsuffixed.
|
|
58
64
|
function javaLiteral(v: any): string {
|
|
59
65
|
if (null == v) return 'null'
|
|
60
|
-
if ('
|
|
66
|
+
if ('boolean' === typeof v) return String(v)
|
|
67
|
+
if ('number' === typeof v) {
|
|
68
|
+
if (Number.isInteger(v) && (v > 2147483647 || v < -2147483648)) {
|
|
69
|
+
return String(v) + 'L'
|
|
70
|
+
}
|
|
71
|
+
return String(v)
|
|
72
|
+
}
|
|
61
73
|
return JSON.stringify(String(v))
|
|
62
74
|
}
|
|
63
75
|
|