@redocly/cli 2.71.2 → 2.72.1

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.
Files changed (159) hide show
  1. package/README.md +1 -1
  2. package/THIRD_PARTY_NOTICES +29 -7
  3. package/lib/chunks/{EHJ3FMW6.js → 2AW4F6ZZ.js} +1 -1
  4. package/lib/chunks/{3EQNI6CT.js → 2MF3MKAD.js} +1 -1
  5. package/lib/chunks/{UYZXI3NO.js → 2X2KHSF3.js} +1 -1
  6. package/lib/chunks/{YF4FMOTE.js → 3FA5W77S.js} +1 -1
  7. package/lib/chunks/{VPTYPV6P.js → 3FVHXIZN.js} +1 -1
  8. package/lib/chunks/{P5T6BIKW.js → 3N53VPSU.js} +1 -1
  9. package/lib/chunks/{KLGUZBJO.js → 3N73A66H.js} +1 -1
  10. package/lib/chunks/{JO76DPXR.js → 3WOXO2JS.js} +1 -1
  11. package/lib/chunks/{ORWIUECT.js → 4A5R4H5W.js} +1 -1
  12. package/lib/chunks/{NXREEI2S.js → 4LTPQZBP.js} +1 -1
  13. package/lib/chunks/{L325HIGK.js → 4QC7OVHI.js} +1 -1
  14. package/lib/chunks/{FDKY4PGX.js → 542GVIYM.js} +1 -1
  15. package/lib/chunks/5JF6EUWW.js +9 -0
  16. package/lib/chunks/{6X42UQ3O.js → 5MZU5MHZ.js} +1 -1
  17. package/lib/chunks/{DZT5NLUB.js → 5UPBGRBZ.js} +1 -1
  18. package/lib/chunks/{WO6IIVA3.js → 6LZX65VY.js} +8 -8
  19. package/lib/chunks/{NEWT5A6S.js → 6RTITFQA.js} +1 -1
  20. package/lib/chunks/{IQLQH23V.js → 6Y6B2SKE.js} +1 -1
  21. package/lib/chunks/765BYRQR.js +7 -0
  22. package/lib/chunks/{2TG3DP4I.js → 7NZS5HXU.js} +1 -1
  23. package/lib/chunks/{5CR6AOLY.js → A65OW7M7.js} +3 -3
  24. package/lib/chunks/ARUYNQHA.js +7 -0
  25. package/lib/chunks/BJ6Z66KZ.js +7 -0
  26. package/lib/chunks/{T77BOGYV.js → BWGBTYNU.js} +1 -1
  27. package/lib/chunks/{DM4EUYBB.js → BZTZIEWS.js} +2 -2
  28. package/lib/chunks/{4S6LRPCX.js → CBFNHKDJ.js} +1 -1
  29. package/lib/chunks/{OFIQ2EST.js → CYCPHJNX.js} +33 -33
  30. package/lib/chunks/DSBDKSRR.js +53 -0
  31. package/lib/chunks/E2CEKR6N.js +22 -0
  32. package/lib/chunks/{HRZLSSOF.js → EMWHLZB6.js} +1 -1
  33. package/lib/chunks/{DWXDCKZ7.js → ENIFTFYK.js} +1 -1
  34. package/lib/chunks/{BIS2ZFGS.js → ETJMQLWJ.js} +1 -1
  35. package/lib/chunks/{ADACRYTN.js → EU5WR2O3.js} +1 -1
  36. package/lib/chunks/{FAFMGLT6.js → FLQQ3VRQ.js} +1 -1
  37. package/lib/chunks/{BPJTNQBC.js → FZZACVYL.js} +1 -1
  38. package/lib/chunks/{N4GCIKY4.js → G7A4OE2M.js} +1 -1
  39. package/lib/chunks/{HP7UD4BA.js → GCAL2PYM.js} +1 -1
  40. package/lib/chunks/{MJ2NI6MR.js → GGHLD27S.js} +1 -1
  41. package/lib/chunks/{U4MI7HDM.js → GMPHU6KM.js} +1 -1
  42. package/lib/chunks/{HTFKP5HH.js → GWBLS542.js} +1 -1
  43. package/lib/chunks/{U2F3JOT2.js → GXILNSWK.js} +1 -1
  44. package/lib/chunks/{5AVTCY6F.js → HM7M6465.js} +1 -1
  45. package/lib/chunks/{5HPO77VR.js → I2JZXLJ6.js} +2 -2
  46. package/lib/chunks/I3YF3GEY.js +13 -0
  47. package/lib/chunks/{YWRFPTTI.js → IIQW437Z.js} +1 -1
  48. package/lib/chunks/{4H3DPQDW.js → IM4YIUUN.js} +1 -1
  49. package/lib/chunks/{LET2MPMU.js → JDMRVD45.js} +1 -1
  50. package/lib/chunks/{XVS7B4RZ.js → KIFXQTTL.js} +1 -1
  51. package/lib/chunks/{UVKUPD4U.js → L4VSY42B.js} +1 -1
  52. package/lib/chunks/LH3ONQEX.js +17 -0
  53. package/lib/chunks/{SSEMMWPY.js → LUNR7GV4.js} +1 -1
  54. package/lib/chunks/{LY6BDOEF.js → LY5MGNMA.js} +1 -1
  55. package/lib/chunks/{XQEXWC5L.js → MAACTVYP.js} +1 -1
  56. package/lib/chunks/{GFSMOHUE.js → MTKICX4T.js} +1 -1
  57. package/lib/chunks/{ZXOX7NF2.js → NMAWU5S4.js} +1 -1
  58. package/lib/chunks/{I4TK6NG7.js → PJHQKG7X.js} +1 -1
  59. package/lib/chunks/PTBPNZRZ.js +7 -0
  60. package/lib/chunks/{CZX7WE2R.js → PUZ5QSL3.js} +1 -1
  61. package/lib/chunks/{JRVXIEVC.js → PW2XFZOB.js} +1 -1
  62. package/lib/chunks/{TH44RKLO.js → QAT3DPT3.js} +1 -1
  63. package/lib/chunks/{QXXAC25O.js → R67IVFZH.js} +1 -1
  64. package/lib/chunks/RA4FAJM3.js +59 -0
  65. package/lib/chunks/{AZ5LIJEO.js → RF5LL2UZ.js} +1 -1
  66. package/lib/chunks/{JOUEVI3E.js → RQPH22PV.js} +1 -1
  67. package/lib/chunks/S3B562IT.js +7 -0
  68. package/lib/chunks/{3FR3456Q.js → S43EG4DB.js} +1 -1
  69. package/lib/chunks/{CER2D6ZD.js → S7VIXBKD.js} +7 -7
  70. package/lib/chunks/{VJZDR6KS.js → TFPMT2XD.js} +1529 -4
  71. package/lib/chunks/{AXGFQS75.js → U56BQ2BR.js} +2 -2
  72. package/lib/chunks/{KJNBOXDI.js → UOTHMCTM.js} +3 -3
  73. package/lib/chunks/{CR5TYFBN.js → VHZJNDWE.js} +2 -2
  74. package/lib/chunks/{BOTTA3HA.js → VOYPXV3Z.js} +1 -1
  75. package/lib/chunks/{UTEOWLD5.js → VS4MTPCM.js} +1 -1
  76. package/lib/chunks/{QTSECOQB.js → WEPGHS5R.js} +2 -2
  77. package/lib/chunks/{LKNL5LEV.js → WRKMMY3F.js} +1 -1
  78. package/lib/chunks/{7JS7JGWP.js → WTJ3S4D7.js} +1 -1
  79. package/lib/chunks/X22IMAJK.js +199 -0
  80. package/lib/chunks/{W7TN2XCW.js → X3FFOCXC.js} +1 -1
  81. package/lib/chunks/{CRJEY7P3.js → XTI7EXWX.js} +1 -1
  82. package/lib/chunks/{BH4FA7AH.js → YA5KTHFN.js} +1 -1
  83. package/lib/chunks/{Z6GFQV2Y.js → YA6D5EUI.js} +1 -1
  84. package/lib/chunks/{HMYFTLS7.js → ZFET6WME.js} +1 -1
  85. package/lib/chunks/{R32HBYOH.js → ZXB5O6JQ.js} +1 -1
  86. package/lib/eject-assets/AGENTS.md +1 -1
  87. package/lib/eject-assets/generators/cli/docs.ts +1 -1
  88. package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
  89. package/lib/eject-assets/generators/cli/index.ts +2 -2
  90. package/lib/eject-assets/generators/cli/render.ts +1 -1
  91. package/lib/eject-assets/generators/go/client.ts +1 -1
  92. package/lib/eject-assets/generators/go/descriptor.ts +1 -1
  93. package/lib/eject-assets/generators/go/index.ts +2 -2
  94. package/lib/eject-assets/generators/go/models.ts +1 -1
  95. package/lib/eject-assets/generators/go/naming.ts +1 -1
  96. package/lib/eject-assets/generators/go/operations.ts +1 -1
  97. package/lib/eject-assets/generators/go/pagination.ts +1 -1
  98. package/lib/eject-assets/generators/go/types.ts +1 -1
  99. package/lib/eject-assets/generators/java/client.ts +66 -0
  100. package/lib/eject-assets/generators/java/descriptor.ts +72 -0
  101. package/lib/eject-assets/generators/java/index.ts +245 -0
  102. package/lib/eject-assets/generators/java/models.ts +362 -0
  103. package/lib/eject-assets/generators/java/naming.ts +135 -0
  104. package/lib/eject-assets/generators/java/operations.ts +300 -0
  105. package/lib/eject-assets/generators/java/pagination.ts +94 -0
  106. package/lib/eject-assets/generators/java/types.ts +103 -0
  107. package/lib/eject-assets/generators/mock/faker.ts +1 -1
  108. package/lib/eject-assets/generators/mock/index.ts +2 -2
  109. package/lib/eject-assets/generators/mock/render.ts +1 -1
  110. package/lib/eject-assets/generators/mock/sample.ts +1 -1
  111. package/lib/eject-assets/generators/mock/values.ts +1 -1
  112. package/lib/eject-assets/generators/php/client.ts +1 -1
  113. package/lib/eject-assets/generators/php/descriptor.ts +1 -1
  114. package/lib/eject-assets/generators/php/index.ts +2 -2
  115. package/lib/eject-assets/generators/php/models.ts +1 -1
  116. package/lib/eject-assets/generators/php/naming.ts +1 -1
  117. package/lib/eject-assets/generators/php/operations.ts +1 -1
  118. package/lib/eject-assets/generators/php/pagination.ts +1 -1
  119. package/lib/eject-assets/generators/php/types.ts +1 -1
  120. package/lib/eject-assets/generators/python/client.ts +1 -1
  121. package/lib/eject-assets/generators/python/descriptor.ts +1 -1
  122. package/lib/eject-assets/generators/python/index.ts +2 -2
  123. package/lib/eject-assets/generators/python/models.ts +1 -1
  124. package/lib/eject-assets/generators/python/naming.ts +1 -1
  125. package/lib/eject-assets/generators/python/operations.ts +1 -1
  126. package/lib/eject-assets/generators/python/pagination.ts +1 -1
  127. package/lib/eject-assets/generators/python/types.ts +1 -1
  128. package/lib/eject-assets/generators/swr/index.ts +2 -2
  129. package/lib/eject-assets/generators/swr/render.ts +1 -1
  130. package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
  131. package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
  132. package/lib/eject-assets/generators/transformers/index.ts +2 -2
  133. package/lib/eject-assets/generators/transformers/render.ts +1 -1
  134. package/lib/eject-assets/generators/typescript/banner.ts +1 -1
  135. package/lib/eject-assets/generators/typescript/client.ts +1 -1
  136. package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
  137. package/lib/eject-assets/generators/typescript/index.ts +2 -2
  138. package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
  139. package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
  140. package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
  141. package/lib/eject-assets/generators/typescript/operations.ts +1 -1
  142. package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
  143. package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
  144. package/lib/eject-assets/generators/typescript/types.ts +1 -1
  145. package/lib/eject-assets/generators/zod/index.ts +2 -2
  146. package/lib/eject-assets/generators/zod/schemas.ts +1 -1
  147. package/lib/eject-assets/skills/client-generators/SKILL.md +1 -1
  148. package/lib/eject-assets/skills/java-generator/SKILL.md +161 -0
  149. package/lib/index.js +91 -90
  150. package/lib/skills/redocly-cli/SKILL.md +3 -1
  151. package/package.json +1 -1
  152. package/lib/chunks/2ZEKFWJQ.js +0 -13
  153. package/lib/chunks/3VOQMXIZ.js +0 -7
  154. package/lib/chunks/7GADNOVY.js +0 -9
  155. package/lib/chunks/FRQHCFKP.js +0 -199
  156. package/lib/chunks/J2EPFEBO.js +0 -17
  157. package/lib/chunks/JZATGVUO.js +0 -53
  158. package/lib/chunks/KNMNSDHR.js +0 -7
  159. package/lib/chunks/U5DIFWGH.js +0 -7
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "python" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "python" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator python --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "swr" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "swr" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator swr --update`.
@@ -33,5 +33,5 @@ export default {
33
33
  run: swrGenerator,
34
34
  requires: ["typescript"],
35
35
  errorModes: ["throw"],
36
- requiresGenerator: '^0.7.13',
36
+ requiresGenerator: '^0.8.1',
37
37
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "swr" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "swr" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator swr --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "tanstack-query" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "tanstack-query" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator tanstack-query --update`.
@@ -44,5 +44,5 @@ export default {
44
44
  run: tanstackQueryGenerator('react'),
45
45
  requires: ["typescript"],
46
46
  errorModes: ["throw"],
47
- requiresGenerator: '^0.7.13',
47
+ requiresGenerator: '^0.8.1',
48
48
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "tanstack-query" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "tanstack-query" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator tanstack-query --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "transformers" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "transformers" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator transformers --update`.
@@ -42,5 +42,5 @@ export default {
42
42
  run: transformersGenerator,
43
43
  requires: ["typescript"],
44
44
  dateTypes: ["Date"],
45
- requiresGenerator: '^0.7.13',
45
+ requiresGenerator: '^0.8.1',
46
46
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "transformers" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "transformers" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator transformers --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -123,5 +123,5 @@ export default {
123
123
  run: typescriptGenerator,
124
124
  sample: typescriptSample,
125
125
  docs: typescriptDocs,
126
- requiresGenerator: '^0.7.13',
126
+ requiresGenerator: '^0.8.1',
127
127
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "typescript" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "typescript" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator typescript --update`.
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "zod" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "zod" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator zod --update`.
@@ -28,5 +28,5 @@ export const zodGenerator: Generator = ({ model, output, banner }) => {
28
28
  export default {
29
29
  name: 'zod',
30
30
  run: zodGenerator,
31
- requiresGenerator: '^0.7.13',
31
+ requiresGenerator: '^0.8.1',
32
32
  };
@@ -1,4 +1,4 @@
1
- // Ejected from @redocly/client-generator@0.7.13 — the built-in "zod" generator.
1
+ // Ejected from @redocly/client-generator@0.8.1 — the built-in "zod" generator.
2
2
  // This file is yours: edit freely; the generated client stays machine-owned and is
3
3
  // rebuilt by `redocly generate-client`. Newer generator versions merge in with
4
4
  // `redocly eject-generator zod --update`.
@@ -111,7 +111,7 @@ discriminated union on `kind`: `scalar`, `array`, `object`, `record`, `ref`,
111
111
  | `isNullable(schema)` / `unwrapNullable(schema)` | Detect and strip `null` union members (`Optional[T]`, pointers, `Option<T>`). |
112
112
  | `enumValues(schema)` | Values plus SCREAMING_SNAKE member-name suggestions. |
113
113
  | `headerCoerceType(schema, model)` | Response-header coerce hint (`integer`/`number`/`boolean`/`string`) through refs, nullables, and allOf wrappers. |
114
- | `casing` / `identifierFor(name, { style, reserved })` | camel/pascal/snake/screaming; keyword-safe identifiers (`RESERVED_WORDS.python/go/typescript` shipped). |
114
+ | `casing` / `identifierFor(name, { style, reserved })` | camel/pascal/snake/screaming; keyword-safe identifiers (`RESERVED_WORDS.python/go/php/java/typescript` shipped). |
115
115
  | `uniqueIdentifiers(names, { style, reserved, taken })` | The same, made unique among themselves and among names you already took — for a signature that takes one argument per parameter. |
116
116
  | `Printer` | Indentation-aware text builder — no manual whitespace bookkeeping. |
117
117
  | `docText(description)` | Description as trimmed lines for any comment syntax. |
@@ -0,0 +1,161 @@
1
+ ---
2
+ name: java-generator
3
+ description: Design of the ejected Redocly `java` client generator. Read it, and update it, before changing generators/java/.
4
+ ---
5
+
6
+ # The `java` generator — its skill
7
+
8
+ This file is the DESIGN of your ejected `java` generator (`generators/java/`):
9
+ **to change the generator, edit this skill first, then make the code match it** — a diff
10
+ to `generators/java/` that has no covering sentence here is incomplete.
11
+
12
+ ## What it emits
13
+
14
+ One self-contained `<Stem>.java`: a `public final class` named after the output stem in
15
+ PascalCase (`client.ts` → `Client.java`, `openapi.client.ts` → `OpenapiClient.java`),
16
+ because Java puts one public class per file and names the file after it. The class nests
17
+ the model records, the enums, the union interfaces, the embedded runtime, and one typed
18
+ method per operation. Java ≥ 17 (records, sealed interfaces, `instanceof` patterns), HTTP
19
+ over `java.net.http.HttpClient`, JSON over the runtime's own reader/writer — zero
20
+ dependencies. The package derives from the API title the way the PHP namespace does:
21
+ lowercase words run together (`Cafe Orders API` → `package cafeordersapi;`), because a
22
+ class in the default package cannot be imported from any named package. A title that
23
+ cannot be a package as is follows Oracle's package-naming convention — a keyword, or `java`,
24
+ which the JVM keeps for the JDK, gets a trailing underscore (`java_`, `class_`); a leading
25
+ digit gets a leading underscore (`_3dprintingapi`); a title with no usable letters becomes
26
+ `api` — and the run warns with the package it used, since the reader cannot see it in the
27
+ title. The generator takes no options; a different package is a change to
28
+ `javaPackageName` in an ejected copy.
29
+
30
+ ## Design decisions that must hold
31
+
32
+ - **JSON is hand-written in the runtime.** Java has no standard JSON library, and a
33
+ dependency on one would break the zero-dependency story the other SDKs keep. `Json.parse`
34
+ reads into a plain graph — `Map<String, Object>` (insertion ordered), `List<Object>`,
35
+ `String`, `Long` for integral numbers, `Double` for the rest, `Boolean`, `null` — and
36
+ `Json.write` serializes that graph plus the generated types: a `JsonValue` by its
37
+ `toJson()`, a `WireValue` by its wire literal, a date by its ISO-8601 text. No streaming
38
+ parse: a body is read whole, then parsed.
39
+ - **Models are records** implementing the runtime's `JsonValue`. Every component is a
40
+ reference type (`Long`, not `long`), so an optional or nullable value is simply `null`
41
+ and a response that omits a required field hydrates instead of crashing. Hydration is
42
+ compile-time generated per record — `static X fromJson(Object json)` reads each wire name
43
+ through the runtime's null-tolerant readers (`asString`, `asLong`, `asList(…, item ->
44
+ …)`, `Order.fromJson`, `Status.fromWire`, `parsePet`), and `toJson()` returns a
45
+ `Map<String, Object>` of the components (nulls skipped for optionals) that `Json.write`
46
+ serializes recursively. No reflection. `omit` schemas hydrate through their base record.
47
+ - **A `writeOnly` property is optional** even when required: requests and responses share
48
+ one record, and a response never carries it.
49
+ - **Enums** are Java enums implementing `WireValue`: members in SCREAMING_SNAKE (the
50
+ toolkit's `enumValues` names, unique per enum) carrying the wire literal — a `String` or
51
+ a `Long` — with `wire()` and `fromWire(…)`, which returns `null` for `null` and throws
52
+ `IllegalArgumentException` for an unknown value. Only string and integer enums get a type;
53
+ other scalars stay their wire type.
54
+ - **Discriminated unions** whose mapping targets are all records become a `sealed
55
+ interface X extends JsonValue` that each member record `implements`, so a consumer narrows
56
+ with `instanceof` patterns; `parseX(Object json)` dispatches on the discriminator and
57
+ throws `IllegalArgumentException` for an unknown value, since a sealed type has no raw
58
+ member. `permits` is implied: the members sit in the same compilation unit. A union with a
59
+ target that has no record of its own is typed `Object`, and its `parseX` returns the raw
60
+ map for an unknown value. Undiscriminated unions, inline objects, and intersections that
61
+ do not flatten are `Object`. **allOf** is flattened.
62
+ - **Types:** `String`/`Long`/`Double`/`Boolean`, `List<T>`, `Map<String, T>`, record and
63
+ enum names, `Object` for everything untyped. Under `dateType: Date`, `date-time` is
64
+ `OffsetDateTime` and `date` is `LocalDate`; hydration goes through `asOffsetDateTime` /
65
+ `asLocalDate`, and the writer formats a date-time with `ISO_OFFSET_DATE_TIME` so the
66
+ seconds never drop out (`OffsetDateTime.toString()` omits them when zero).
67
+ - **Reserved type names get a `Model` suffix.** Everything nests in one class, so a schema
68
+ named like a runtime type (`Config`, `Envelope`) or a JDK type the runtime references
69
+ (`Thread`, `List`) would shadow it: `naming.ts` reads those names off the runtime source
70
+ and renames the schema (`ConfigModel`). A schema named like the enclosing class itself
71
+ cannot nest in it at all, and an enclosing class named like a runtime type (an `--output`
72
+ of `config.ts`) would make that name mean the class, so both runs fail with the fix
73
+ (another `--output` name).
74
+ - **Naming:** types PascalCase, components and methods camelCase via
75
+ `identifierFor(..., RESERVED_WORDS.java)`; a reserved word gets a trailing underscore
76
+ (`class_`), `+1`/`-1` become `plus1`/`minus1`, and a digit-leading name gets `_`. Method
77
+ names are unique across the client (`getUser`, `getUser2`), never one of `Object`'s
78
+ methods (`getClass` becomes `getClass2`), and each name books its `WithHeaders`, `Pages`,
79
+ and `Items` variants, so a later operation named like one of them moves aside too.
80
+ - **Hand-built comments go through `printer.doc`**, never a raw `/** … */` line: a server
81
+ description or a discriminator value may carry `*/` or `\u`, which end or break a Java
82
+ comment. `printer.doc` writes `*/` as `*&#47;` and every backslash as `\u005c`, the escape
83
+ of a backslash, which javac turns back into one without starting another escape — so the
84
+ Javadoc reads exactly as the description does.
85
+ - **Every path parameter is its own argument, so their names share one namespace** with
86
+ the locals the method declares itself (`body`, `params`, `op`, `query`, `url`, …). Build
87
+ them with `uniqueIdentifiers(..., { taken: … })`: a parameter named `body` becomes
88
+ `body2`, and the wire name is untouched. Query parameters travel in a `<Op>Params` class
89
+ — one nullable public field per parameter with a fluent setter of the same name
90
+ (`new ListOrdersParams().limit(50L)`) — because Java has no named arguments; `null` for
91
+ the whole class sends none. An array parameter repeats the key per element.
92
+ - **Method shape:** path parameters first, the body next (`Object` for an untyped
93
+ multipart or a binary operation), then `<Op>Params` when the operation has query
94
+ parameters. A JSON success returns its type, a non-JSON success (PDF, image, octet
95
+ stream) returns `byte[]`, a bodiless success is `void`, and an SSE operation returns
96
+ `Iterable<ServerSentEvent>`.
97
+ - **The operation literal is built where it is used** — `Operation op = new Operation(id,
98
+ method, path, security, pagination)` at the top of each method — never a static table of
99
+ every operation: a single static initializer of a large description (GitHub: ~1000
100
+ operations) exceeds the JVM's 64 KB method size.
101
+ - **Errors:** unchecked exceptions ARE the error mode. `ApiException` (status, url, decoded
102
+ body) for a non-2xx response, `ApiTimeoutException` when an attempt exceeds the configured
103
+ timeout, `UncheckedIOException` for a transport failure; `errorMode` does not change the
104
+ output (the generator declares `errorModes: ['throw']`, so `result` fails fast).
105
+ - **Config** is a fluent class: `serverUrl`, `httpClient` (an HTTP/1.1 client by default —
106
+ the JDK default's h2c upgrade attempt confuses servers that do not speak HTTP/2),
107
+ `header(name, value)` for every request (a `Content-Type` here wins over the description's,
108
+ matched case-insensitively, so the header is never sent twice), `timeout` per attempt,
109
+ `retry` (`Retry`: `retries` extra attempts, default 0; `delay`; `strategy` fixed or
110
+ exponential; `noJitter`; `retryOn` replacing the default predicate), `middleware`
111
+ (`onRequest(HttpRequest.Builder)` before each attempt, `onResponse` in reverse order),
112
+ `idempotencyKey` supplier for POST/PATCH, and `auth` (`Auth`: `bearer`, `basic`, `apiKey`
113
+ per scheme, each a value or a `Supplier` resolved per request).
114
+ - **Response headers:** an operation that DECLARES success-response headers gains a
115
+ `<op>WithHeaders()` variant returning `Envelope<T>` (`data`, `headers` — coerced to
116
+ `Long`/`Double`/`Boolean`/`String` under camelCase keys, absent or unparsable values
117
+ omitted — and `status`); a bodiless operation returns `Envelope<Void>`. Operations without
118
+ declared headers get no variant.
119
+ - **Pagination:** a paginated operation gains `<op>Pages()` and `<op>Items()`, both
120
+ `Iterable<T>` over the runtime's `iterPages`, hydrated per page or item through
121
+ `mapIterable` / `flattenItems`. Each `iterator()` starts a fresh request sequence.
122
+ - **Servers:** when the description declares servers, a `Servers` class is emitted with one
123
+ static method per server; server VARIABLES become `String` arguments, and the
124
+ description's defaults live in the method's doc comment (Java has no default arguments).
125
+ The client's baked default stays `servers[0]` with variable defaults substituted.
126
+ - **Stream bodies pass through.** For an untyped `multipart/form-data` operation or a
127
+ binary operation the body is `Object` and the runtime sorts it out (`multipartBody` /
128
+ `binaryBody`): an `InputStream` is sent chunked, in exactly one attempt, whatever the
129
+ retry policy says, because a consumed stream cannot be replayed; a `byte[]` or `String` is
130
+ sent raw and keeps the retry policy; a map or a record of an untyped multipart operation
131
+ is encoded with `toMultipart`; any other value of a binary operation is JSON-encoded. The
132
+ caller's `Content-Type` (a `Config` header) wins over the description's or the multipart
133
+ boundary's.
134
+ - **Parity surface:** auth OR-alternatives, retries with `Retry-After` + full-jitter
135
+ backoff, per-attempt timeouts, idempotency keys, middleware, pagination, SSE (`iterSse`
136
+ with `Last-Event-ID` reconnect and the server's `retry` hint; auth resolves inside the
137
+ opener, so each reconnect asks a token supplier again), multipart, and the
138
+ `X-Redocly-Client` header.
139
+ - **The runtime is hand-written in `runtime/Runtime.java`** in this folder, an `abstract
140
+ class Runtime` that compiles on its own (`javac --release 17 -Xlint:all -Werror`) and is
141
+ embedded at prepare time. Inline, the generator copies its class body into the generated
142
+ class; under `--runtime module` it writes the same source as `<Stem>Runtime.java`, a
143
+ `public abstract class` the client `extends`, so every runtime name resolves unqualified
144
+ in both modes and the two cannot drift. Package-private members stay reachable because
145
+ both classes share one package.
146
+ - Authored ONLY with the neutral toolkit — the dogfooding guard fails otherwise.
147
+ - **It documents itself.** With `client.docs` (or `--docs`), the `docs` hook writes
148
+ `<stem>.java.md`: the security schemes, then one section per operation with its parameters,
149
+ body, response type, and behavior notes. The call snippets come from this generator's own
150
+ `sample` hook, so the page can only show the syntax of the SDK beside it, and the layout
151
+ comes from `renderReferencePage` in the authoring toolkit — reachable from an ejected copy
152
+ through `@redocly/client-generator`.
153
+
154
+ ## The modify loop
155
+
156
+ 1. Edit this skill: state the new behavior or decision.
157
+ 2. Make `generators/java/` match it.
158
+ 3. Run `redocly generate-client` and inspect the `git diff` of the generated output —
159
+ generated files are never hand-edited.
160
+
161
+ Newer built-in versions merge in with `redocly eject-generator java --update`.