skir-java-gen
Advanced tools
+2
-2
@@ -553,3 +553,3 @@ import { convertCase, } from "skir-internal"; | ||
| case "int64": | ||
| case "uint64": | ||
| case "hash64": | ||
| return "0"; | ||
@@ -606,3 +606,3 @@ case "float32": | ||
| case "int64": | ||
| case "uint64": | ||
| case "hash64": | ||
| case "float32": | ||
@@ -609,0 +609,0 @@ case "float64": |
@@ -64,3 +64,3 @@ /** | ||
| case "int64": | ||
| case "uint64": | ||
| case "hash64": | ||
| return "java.lang.Long"; | ||
@@ -90,3 +90,3 @@ case "float32": | ||
| case "int64": | ||
| case "uint64": | ||
| case "hash64": | ||
| return "long"; | ||
@@ -126,4 +126,4 @@ case "float32": | ||
| return "build.skir.Serializers.int64()"; | ||
| case "uint64": | ||
| return "build.skir.Serializers.javaUint64()"; | ||
| case "hash64": | ||
| return "build.skir.Serializers.javaHash64()"; | ||
| case "float32": | ||
@@ -130,0 +130,0 @@ return "build.skir.Serializers.float32()"; |
+3
-3
| { | ||
| "name": "skir-java-gen", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "", | ||
@@ -36,3 +36,3 @@ "keywords": [], | ||
| "dependencies": { | ||
| "skir-internal": "^0.0.8", | ||
| "skir-internal": "^0.1.0", | ||
| "zod": "^4.2.1" | ||
@@ -51,3 +51,3 @@ }, | ||
| "prettier-plugin-organize-imports": "^4.2.0", | ||
| "skir": "^0.0.7", | ||
| "skir": "^1.0.4", | ||
| "ts-node": "^10.9.2", | ||
@@ -54,0 +54,0 @@ "tsx": "^4.21.0", |
+15
-17
@@ -8,18 +8,19 @@ [](https://www.npmjs.com/package/skir-java-gen) | ||
| ## Installation | ||
| ## Set up | ||
| From your project's root directory, run `npm i --save-dev skir-java-gen`. | ||
| In your `skir.yml` file, add the following snippet under `generators`: | ||
| ```yaml | ||
| - mod: skir-java-gen | ||
| outDir: ./src/main/java/skirout | ||
| config: {} | ||
| # Alternatively: | ||
| # outDir: ./src/main/kotlin/my/project/skirout | ||
| # config: | ||
| # packagePrefix: my.project. | ||
| ``` | ||
| The `npm run skirc` command will now generate .java files within the `skirout` directory. | ||
| The generated Java code has a runtime dependency on `build.skir:skir-client`. Add this line to your `build.gradle` file in the `dependencies` section: | ||
| The generated Java code has a runtime dependency on `build.skir:skir-kotlin-client`. Add this line to your `build.gradle` file in the `dependencies` section: | ||
| ```gradle | ||
| implementation 'build.skir:skir-kotlin-client:1.1.4' // Pick the latest version | ||
| implementation 'build.skir:skir-client:0.1.0' // Pick the latest version | ||
| ``` | ||
@@ -233,3 +234,3 @@ | ||
| // The dense JSON flavor is the flavor you should pick if you intend to | ||
| // deserialize the value in the future. skir allows fields to be renamed, | ||
| // deserialize the value in the future. Skir allows fields to be renamed, | ||
| // and because field names are not part of the dense JSON, renaming a field | ||
@@ -271,4 +272,4 @@ // does not prevent you from deserializing the value. | ||
| ```java | ||
| // Since all skir objects are deeply immutable, all lists contained in a | ||
| // skir object are also deeply immutable. | ||
| // Since all Skir objects are deeply immutable, all lists contained in a | ||
| // Skir object are also deeply immutable. | ||
| // This section helps understand when lists are copied and when they are | ||
@@ -295,8 +296,5 @@ // not. | ||
| .setPets(pets) | ||
| // 'pets' is mutable, so skir makes an immutable shallow copy of it | ||
| // 'pets' is mutable, so Skir makes an immutable shallow copy of it | ||
| .build(); | ||
| // jade.pets().clear(); | ||
| // ^ Runtime error: pets is a frozen list | ||
| assert pets.equals(jade.pets()); | ||
@@ -309,3 +307,3 @@ assert pets != jade.pets(); | ||
| .setPets(jade.pets()) | ||
| // The list is already immutable, so skir does not make a copy | ||
| // The list is already immutable, so Skir does not make a copy | ||
| .build(); | ||
@@ -322,3 +320,3 @@ | ||
| // findByKey() returns the user with the given key (specified in the .skir file). | ||
| // find() returns the user with the given key (specified in the .skir file). | ||
| // In this example, the key is the user id. | ||
@@ -430,2 +428,2 @@ // The first lookup runs in O(N) time, and the following lookups run in O(1) | ||
| Note that both the Java and Kotlin generated code share the same runtime dependency: `build.skir:skir-kotlin-client`. | ||
| Note that both the Java and Kotlin generated code share the same runtime dependency: `build.skir:skir-client`. |
+2
-2
@@ -877,3 +877,3 @@ import { | ||
| case "int64": | ||
| case "uint64": | ||
| case "hash64": | ||
| return "0"; | ||
@@ -935,3 +935,3 @@ case "float32": | ||
| case "int64": | ||
| case "uint64": | ||
| case "hash64": | ||
| case "float32": | ||
@@ -938,0 +938,0 @@ case "float64": |
@@ -77,3 +77,3 @@ import type { RecordKey, RecordLocation, ResolvedType } from "skir-internal"; | ||
| case "int64": | ||
| case "uint64": | ||
| case "hash64": | ||
| return "java.lang.Long"; | ||
@@ -102,3 +102,3 @@ case "float32": | ||
| case "int64": | ||
| case "uint64": | ||
| case "hash64": | ||
| return "long"; | ||
@@ -140,4 +140,4 @@ case "float32": | ||
| return "build.skir.Serializers.int64()"; | ||
| case "uint64": | ||
| return "build.skir.Serializers.javaUint64()"; | ||
| case "hash64": | ||
| return "build.skir.Serializers.javaHash64()"; | ||
| case "float32": | ||
@@ -144,0 +144,0 @@ return "build.skir.Serializers.float32()"; |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
147196
-0.07%423
-0.47%+ Added
- Removed
Updated