@autorest/java 4.1.43 → 4.1.45

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/core/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "build": "pnpm build:all && pnpm check:eng && pnpm gen-compiler-extern-signature",
9
- "build:all": "pnpm -r --workspace-concurrency=Infinity --aggregate-output --reporter=append-only build",
9
+ "build:all": "pnpm -r --workspace-concurrency=Infinity build",
10
10
  "check:eng": "tsc -p ./tsconfig.eng.json --noEmit",
11
11
  "setup:min": "pnpm install && pnpm --filter \"@typespec/prettier-plugin-typespec...\" run build",
12
12
  "check-version-mismatch": "syncpack list-mismatches",
@@ -22,7 +22,7 @@
22
22
  "lint": "eslint . --max-warnings=0",
23
23
  "lint:fix": "eslint . --fix",
24
24
  "merge-coverage": "c8 -- report --reporter=cobertura --reporter=text",
25
- "pack:all": "chronus pack --pack-destination ./temp/artifacts",
25
+ "pack:all": "chronus pack --exclude standalone --pack-destination ./temp/artifacts",
26
26
  "preinstall": "npx only-allow pnpm",
27
27
  "prepare-publish": "pnpm chronus version",
28
28
  "purge": "rimraf --glob \"packages/*/node_modules/\"",
@@ -40,38 +40,41 @@
40
40
  "upload-manifest": "pnpm -r --filter=@typespec/http-specs run upload-manifest"
41
41
  },
42
42
  "devDependencies": {
43
- "@chronus/chronus": "^0.13.0",
44
- "@chronus/github": "^0.4.4",
45
- "@eslint/js": "^9.15.0",
46
- "@microsoft/api-extractor": "^7.47.11",
47
- "@octokit/core": "^6.1.2",
43
+ "@alloy-js/prettier-plugin-alloy": "^0.1.0",
44
+ "@chronus/chronus": "^0.15.0",
45
+ "@chronus/github": "^0.4.7",
46
+ "@eslint/js": "^9.18.0",
47
+ "@microsoft/api-extractor": "^7.49.1",
48
+ "@octokit/core": "^6.1.3",
48
49
  "@octokit/plugin-paginate-graphql": "^5.2.4",
49
- "@octokit/plugin-rest-endpoint-methods": "^13.2.6",
50
+ "@octokit/plugin-rest-endpoint-methods": "^13.3.0",
50
51
  "@pnpm/find-workspace-packages": "^6.0.9",
51
52
  "@types/micromatch": "^4.0.9",
52
- "@types/node": "~22.7.9",
53
- "@vitest/coverage-v8": "^2.1.5",
54
- "c8": "^10.1.2",
55
- "cspell": "^8.16.0",
56
- "eslint": "^9.15.0",
53
+ "@types/node": "~22.10.10",
54
+ "@vitest/coverage-v8": "^3.0.4",
55
+ "c8": "^10.1.3",
56
+ "cspell": "^8.17.2",
57
+ "eslint": "^9.18.0",
57
58
  "eslint-plugin-deprecation": "^3.0.0",
58
59
  "eslint-plugin-import": "^2.31.0",
59
- "eslint-plugin-react-hooks": "5.1.0-rc-fb9a90fa48-20240614",
60
+ "eslint-plugin-react-hooks": "5.1.0",
60
61
  "eslint-plugin-unicorn": "^56.0.1",
61
62
  "eslint-plugin-vitest": "^0.5.4",
62
63
  "micromatch": "^4.0.8",
63
64
  "picocolors": "~1.1.1",
64
- "playwright": "^1.49.0",
65
- "prettier": "~3.3.3",
65
+ "playwright": "^1.50.0",
66
+ "prettier": "~3.4.2",
66
67
  "prettier-plugin-astro": "^0.14.1",
67
68
  "prettier-plugin-organize-imports": "~4.1.0",
69
+ "prettier-plugin-sh": "^0.14.0",
68
70
  "rimraf": "~6.0.1",
69
71
  "syncpack": "^13.0.0",
70
72
  "tsx": "^4.19.2",
71
- "typescript": "~5.6.3",
72
- "typescript-eslint": "^8.15.0",
73
- "vitest": "^2.1.5",
74
- "yaml": "~2.5.1"
73
+ "typescript": "~5.7.3",
74
+ "typescript-eslint": "^8.21.0",
75
+ "vite-plugin-node-polyfills": "^0.23.0",
76
+ "vitest": "^3.0.5",
77
+ "yaml": "~2.7.0"
75
78
  },
76
79
  "syncpack": {
77
80
  "dependencyTypes": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/java",
3
- "version": "4.1.43",
3
+ "version": "4.1.45",
4
4
  "description": "The Java extension for classic generators in AutoRest.",
5
5
  "scripts": {
6
6
  "autorest": "autorest",
package/readme.md CHANGED
@@ -161,7 +161,7 @@ With the fields specified below:
161
161
  |-----|----|--------|-----------|-------|
162
162
  |operationId|String|true|The `operationId` of the operation. For global polling configuration, use `default`. Case insensitive.|`Pets_put`|
163
163
  |strategy|String|false|The invocation to construct a polling strategy. Use fully qualified class name if outside the implementation subpackage specified in `namespace` & `implementation-subpackage`. Use dynamic literals `{httpPipeline}`, `{context}`, `{serializerAdapter}`, `{endpoint}`, `{serviceVersion}`, `{intermediate-type}`, `{final-type}` if these components are required to construct the polling strategy. Default is `new DefaultPollingStrategy<>(new PollingStrategyOptions({httpPipeline}).setEndpoint({endpoint}).setContext({context}).setServiceVersion({serviceVersion}))`.|`new com.azure.core.util.polling.OperationResourcePollingStrategy<>({httpPipeline}, {context})`|
164
- |sync-stragety|String|false|Similar to `stragety`. It refers to the synchronous operation resource polling strategy.||
164
+ |sync-strategy|String|false|Similar to `strategy`. It refers to the synchronous operation resource polling strategy.||
165
165
  |intermediate-type|String|false|The type of the polling intermediate type. Use fully qualified class name if outside the base package specified in `namespace`. Default is the return type specified on the operation in Swagger, or `BinaryData` if the operation returns `void`.|`PollResult`,`com.azure.core.util.BinaryData`|
166
166
  |final-type|String|false|The type of the final result type. Use fully qualified class name if outside the base package specified in `namespace`. Default is the return type specified on the operation in Swagger, or `BinaryData` if the operation returns `void`.|`Pet`,`com.azure.core.util.BinaryData`|
167
167
  |poll-interval|integer|false|The default interval in seconds to poll with (can be modified by users in `PollerFlux` and `SyncPoller`. Default is 1.|30|
@@ -296,6 +296,159 @@ This contains the generated classes from the [test swaggers](https://github.com/
296
296
 
297
297
  This also contains test code for these generated code under `src/test`. Running the tests will hit the test server running locally (see https://github.com/Azure/autorest.testserver for instructions) and verify the correctness of the generated code.
298
298
 
299
+ # Working with the core submodule
300
+
301
+ This repository uses a git
302
+ [submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) for the
303
+ [TypeSpec OSS core](https://github.com/microsoft/typespec).
304
+
305
+ This section covers some basic everyday tasks for working with it. The steps
306
+ below are are really just one possible workflow. There's more than one way
307
+ to accomplish these tasks and if you prefer to do it differently, that's
308
+ fine too!
309
+
310
+ ## Configuring git to recurse submodules automatically for most commands
311
+
312
+ Run the following command:
313
+
314
+ ```
315
+ git config --global submodule.recurse true
316
+ ```
317
+
318
+ This will effectively pass `--recurse-submodules` for you to git commands
319
+ that accept it. It should eliminate some of the common pain points around
320
+ submodules.
321
+
322
+ NOTE: git clone is exceptional, see below.
323
+
324
+ ## Cloning recursively
325
+
326
+ `git clone` does not recurse submodules automatically, even with
327
+ submodule.recurse=true as configured above.
328
+
329
+ Fork the repo, then clone recursively as follows:
330
+
331
+ ```
332
+ git clone --recurse-submodules https://github.com/(your_username)/autorest.java
333
+ ```
334
+
335
+ ## Updating and initializing the submodule
336
+
337
+ In some situations, even with the above setting, you may still end up with the core/ folder
338
+ being uninitialized and not having a good clone of microsoft/typespec, or with the core/ folder
339
+ initialized, but checked out to the wrong commit for the current branch. To fix this, run the
340
+ following command to update and initialize the submodule:
341
+
342
+ ```
343
+ git submodule update --init
344
+ ```
345
+
346
+ ## Point the submodule origin remote to your fork
347
+
348
+ You can change the remotes of the submodule so that `origin` is your fork of
349
+ microsoft/typespec rather than microsoft/typespec itself, and microsoft/typespec is
350
+ `upstream`:
351
+
352
+ ```
353
+ cd [repo_root]
354
+ cd core
355
+ git remote remove origin
356
+ git remote add origin https://github.com/(your_username)/typespec
357
+ git remote add upstream https://github.com/microsoft/typespec
358
+ ```
359
+
360
+ ## Build
361
+
362
+ Run "Build-TypeSpec.ps1" script to build `@azure-tools/typespec-java` as TypeSpec emitter.
363
+
364
+ The TypeSpec emitter can be installed via e.g.
365
+ ```
366
+ npm install [repo_root]/typespec-extension/azure-tools-typespec-java-[version].tgz
367
+ ```
368
+
369
+ Run "Build-AutoRest.ps1" script to build `@autorest/java` as Autorest extension.
370
+
371
+ The AutoRest extension can be used via e.g.
372
+ ```
373
+ autorest --use="[repo_root]" --java [readme.md]
374
+ ```
375
+
376
+ :warning: the script would "checkout" unstaged code in "./core" submodule. Please stage/commit your code there.
377
+
378
+ Before building Maven project and packaging NPM package, the script does 3 things:
379
+
380
+ 1. Apply a patch to code in "core", mainly for switching to `azure-autorest-customization` as customization lib. -- This is the only step that affect AutoRest extension.
381
+ 2. Build the JAR for `core/packages/http-client-java/generator/http-client-generator` module (with the patch to code in step 1), and copy it to `typespec-extension/generator/http-client-generator`.
382
+ 3. Copy the source from `core/packages/http-client-java/emitter` (with the patch to code in step 1) to `typespec-extension`.
383
+
384
+ If you do not plan to modify these patched files in your PR, you can use "assume-unchanged" to ignore the changes on these files:
385
+ ```
386
+ git update-index --assume-unchanged packages/http-client-java/emitter/src/code-model-builder.ts packages/http-client-java/emitter/src/lib.ts packages/http-client-java/generator/http-client-generator-core/pom.xml packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/postprocessor/Postprocessor.java packages/http-client-java/generator/http-client-generator/src/main/resources/readme/pom.xml
387
+ ```
388
+ "no-assume-unchanged" would unset the files marked by "assume-unchanged".
389
+
390
+ Alternatively, you can commit the patched files, and revert this commit before creating the pull request for review.
391
+
392
+ ## Making a cross-cutting change across both repos
393
+
394
+ 1. Make matching branches:
395
+
396
+ ```
397
+ cd core
398
+ git checkout -b featurebranch
399
+
400
+ cd ..
401
+ git checkout -b featurebranch
402
+ ```
403
+
404
+ 2. Make your changes as needed to both repos.
405
+
406
+ 3. Commit changes to both repos:
407
+
408
+ ```
409
+ cd core
410
+ git commit -a -m "Core part of my change"
411
+
412
+ cd ..
413
+ git commit -a -m "Azure-specific part of my change"
414
+ ```
415
+
416
+ 4. Push
417
+
418
+ ```
419
+ git push origin featurebranch
420
+ ```
421
+
422
+ NOTE: If you configured submodule.recurse=true as shown above, this will
423
+ automatically push the submodule typespec branch along with the autorest.java
424
+ branch. If you prefer not to use that, then `cd core` and push that too.
425
+
426
+ 5. Create 2 PRs from the two branches that were pushed to your
427
+ microsoft/typespec and Azure/autorest.java forks. Start with the microsoft/typespec
428
+ PR, then follow up with the Azure/autorest.java PR that depends on it.
429
+
430
+ 6. Get approval for both PRs before merging either of them.
431
+
432
+ 7. Merge the microsoft/typespec PR first.
433
+
434
+ 8. Update the submodule to point to the actual commit you merged to microsoft/typespec main:
435
+
436
+ ```
437
+ cd core
438
+ git fetch --all
439
+ git checkout upstream/main
440
+
441
+ cd ..
442
+ git commit -a -m "Update submodule"
443
+ git push origin featurebranch
444
+ ```
445
+
446
+ 9. Merge the autorest.java PR and you're done.
447
+
448
+ Note that you only need to do all of the above when your changes span both
449
+ repos. If you are only changing one repo or the other, then just work in
450
+ each individual repo as you would any other.
451
+
299
452
  # Contributing
300
453
 
301
454
  This project welcomes contributions and suggestions. Most contributions require you to agree to a
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-tools/typespec-java",
3
- "version": "0.26.1",
3
+ "version": "0.27.4",
4
4
  "description": "TypeSpec library for emitting Java client from the TypeSpec REST protocol binding",
5
5
  "keywords": [
6
6
  "TypeSpec"
@@ -17,21 +17,21 @@
17
17
  },
18
18
  "license": "MIT",
19
19
  "type": "module",
20
- "main": "dist/src/emitter.js",
20
+ "main": "dist/src/index.js",
21
21
  "exports": {
22
- ".": "./dist/src/emitter.js",
23
- "./testing": "./dist/src/testing/index.js"
22
+ ".": {
23
+ "types": "./dist/src/index.d.ts",
24
+ "default": "./dist/src/index.js"
25
+ }
24
26
  },
25
- "tspMain": "dist/src/emitter.js",
26
27
  "engines": {
27
- "node": ">=14.0.0"
28
+ "node": ">=18.0.0"
28
29
  },
29
30
  "scripts": {
30
31
  "clean": "rimraf ./dist ./temp",
31
32
  "build": "tsc -p .",
32
33
  "watch": "tsc -p . --watch",
33
- "test": "mocha",
34
- "test-official": "c8 mocha --forbid-only",
34
+ "test": "vitest run",
35
35
  "lint": "eslint . --ext .ts --max-warnings=0",
36
36
  "lint:fix": "eslint . --fix --ext .ts",
37
37
  "format": "npm run -s prettier -- --write",
@@ -45,17 +45,18 @@
45
45
  "generator/http-client-generator/target/emitter.jar"
46
46
  ],
47
47
  "peerDependencies": {
48
- "@azure-tools/typespec-azure-core": ">=0.48.0 <1.0.0",
49
- "@azure-tools/typespec-azure-resource-manager": ">=0.48.0 <1.0.0",
50
- "@azure-tools/typespec-autorest": ">=0.48.0 <1.0.0",
51
- "@azure-tools/typespec-azure-rulesets": ">=0.48.0 <1.0.0",
52
- "@azure-tools/typespec-client-generator-core": ">=0.48.5 <1.0.0",
53
- "@typespec/compiler": ">=0.62.0 <1.0.0",
54
- "@typespec/http": ">=0.62.0 <1.0.0",
55
- "@typespec/openapi": ">=0.62.0 <1.0.0",
56
- "@typespec/rest": ">=0.62.0 <1.0.0",
57
- "@typespec/versioning": ">=0.62.0 <1.0.0",
58
- "@typespec/xml": ">=0.62.0 <1.0.0"
48
+ "@azure-tools/typespec-azure-core": ">=0.50.0 <1.0.0",
49
+ "@azure-tools/typespec-azure-resource-manager": ">=0.50.0 <1.0.0",
50
+ "@azure-tools/typespec-autorest": ">=0.50.0 <1.0.0",
51
+ "@azure-tools/typespec-azure-rulesets": ">=0.50.0 <1.0.0",
52
+ "@azure-tools/typespec-client-generator-core": ">=0.50.3 <1.0.0",
53
+ "@typespec/compiler": ">=0.64.0 <1.0.0",
54
+ "@typespec/http": ">=0.64.0 <1.0.0",
55
+ "@typespec/openapi": ">=0.64.0 <1.0.0",
56
+ "@typespec/rest": ">=0.64.0 <1.0.0",
57
+ "@typespec/versioning": ">=0.64.0 <1.0.0",
58
+ "@typespec/xml": ">=0.64.0 <1.0.0",
59
+ "@azure-tools/typespec-liftr-base": ">=0.7.0 <1.0.0"
59
60
  },
60
61
  "dependencies": {
61
62
  "@autorest/codemodel": "~4.20.0",
@@ -63,29 +64,31 @@
63
64
  "lodash": "~4.17.21"
64
65
  },
65
66
  "devDependencies": {
66
- "@azure-tools/typespec-azure-core": "0.48.0",
67
- "@azure-tools/typespec-azure-resource-manager": "0.48.0",
68
- "@azure-tools/typespec-autorest": "0.48.0",
69
- "@azure-tools/typespec-azure-rulesets": "0.48.0",
70
- "@azure-tools/typespec-client-generator-core": "0.48.5",
67
+ "@azure-tools/typespec-azure-core": "0.51.0",
68
+ "@azure-tools/typespec-azure-resource-manager": "0.51.0",
69
+ "@azure-tools/typespec-autorest": "0.51.0",
70
+ "@azure-tools/typespec-azure-rulesets": "0.51.0",
71
+ "@azure-tools/typespec-client-generator-core": "0.51.0",
71
72
  "@types/js-yaml": "~4.0.9",
72
- "@types/lodash": "~4.17.13",
73
- "@types/mocha": "~10.0.9",
74
- "@types/node": "~22.9.0",
75
- "@typescript-eslint/eslint-plugin": "~8.14.0",
76
- "@typescript-eslint/parser": "~8.14.0",
77
- "@typespec/compiler": "0.62.0",
78
- "@typespec/http": "0.62.0",
79
- "@typespec/openapi": "0.62.0",
80
- "@typespec/rest": "0.62.0",
81
- "@typespec/versioning": "0.62.0",
82
- "@typespec/xml": "0.62.0",
83
- "c8": "~10.1.2",
73
+ "@types/lodash": "~4.17.15",
74
+ "@types/node": "~22.13.1",
75
+ "@typescript-eslint/eslint-plugin": "~8.24.0",
76
+ "@typescript-eslint/parser": "~8.24.0",
77
+ "@typespec/compiler": "0.65.0",
78
+ "@typespec/http": "0.65.0",
79
+ "@typespec/openapi": "0.65.0",
80
+ "@typespec/rest": "0.65.0",
81
+ "@typespec/versioning": "0.65.0",
82
+ "@typespec/xml": "0.65.0",
83
+ "@vitest/coverage-v8": "^3.0.5",
84
+ "@vitest/ui": "^3.0.5",
85
+ "c8": "~10.1.3",
84
86
  "eslint": "~8.57.0",
85
87
  "eslint-plugin-deprecation": "~3.0.0",
86
- "mocha": "~10.8.2",
87
- "prettier": "~3.3.3",
88
+ "prettier": "~3.5.0",
88
89
  "rimraf": "~6.0.1",
89
- "typescript": "~5.6.3"
90
+ "typescript": "~5.7.3",
91
+ "vitest": "^3.0.5",
92
+ "@azure-tools/typespec-liftr-base": "0.7.0"
90
93
  }
91
94
  }
@@ -6,28 +6,29 @@
6
6
  "format": "npm run -s prettier -- --write",
7
7
  "check-format": "npm run prettier -- --check",
8
8
  "prettier": "prettier --config ./.prettierrc.yaml **/*.tsp",
9
- "testserver-run": "npx cadl-ranch serve ./node_modules/@azure-tools/cadl-ranch-specs/http --coverageFile ./cadl-ranch-coverage-java.json"
9
+ "spector-serve": "tsp-spector serve ./node_modules/@typespec/http-specs/specs ./node_modules/@azure-tools/azure-http-specs/specs --coverageFile ./tsp-spector-coverage-java.json"
10
10
  },
11
11
  "dependencies": {
12
- "@azure-tools/cadl-ranch-specs": "0.39.4",
13
- "@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.26.1.tgz"
12
+ "@typespec/http-specs": "0.1.0-alpha.9",
13
+ "@azure-tools/azure-http-specs": "0.1.0-alpha.6",
14
+ "@azure-tools/typespec-java": "file:/../typespec-extension/azure-tools-typespec-java-0.27.4.tgz"
14
15
  },
15
16
  "devDependencies": {
16
- "@typespec/prettier-plugin-typespec": "~0.62.0",
17
+ "@typespec/prettier-plugin-typespec": "~0.65.0",
17
18
  "prettier-plugin-organize-imports": "4.1.0",
18
- "prettier": "~3.3.3"
19
+ "prettier": "~3.5.0"
19
20
  },
20
21
  "overrides": {
21
- "@typespec/compiler": "~0.62.0",
22
- "@typespec/http": "~0.62.0",
23
- "@typespec/rest": "~0.62.0",
24
- "@typespec/versioning": "~0.62.0",
25
- "@typespec/openapi": "~0.62.0",
26
- "@typespec/xml": "~0.62.0",
27
- "@azure-tools/typespec-azure-core": "~0.48.0",
28
- "@azure-tools/typespec-client-generator-core": "~0.48.0",
29
- "@azure-tools/typespec-azure-resource-manager": "~0.48.0",
30
- "@azure-tools/typespec-autorest": "~0.48.0"
22
+ "@typespec/compiler": "~0.65.0",
23
+ "@typespec/http": "~0.65.0",
24
+ "@typespec/rest": "~0.65.0",
25
+ "@typespec/versioning": "~0.65.0",
26
+ "@typespec/openapi": "~0.65.0",
27
+ "@typespec/xml": "~0.65.0",
28
+ "@azure-tools/typespec-azure-core": "~0.51.0",
29
+ "@azure-tools/typespec-client-generator-core": "~0.51.0",
30
+ "@azure-tools/typespec-azure-resource-manager": "~0.51.0",
31
+ "@azure-tools/typespec-autorest": "~0.51.0"
31
32
  },
32
33
  "private": true
33
34
  }