@aws/nx-plugin 1.0.0-rc.32 → 1.0.0-rc.34

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 (277) hide show
  1. package/LICENSE-THIRD-PARTY +75 -86
  2. package/generators.json +27 -0
  3. package/package.json +10 -10
  4. package/src/connection/generator.js +12 -1
  5. package/src/connection/generator.js.map +1 -1
  6. package/src/connection/supported-connections.d.ts +10 -1
  7. package/src/connection/supported-connections.js +13 -0
  8. package/src/connection/supported-connections.js.map +1 -1
  9. package/src/infra/app/__snapshots__/generator.spec.ts.snap +21 -21
  10. package/src/infra/app/files/app/src/main.ts.template +1 -1
  11. package/src/infra/app/files/app/src/stages/application-stage.ts.template +1 -1
  12. package/src/infra/app/generator.js +3 -1
  13. package/src/infra/app/generator.js.map +1 -1
  14. package/src/open-api/ts-client/__snapshots__/generator.complex-types.spec.ts.snap +12 -12
  15. package/src/open-api/ts-client/__snapshots__/generator.composite-types.spec.ts.snap +74 -10
  16. package/src/open-api/ts-client/__snapshots__/generator.content-type.spec.ts.snap +22 -4
  17. package/src/open-api/ts-client/__snapshots__/generator.duplicate-types.spec.ts.snap +53 -8
  18. package/src/open-api/ts-client/__snapshots__/generator.edge-cases.spec.ts.snap +32 -4
  19. package/src/open-api/ts-client/__snapshots__/generator.fast-api-gaps.spec.ts.snap +736 -0
  20. package/src/open-api/ts-client/__snapshots__/generator.fast-api.spec.ts.snap +86 -11
  21. package/src/open-api/ts-client/__snapshots__/generator.multipart.spec.ts.snap +21 -3
  22. package/src/open-api/ts-client/__snapshots__/generator.primitive-types.spec.ts.snap +2 -2
  23. package/src/open-api/ts-client/__snapshots__/generator.request.spec.ts.snap +6 -6
  24. package/src/open-api/ts-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +2 -2
  25. package/src/open-api/ts-client/__snapshots__/generator.spec-compliance.spec.ts.snap +1883 -0
  26. package/src/open-api/ts-client/__snapshots__/generator.tags.spec.ts.snap +4 -4
  27. package/src/open-api/ts-client/files/client.gen.ts.template +196 -13
  28. package/src/open-api/ts-client/files/types.gen.ts.template +2 -0
  29. package/src/open-api/ts-client/generator.js +27 -2
  30. package/src/open-api/ts-client/generator.js.map +1 -1
  31. package/src/open-api/ts-hooks/files/options-proxy.gen.ts.template +2 -2
  32. package/src/open-api/ts-hooks/generator.js +5 -1
  33. package/src/open-api/ts-hooks/generator.js.map +1 -1
  34. package/src/open-api/utils/codegen-data/languages.js +6 -0
  35. package/src/open-api/utils/codegen-data/languages.js.map +1 -1
  36. package/src/open-api/utils/codegen-data/types.d.ts +16 -1
  37. package/src/open-api/utils/codegen-data/types.js.map +1 -1
  38. package/src/open-api/utils/codegen-data.js +71 -0
  39. package/src/open-api/utils/codegen-data.js.map +1 -1
  40. package/src/open-api/utils/normalise.js +53 -8
  41. package/src/open-api/utils/normalise.js.map +1 -1
  42. package/src/open-api/utils/parser.js +48 -15
  43. package/src/open-api/utils/parser.js.map +1 -1
  44. package/src/preset/__snapshots__/generator.spec.ts.snap +5 -3
  45. package/src/preset/generator.d.ts +1 -1
  46. package/src/preset/generator.js +5 -2
  47. package/src/preset/generator.js.map +1 -1
  48. package/src/preset/schema.d.js.map +1 -1
  49. package/src/preset/schema.d.ts +2 -0
  50. package/src/preset/schema.json +6 -0
  51. package/src/py/agent/__snapshots__/generator.constructs.spec.ts.snap +7 -7
  52. package/src/py/agent/__snapshots__/generator.frameworks.spec.ts.snap +8 -8
  53. package/src/py/agent/__snapshots__/generator.protocols.spec.ts.snap +89 -3
  54. package/src/py/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  55. package/src/py/fast-api/__snapshots__/generator.terraform.spec.ts.snap +12 -12
  56. package/src/py/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  57. package/src/py/mcp-server/__snapshots__/generator.spec.ts.snap +91 -5
  58. package/src/py/rdb/__snapshots__/generator.spec.ts.snap +2038 -0
  59. package/src/py/rdb/agent-connection/__snapshots__/generator.spec.ts.snap +104 -0
  60. package/src/py/rdb/agent-connection/generator.d.ts +10 -0
  61. package/src/py/rdb/agent-connection/generator.js +46 -0
  62. package/src/py/rdb/agent-connection/generator.js.map +1 -0
  63. package/src/py/rdb/agent-connection/schema.d.js +8 -0
  64. package/src/py/rdb/agent-connection/schema.d.js.map +1 -0
  65. package/src/py/rdb/agent-connection/schema.d.ts +15 -0
  66. package/src/py/rdb/agent-connection/schema.json +27 -0
  67. package/src/py/rdb/fast-api-connection/__snapshots__/generator.spec.ts.snap +44 -0
  68. package/src/py/rdb/fast-api-connection/files/__apiModuleName__/dependencies/__rdbNameSnake__.py.template +14 -0
  69. package/src/py/rdb/fast-api-connection/generator.d.ts +10 -0
  70. package/src/py/rdb/fast-api-connection/generator.js +54 -0
  71. package/src/py/rdb/fast-api-connection/generator.js.map +1 -0
  72. package/src/py/rdb/fast-api-connection/schema.d.js +8 -0
  73. package/src/py/rdb/fast-api-connection/schema.d.js.map +1 -0
  74. package/src/py/rdb/fast-api-connection/schema.d.ts +13 -0
  75. package/src/py/rdb/fast-api-connection/schema.json +23 -0
  76. package/src/py/rdb/files/Dockerfile.create-db-user.template +10 -0
  77. package/src/py/rdb/files/Dockerfile.migration.template +10 -0
  78. package/src/py/rdb/files/__name__/__init__.py.template +3 -0
  79. package/src/py/rdb/files/__name__/connection.py.template +55 -0
  80. package/src/py/rdb/files/__name__/create_db_user_handler.py.template +97 -0
  81. package/src/py/rdb/files/__name__/migration_handler.py.template +36 -0
  82. package/src/py/rdb/files/__name__/models/__init__.py.template +3 -0
  83. package/src/py/rdb/files/__name__/models/example.py.template +8 -0
  84. package/src/py/rdb/files/__name__/utils.py.template +104 -0
  85. package/src/py/rdb/files/alembic.ini.template +38 -0
  86. package/src/py/rdb/files/config.json.template +14 -0
  87. package/src/py/rdb/files/migrations/env.py.template +80 -0
  88. package/src/py/rdb/files/migrations/script.py.mako.template +28 -0
  89. package/src/py/rdb/generator.d.ts +6 -0
  90. package/src/py/rdb/generator.js +263 -0
  91. package/src/py/rdb/generator.js.map +1 -0
  92. package/src/py/rdb/mcp-server-connection/__snapshots__/generator.spec.ts.snap +101 -0
  93. package/src/py/rdb/mcp-server-connection/generator.d.ts +10 -0
  94. package/src/py/rdb/mcp-server-connection/generator.js +46 -0
  95. package/src/py/rdb/mcp-server-connection/generator.js.map +1 -0
  96. package/src/py/rdb/mcp-server-connection/schema.d.js +8 -0
  97. package/src/py/rdb/mcp-server-connection/schema.d.js.map +1 -0
  98. package/src/py/rdb/mcp-server-connection/schema.d.ts +15 -0
  99. package/src/py/rdb/mcp-server-connection/schema.json +27 -0
  100. package/src/py/rdb/schema.d.js +6 -0
  101. package/src/py/rdb/schema.d.js.map +1 -0
  102. package/src/py/rdb/schema.d.ts +16 -0
  103. package/src/py/rdb/schema.json +77 -0
  104. package/src/py/rdb/utils.d.ts +6 -0
  105. package/src/py/rdb/utils.js +16 -0
  106. package/src/py/rdb/utils.js.map +1 -0
  107. package/src/sdk/py.d.ts +2 -0
  108. package/src/sdk/py.js +1 -0
  109. package/src/sdk/py.js.map +1 -1
  110. package/src/smithy/ts/api/__snapshots__/generator.spec.ts.snap +7 -7
  111. package/src/smithy/ts/api/files/handler.ts.template +2 -2
  112. package/src/smithy/ts/api/files/local-server.ts.template +2 -2
  113. package/src/smithy/ts/api/files/operations/echo.ts.template +2 -2
  114. package/src/smithy/ts/api/files/service.ts.template +3 -3
  115. package/src/smithy/ts/api/generator.js +3 -1
  116. package/src/smithy/ts/api/generator.js.map +1 -1
  117. package/src/trpc/backend/__snapshots__/generator.spec.ts.snap +12 -12
  118. package/src/trpc/backend/files/src/client/index.ts.template +1 -1
  119. package/src/trpc/backend/files/src/handler.ts.template +1 -1
  120. package/src/trpc/backend/files/src/index.ts.template +5 -5
  121. package/src/trpc/backend/files/src/init.ts.template +1 -1
  122. package/src/trpc/backend/files/src/local-server.ts.template +1 -1
  123. package/src/trpc/backend/files/src/middleware/index.ts.template +7 -7
  124. package/src/trpc/backend/files/src/procedures/echo.ts.template +2 -2
  125. package/src/trpc/backend/files/src/router.ts.template +2 -2
  126. package/src/trpc/backend/files/src/schema/index.ts.template +1 -1
  127. package/src/trpc/backend/generator.js +3 -1
  128. package/src/trpc/backend/generator.js.map +1 -1
  129. package/src/ts/agent/__snapshots__/generator.spec.ts.snap +89 -3
  130. package/src/ts/agent/a2a-connection/files/agent-connection/app/__targetAgentKebabCase__-client-strands.ts.template +2 -2
  131. package/src/ts/agent/a2a-connection/generator.js +3 -1
  132. package/src/ts/agent/a2a-connection/generator.js.map +1 -1
  133. package/src/ts/agent/files/a2a/index.ts.template +1 -1
  134. package/src/ts/agent/files/ag-ui/index.ts.template +1 -1
  135. package/src/ts/agent/files/http/client.ts.template +2 -2
  136. package/src/ts/agent/files/http/index.ts.template +2 -2
  137. package/src/ts/agent/files/http/router.ts.template +3 -3
  138. package/src/ts/agent/gateway-connection/files/agent-connection/app/__gatewayKebabCase__-client-strands.ts.template +2 -2
  139. package/src/ts/agent/gateway-connection/generator.js +3 -1
  140. package/src/ts/agent/gateway-connection/generator.js.map +1 -1
  141. package/src/ts/agent/generator.js +5 -2
  142. package/src/ts/agent/generator.js.map +1 -1
  143. package/src/ts/agent/mcp-connection/files/agent-connection/app/__mcpServerKebabCase__-client-strands.ts.template +2 -2
  144. package/src/ts/agent/mcp-connection/generator.js +3 -1
  145. package/src/ts/agent/mcp-connection/generator.js.map +1 -1
  146. package/src/ts/astro-docs/files/translation/scripts/translate.ts.template +3 -2
  147. package/src/ts/astro-docs/generator.js +2 -0
  148. package/src/ts/astro-docs/generator.js.map +1 -1
  149. package/src/ts/dynamodb/__snapshots__/generator.spec.ts.snap +2 -2
  150. package/src/ts/dynamodb/files/src/client.ts.template +5 -2
  151. package/src/ts/dynamodb/files/src/entities/example.ts.template +1 -1
  152. package/src/ts/dynamodb/files/src/entities/index.ts.template +1 -1
  153. package/src/ts/dynamodb/files/src/index.ts.template +2 -2
  154. package/src/ts/dynamodb/generator.js +3 -1
  155. package/src/ts/dynamodb/generator.js.map +1 -1
  156. package/src/ts/lambda-function/__snapshots__/generator.spec.ts.snap +2 -2
  157. package/src/ts/lib/generator.js +7 -1
  158. package/src/ts/lib/generator.js.map +1 -1
  159. package/src/ts/lib/ts-project-utils.js +19 -4
  160. package/src/ts/lib/ts-project-utils.js.map +1 -1
  161. package/src/ts/lib/types.d.ts +6 -0
  162. package/src/ts/lib/types.js.map +1 -1
  163. package/src/ts/mcp-server/__snapshots__/generator.spec.ts.snap +94 -8
  164. package/src/ts/mcp-server/generator.js +3 -2
  165. package/src/ts/mcp-server/generator.js.map +1 -1
  166. package/src/ts/nx-generator/files/local/generator.ts.template +2 -2
  167. package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.ts.template +2 -2
  168. package/src/ts/nx-generator/generator.js +5 -2
  169. package/src/ts/nx-generator/generator.js.map +1 -1
  170. package/src/ts/nx-plugin/files/mcp-server/server.ts.template +5 -5
  171. package/src/ts/nx-plugin/files/mcp-server/tools/create-workspace-command.ts.template +2 -2
  172. package/src/ts/nx-plugin/files/mcp-server/tools/general-guidance.ts.template +1 -1
  173. package/src/ts/nx-plugin/files/mcp-server/tools/generator-guide.ts.template +2 -2
  174. package/src/ts/nx-plugin/files/mcp-server/tools/list-generators.ts.template +2 -2
  175. package/src/ts/nx-plugin/files/mcp-server/utils.ts.template +3 -3
  176. package/src/ts/nx-plugin/generator.js +3 -1
  177. package/src/ts/nx-plugin/generator.js.map +1 -1
  178. package/src/ts/nx-plugin/utils.js +7 -4
  179. package/src/ts/nx-plugin/utils.js.map +1 -1
  180. package/src/ts/rdb/__snapshots__/generator.spec.ts.snap +149 -177
  181. package/src/ts/rdb/files/src/create-db-user-handler.ts.template +2 -2
  182. package/src/ts/rdb/files/src/index.ts.template +1 -1
  183. package/src/ts/rdb/files/src/migration-handler.ts.template +1 -1
  184. package/src/ts/rdb/files/src/prisma.ts.template +7 -4
  185. package/src/ts/rdb/generator.js +7 -4
  186. package/src/ts/rdb/generator.js.map +1 -1
  187. package/src/ts/rdb/schema.json +1 -1
  188. package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +45 -45
  189. package/src/ts/react-website/cognito-auth/__snapshots__/generator.terraform.spec.ts.snap +2 -2
  190. package/src/utils/agent-chat/agent-chat.js +3 -1
  191. package/src/utils/agent-chat/agent-chat.js.map +1 -1
  192. package/src/utils/agent-chat/files/a2a/chat.ts.template +1 -1
  193. package/src/utils/agent-chat/files/ag-ui/chat.ts.template +1 -1
  194. package/src/utils/agent-chat/files/http-py/chat.ts.template +2 -2
  195. package/src/utils/agent-chat/files/http-ts/chat.ts.template +1 -1
  196. package/src/utils/agent-connection/agent-connection.js +4 -1
  197. package/src/utils/agent-connection/agent-connection.js.map +1 -1
  198. package/src/utils/agent-connection/files/core-a2a/agentcore-a2a-client-config.ts.template +2 -2
  199. package/src/utils/agent-connection/files/core-auth/agentcore-fetch.ts.template +1 -1
  200. package/src/utils/agent-connection/files/core-gateway/agentcore-gateway-mcp-transport.ts.template +2 -2
  201. package/src/utils/agent-connection/files/core-mcp/agentcore-mcp-transport.ts.template +2 -2
  202. package/src/utils/agent-connection/files/core-shared/agentcore-transport.ts.template +1 -1
  203. package/src/utils/agent-connection/files/core-strands/a2a/agentcore-a2a-client-strands.ts.template +1 -1
  204. package/src/utils/agent-connection/files/core-strands/base/with-session-id-strands.ts.template +1 -1
  205. package/src/utils/agent-connection/files/core-strands/gateway/agentcore-gateway-mcp-client-strands.ts.template +1 -1
  206. package/src/utils/agent-connection/files/core-strands/mcp/agentcore-mcp-client-strands.ts.template +1 -1
  207. package/src/utils/agent-core-constructs/agent-core-constructs.js +10 -3
  208. package/src/utils/agent-core-constructs/agent-core-constructs.js.map +1 -1
  209. package/src/utils/agent-core-constructs/files/cdk/app/agent-core/__nameKebabCase__/__nameKebabCase__.ts.template +3 -3
  210. package/src/utils/agent-core-constructs/files/cdk/app/agentcore-gateway/__nameKebabCase__/__nameKebabCase__.ts.template +4 -4
  211. package/src/utils/agent-core-constructs/files/cdk/core/agentcore-gateway/agentcore-gateway.ts.template +1 -1
  212. package/src/utils/agent-core-constructs/files/terraform/app/agent-core/__nameKebabCase__/__nameKebabCase__.tf.template +27 -0
  213. package/src/utils/agent-core-constructs/files/terraform/core/agent-core/runtime.tf.template +60 -1
  214. package/src/utils/api-constructs/api-constructs.js +8 -2
  215. package/src/utils/api-constructs/api-constructs.js.map +1 -1
  216. package/src/utils/api-constructs/files/cdk/app/apis/http/__apiNameKebabCase__.ts.template +8 -8
  217. package/src/utils/api-constructs/files/cdk/app/apis/rest/__apiNameKebabCase__.ts.template +8 -8
  218. package/src/utils/api-constructs/files/cdk/core/api/http/http-api.ts.template +3 -3
  219. package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account/index.js.template +32 -20
  220. package/src/utils/api-constructs/files/cdk/core/api/rest/api-gateway-account.ts.template +1 -1
  221. package/src/utils/api-constructs/files/cdk/core/api/rest/rest-api.ts.template +4 -4
  222. package/src/utils/api-constructs/files/cdk/core/api/trpc/trpc-utils.ts.template +1 -1
  223. package/src/utils/ast.js +16 -0
  224. package/src/utils/ast.js.map +1 -1
  225. package/src/utils/commands.d.ts +1 -1
  226. package/src/utils/commands.js +4 -1
  227. package/src/utils/commands.js.map +1 -1
  228. package/src/utils/dynamodb-constructs/dynamodb-constructs.js +9 -2
  229. package/src/utils/dynamodb-constructs/dynamodb-constructs.js.map +1 -1
  230. package/src/utils/dynamodb-constructs/files/cdk/app/dynamodb/__nameKebabCase__.ts.template +3 -3
  231. package/src/utils/dynamodb-constructs/files/cdk/core/dynamodb.ts.template +1 -1
  232. package/src/utils/files/common/constructs/src/core/index.ts.template +4 -4
  233. package/src/utils/files/common/constructs/src/index.ts.template +2 -2
  234. package/src/utils/files/common/infra-config/src/index.ts.template +3 -3
  235. package/src/utils/files/common/infra-config/src/resolve-stage.ts.template +2 -2
  236. package/src/utils/files/common/infra-config/src/stages.config.ts.template +1 -1
  237. package/src/utils/files/common/scripts/src/infra/infra-deploy.ts.template +1 -1
  238. package/src/utils/files/common/scripts/src/infra/infra-destroy.ts.template +1 -1
  239. package/src/utils/files/common/scripts/src/infra/stage-credentials/run.ts.template +3 -3
  240. package/src/utils/files/common/shadcn/src/index.ts.template +2 -2
  241. package/src/utils/function-constructs/files/cdk/app/lambda-functions/__nameKebabCase__.ts.template +1 -1
  242. package/src/utils/function-constructs/function-constructs.js +3 -1
  243. package/src/utils/function-constructs/function-constructs.js.map +1 -1
  244. package/src/utils/identity-constructs/files/cdk/core/user-identity.ts.template +2 -2
  245. package/src/utils/identity-constructs/identity-constructs.js +5 -1
  246. package/src/utils/identity-constructs/identity-constructs.js.map +1 -1
  247. package/src/utils/module-format.d.ts +28 -0
  248. package/src/utils/module-format.js +28 -0
  249. package/src/utils/module-format.js.map +1 -0
  250. package/src/utils/rdb-constructs/files/cdk/app/dbs/__nameKebabCase__.ts.template +61 -17
  251. package/src/utils/rdb-constructs/files/cdk/core/rdb/aurora.ts.template +68 -78
  252. package/src/utils/rdb-constructs/files/terraform/app/dbs/__nameKebabCase__/__nameKebabCase__.tf.template +88 -8
  253. package/src/utils/rdb-constructs/files/terraform/core/rdb/aurora/aurora.tf.template +5 -32
  254. package/src/utils/rdb-constructs/rdb-constructs.d.ts +11 -1
  255. package/src/utils/rdb-constructs/rdb-constructs.js +9 -2
  256. package/src/utils/rdb-constructs/rdb-constructs.js.map +1 -1
  257. package/src/utils/shared-constructs.js +12 -22
  258. package/src/utils/shared-constructs.js.map +1 -1
  259. package/src/utils/shared-infra-config.js +3 -1
  260. package/src/utils/shared-infra-config.js.map +1 -1
  261. package/src/utils/shared-infra-scripts.js +3 -1
  262. package/src/utils/shared-infra-scripts.js.map +1 -1
  263. package/src/utils/shared-rdb-scripts.js +5 -1
  264. package/src/utils/shared-rdb-scripts.js.map +1 -1
  265. package/src/utils/shared-shadcn.js +3 -1
  266. package/src/utils/shared-shadcn.js.map +1 -1
  267. package/src/utils/test.d.ts +2 -0
  268. package/src/utils/test.js +7 -1
  269. package/src/utils/test.js.map +1 -1
  270. package/src/utils/versions.d.ts +73 -69
  271. package/src/utils/versions.js +71 -67
  272. package/src/utils/versions.js.map +1 -1
  273. package/src/utils/website-constructs/files/cdk/app/static-websites/__websiteNameKebabCase__.ts.template +2 -2
  274. package/src/utils/website-constructs/files/cdk/core/static-website.ts.template +2 -2
  275. package/src/utils/website-constructs/website-constructs.js +9 -2
  276. package/src/utils/website-constructs/website-constructs.js.map +1 -1
  277. package/src/utils/files/terraform/scripts/reset-runtime-config.ts.template +0 -25
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data/languages.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { camelCase, snakeCase, toClassName } from '../../../utils/names';\nimport { type Model, PRIMITIVE_TYPES } from './types';\n\nconst toTypescriptPrimitive = (property: Model): string => {\n if (\n property.type === 'string' &&\n ['date', 'date-time'].includes(property.format ?? '')\n ) {\n return 'Date';\n } else if (property.type === 'binary') {\n return 'Blob';\n }\n return property.type;\n};\n\nexport const toTypeScriptType = (property: Model): string => {\n // A discriminated subtype's discriminator property renders as its literal\n // tag, making the union a true (narrowable) tagged union.\n if (property.discriminatorValue) {\n return property.discriminatorValue;\n }\n const link = property.link;\n // Enum links serialise as their primitive; use the model's own type instead.\n const valueType = () =>\n link && link.export !== 'enum' ? toTypeScriptType(link) : property.type;\n switch (property.export) {\n case 'enum':\n case 'generic':\n return toTypescriptPrimitive(property);\n case 'array':\n return `Array<${valueType()}>`;\n case 'dictionary':\n return `{ [key: string]: ${valueType()}; }`;\n case 'one-of':\n case 'any-of':\n case 'all-of':\n return toTypeScriptModelName(property.name);\n case 'reference':\n default:\n if (property.type === 'unknown') {\n return 'unknown';\n }\n if (PRIMITIVE_TYPES.has(property.type)) {\n return toTypescriptPrimitive(property);\n }\n return toTypeScriptModelName(property.type);\n }\n};\n\nexport const toTypeScriptName = (name: string): string => {\n // A name of only non-identifier characters (e.g. \"_\") camelCases to an empty\n // string; fall back to an underscore so the emitted property stays valid.\n return camelCase(name) || (name ?? '').replace(/[^a-zA-Z0-9]/g, '_') || '_';\n};\n\nconst TYPESCRIPT_RESERVED_MODEL_NAMES = new Set([\n 'Date',\n 'Blob',\n 'Object',\n 'String',\n 'Boolean',\n 'Integer',\n 'Long',\n 'Float',\n 'Array',\n 'ReadonlyArray',\n 'File',\n 'Error',\n 'Map',\n 'Set',\n 'Number',\n 'Symbol',\n 'BigInt',\n 'Function',\n 'Promise',\n 'RegExp',\n 'JSON',\n]);\n\nexport const toTypeScriptModelName = (name: string): string => {\n const candidateName = toClassName(name);\n\n // Prepend underscore for any reserved model names\n return TYPESCRIPT_RESERVED_MODEL_NAMES.has(candidateName)\n ? `_${candidateName}`\n : candidateName;\n};\n\nconst toPythonPrimitive = (property: Model): string => {\n if (property.type === 'string' && property.format === 'date') {\n return 'date';\n } else if (property.type === 'string' && property.format === 'date-time') {\n return 'datetime';\n } else if (property.type === 'any') {\n return 'object';\n } else if (property.type === 'binary') {\n return 'bytearray';\n } else if (property.type === 'number') {\n if (property.openapiType === 'integer') {\n return 'int';\n }\n\n switch (property.format) {\n case 'int32':\n case 'int64':\n return 'int';\n case 'float':\n case 'double':\n default:\n return 'float';\n }\n } else if (property.type === 'boolean') {\n return 'bool';\n } else if (property.type === 'string') {\n return 'str';\n }\n return property.type;\n};\n\nexport const toPythonType = (property: Model): string => {\n const link = property.link;\n const valueType = () =>\n link && link.export !== 'enum' ? toPythonType(link) : property.type;\n switch (property.export) {\n case 'generic':\n case 'reference':\n return toPythonPrimitive(property);\n case 'array':\n return `List[${valueType()}]`;\n case 'dictionary':\n return `Dict[str, ${valueType()}]`;\n case 'one-of':\n case 'any-of':\n case 'all-of':\n return property.name;\n default:\n // \"any\" has export = interface\n if (PRIMITIVE_TYPES.has(property.type)) {\n return toPythonPrimitive(property);\n }\n return property.type;\n }\n};\n\n// @see https://github.com/OpenAPITools/openapi-generator/blob/e2a62ace74de361bef6338b7fa37da8577242aef/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java#L106\nconst PYTHON_KEYWORDS = new Set([\n // @property\n 'property',\n // typing keywords\n 'schema',\n 'base64',\n 'json',\n 'date',\n 'float',\n // python reserved words\n 'and',\n 'del',\n 'from',\n 'not',\n 'while',\n 'as',\n 'elif',\n 'global',\n 'or',\n 'with',\n 'assert',\n 'else',\n 'if',\n 'pass',\n 'yield',\n 'break',\n 'except',\n 'import',\n 'print',\n 'class',\n 'exec',\n 'in',\n 'raise',\n 'continue',\n 'finally',\n 'is',\n 'return',\n 'def',\n 'for',\n 'lambda',\n 'try',\n 'self',\n 'nonlocal',\n 'None',\n 'True',\n 'False',\n 'async',\n 'await',\n]);\n\nexport const toPythonName = (\n namedEntity: 'model' | 'property' | 'operation',\n name: string,\n) => {\n const nameSnakeCase = snakeCase(name);\n\n // Names overlapping a TypeScript reserved word carry a leading `_`; strip it\n // before testing against the Python keyword set.\n if (PYTHON_KEYWORDS.has(name.startsWith('_') ? name.slice(1) : name)) {\n const nameSuffix = `_${nameSnakeCase}`;\n switch (namedEntity) {\n case 'model':\n return `model${nameSuffix}`;\n case 'operation':\n return `call${nameSuffix}`;\n case 'property':\n return `var${nameSuffix}`;\n default:\n break;\n }\n }\n return nameSnakeCase;\n};\n"],"names":["camelCase","snakeCase","toClassName","PRIMITIVE_TYPES","toTypescriptPrimitive","property","type","includes","format","toTypeScriptType","discriminatorValue","link","valueType","export","toTypeScriptModelName","name","has","toTypeScriptName","replace","TYPESCRIPT_RESERVED_MODEL_NAMES","Set","candidateName","toPythonPrimitive","openapiType","toPythonType","PYTHON_KEYWORDS","toPythonName","namedEntity","nameSnakeCase","startsWith","slice","nameSuffix"],"mappings":"AAAA;;;CAGC,GAED,SAASA,SAAS,EAAEC,SAAS,EAAEC,WAAW,QAAQ,0BAAuB;AACzE,SAAqBC,eAAe,QAAQ,aAAU;AAEtD,MAAMC,wBA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I;QACtB;YACE,+BAA+B;YAC/B,IAAIZ,gBAAgBa,GAAG,CAACX,SAASC,IAAI,GAAG;gBACtC,OAAOgB,kBAAkBjB;YAC3B;YACA,OAAOA,SAASC,IAAI;IACxB;AACF,EAAE;AAEF,kNAAkN;AAClN,MAAMmB,kBAAkB,IAAIL,IAAI;IAC9B,YAAY;IACZ;IACA,kBAAkB;IAClB;IACA;IACA;IACA;IACA;IACA,wBAAwB;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,OAAO,MAAMM,eAAe,CAC1BC,aACAZ;IAEA,MAAMa,gBAAgB3B,UAAUc;IAEhC,6EAA6E;IAC7E,iDAAiD;IACjD,IAAIU,gBAAgBT,GAAG,CAACD,KAAKc,UAAU,CAAC,OAAOd,KAAKe,KAAK,CAAC,KAAKf,OAAO;QACpE,MAAMgB,aAAa,CAAC,CAAC,EAAEH,eAAe;QACtC,OAAQD;YACN,KAAK;gBACH,OAAO,CAAC,KAAK,EAAEI,YAAY;YAC7B,KAAK;gBACH,OAAO,CAAC,IAAI,EAAEA,YAAY;YAC5B,KAAK;gBACH,OAAO,CAAC,GAAG,EAAEA,YAAY;YAC3B;gBACE;QACJ;IACF;IACA,OAAOH;AACT,EAAE"}
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data/languages.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { camelCase, snakeCase, toClassName } from '../../../utils/names';\nimport { type Model, PRIMITIVE_TYPES } from './types';\n\nconst toTypescriptPrimitive = (property: Model): string => {\n if (\n property.type === 'string' &&\n ['date', 'date-time'].includes(property.format ?? '')\n ) {\n return 'Date';\n } else if (property.type === 'binary') {\n return 'Blob';\n }\n return property.type;\n};\n\n// A nullable tuple member renders as a union with null.\nconst memberType = (rendered: string, member: Model): string =>\n member.isNullable && member.type !== 'null' ? `${rendered} | null` : rendered;\n\nexport const toTypeScriptType = (property: Model): string => {\n // A discriminated subtype's discriminator property renders as its literal\n // tag, making the union a true (narrowable) tagged union.\n if (property.discriminatorValue) {\n return property.discriminatorValue;\n }\n const link = property.link;\n // Enum links serialise as their primitive; use the model's own type instead.\n const valueType = () =>\n link && link.export !== 'enum' ? toTypeScriptType(link) : property.type;\n switch (property.export) {\n case 'enum':\n case 'generic':\n return toTypescriptPrimitive(property);\n case 'array':\n return `Array<${valueType()}>`;\n case 'tuple':\n return `[${property.properties\n .map((member) => memberType(toTypeScriptType(member), member))\n .join(', ')}]`;\n case 'dictionary':\n return `{ [key: string]: ${valueType()}; }`;\n case 'one-of':\n case 'any-of':\n case 'all-of':\n return toTypeScriptModelName(property.name);\n case 'reference':\n default:\n if (property.type === 'unknown') {\n return 'unknown';\n }\n if (PRIMITIVE_TYPES.has(property.type)) {\n return toTypescriptPrimitive(property);\n }\n return toTypeScriptModelName(property.type);\n }\n};\n\nexport const toTypeScriptName = (name: string): string => {\n // A name of only non-identifier characters (e.g. \"_\") camelCases to an empty\n // string; fall back to an underscore so the emitted property stays valid.\n return camelCase(name) || (name ?? '').replace(/[^a-zA-Z0-9]/g, '_') || '_';\n};\n\nconst TYPESCRIPT_RESERVED_MODEL_NAMES = new Set([\n 'Date',\n 'Blob',\n 'Object',\n 'String',\n 'Boolean',\n 'Integer',\n 'Long',\n 'Float',\n 'Array',\n 'ReadonlyArray',\n 'File',\n 'Error',\n 'Map',\n 'Set',\n 'Number',\n 'Symbol',\n 'BigInt',\n 'Function',\n 'Promise',\n 'RegExp',\n 'JSON',\n]);\n\nexport const toTypeScriptModelName = (name: string): string => {\n const candidateName = toClassName(name);\n\n // Prepend underscore for any reserved model names\n return TYPESCRIPT_RESERVED_MODEL_NAMES.has(candidateName)\n ? `_${candidateName}`\n : candidateName;\n};\n\nconst toPythonPrimitive = (property: Model): string => {\n if (property.type === 'string' && property.format === 'date') {\n return 'date';\n } else if (property.type === 'string' && property.format === 'date-time') {\n return 'datetime';\n } else if (property.type === 'any') {\n return 'object';\n } else if (property.type === 'binary') {\n return 'bytearray';\n } else if (property.type === 'number') {\n if (property.openapiType === 'integer') {\n return 'int';\n }\n\n switch (property.format) {\n case 'int32':\n case 'int64':\n return 'int';\n case 'float':\n case 'double':\n default:\n return 'float';\n }\n } else if (property.type === 'boolean') {\n return 'bool';\n } else if (property.type === 'string') {\n return 'str';\n }\n return property.type;\n};\n\nexport const toPythonType = (property: Model): string => {\n const link = property.link;\n const valueType = () =>\n link && link.export !== 'enum' ? toPythonType(link) : property.type;\n switch (property.export) {\n case 'generic':\n case 'reference':\n return toPythonPrimitive(property);\n case 'array':\n return `List[${valueType()}]`;\n case 'tuple':\n return `Tuple[${property.properties\n .map((member) => toPythonType(member))\n .join(', ')}]`;\n case 'dictionary':\n return `Dict[str, ${valueType()}]`;\n case 'one-of':\n case 'any-of':\n case 'all-of':\n return property.name;\n default:\n // \"any\" has export = interface\n if (PRIMITIVE_TYPES.has(property.type)) {\n return toPythonPrimitive(property);\n }\n return property.type;\n }\n};\n\n// @see https://github.com/OpenAPITools/openapi-generator/blob/e2a62ace74de361bef6338b7fa37da8577242aef/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java#L106\nconst PYTHON_KEYWORDS = new Set([\n // @property\n 'property',\n // typing keywords\n 'schema',\n 'base64',\n 'json',\n 'date',\n 'float',\n // python reserved words\n 'and',\n 'del',\n 'from',\n 'not',\n 'while',\n 'as',\n 'elif',\n 'global',\n 'or',\n 'with',\n 'assert',\n 'else',\n 'if',\n 'pass',\n 'yield',\n 'break',\n 'except',\n 'import',\n 'print',\n 'class',\n 'exec',\n 'in',\n 'raise',\n 'continue',\n 'finally',\n 'is',\n 'return',\n 'def',\n 'for',\n 'lambda',\n 'try',\n 'self',\n 'nonlocal',\n 'None',\n 'True',\n 'False',\n 'async',\n 'await',\n]);\n\nexport const toPythonName = (\n namedEntity: 'model' | 'property' | 'operation',\n name: string,\n) => {\n const nameSnakeCase = snakeCase(name);\n\n // Names overlapping a TypeScript reserved word carry a leading `_`; strip it\n // before testing against the Python keyword set.\n if (PYTHON_KEYWORDS.has(name.startsWith('_') ? name.slice(1) : name)) {\n const nameSuffix = `_${nameSnakeCase}`;\n switch (namedEntity) {\n case 'model':\n return `model${nameSuffix}`;\n case 'operation':\n return `call${nameSuffix}`;\n case 'property':\n return `var${nameSuffix}`;\n default:\n break;\n }\n }\n return nameSnakeCase;\n};\n"],"names":["camelCase","snakeCase","toClassName","PRIMITIVE_TYPES","toTypescriptPrimitive","property","type","includes","format","memberType","rendered","member","isNullable","toTypeScriptType","discriminatorValue","link","valueType","export","properties","map","join","toTypeScriptModelName","name","has","toTypeScriptName","replace","TYPESCRIPT_RESERVED_MODEL_NAMES","Set","candidateName","toPythonPrimitive","openapiType","toPythonType","PYTHON_KEYWORDS","toPythonName","namedEntity","nameSnakeCase","startsWith","slice","nameSuffix"],"mappings":"AAAA;;;CAGC,GAED,SAASA,SAAS,EAAEC,SAAS,EAAEC,WAAW,QAAQ,0BAAuB;AACzE,SAAqBC,eAAe,QAAQ,aAAU;AAEtD,MAAMC,wBAAwB,CAACC;IAC7B,IACEA,SAASC,IAAI,KAAK,YAClB;QAAC;QAAQ;KAAY,CAACC,QAAQ,CAACF,SAASG,MAAM,IAAI,KAClD;QACA,OAAO;IACT,OAAO,IAAIH,SAASC,IAAI,KAAK,UAAU;QACrC,OAAO;IACT;IACA,OAAOD,SAASC,IAAI;AACtB;AAEA,wDAAwD;AACxD,MAAMG,aAAa,CAACC,UAAkBC,SACpCA,OAAOC,UAAU,IAAID,OAAOL,IAAI,KAAK,SAAS,GAAGI,SAAS,OAAO,CAAC,GAAGA;AAEvE,OAAO,MAAMG,mBAAmB,CAACR;IAC/B,0EAA0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L,KAAK;QACL,KAAK;YACH,OAAOX,SAASiB,IAAI;QACtB;YACE,+BAA+B;YAC/B,IAAInB,gBAAgBoB,GAAG,CAAClB,SAASC,IAAI,GAAG;gBACtC,OAAOuB,kBAAkBxB;YAC3B;YACA,OAAOA,SAASC,IAAI;IACxB;AACF,EAAE;AAEF,kNAAkN;AAClN,MAAM0B,kBAAkB,IAAIL,IAAI;IAC9B,YAAY;IACZ;IACA,kBAAkB;IAClB;IACA;IACA;IACA;IACA;IACA,wBAAwB;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,OAAO,MAAMM,eAAe,CAC1BC,aACAZ;IAEA,MAAMa,gBAAgBlC,UAAUqB;IAEhC,6EAA6E;IAC7E,iDAAiD;IACjD,IAAIU,gBAAgBT,GAAG,CAACD,KAAKc,UAAU,CAAC,OAAOd,KAAKe,KAAK,CAAC,KAAKf,OAAO;QACpE,MAAMgB,aAAa,CAAC,CAAC,EAAEH,eAAe;QACtC,OAAQD;YACN,KAAK;gBACH,OAAO,CAAC,KAAK,EAAEI,YAAY;YAC7B,KAAK;gBACH,OAAO,CAAC,IAAI,EAAEA,YAAY;YAC5B,KAAK;gBACH,OAAO,CAAC,GAAG,EAAEA,YAAY;YAC3B;gBACE;QACJ;IACF;IACA,OAAOH;AACT,EAAE"}
@@ -9,12 +9,14 @@ import type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
9
9
  * - `interface` — an object type with named properties
10
10
  * - `enum` — a set of string/number literal values
11
11
  * - `array` — a list whose element type is described by `link`
12
+ * - `tuple` — a fixed-length array (`prefixItems`) whose element types are the
13
+ * `properties`, in order
12
14
  * - `dictionary` — a map whose value type is described by `link`
13
15
  * - `reference` — a reference to another named model (`type` is its name)
14
16
  * - `generic` — a primitive (string/number/boolean/null/void/binary/any)
15
17
  * - `one-of` / `any-of` / `all-of` — a composite of other schemas
16
18
  */
17
- export type ModelExport = 'interface' | 'enum' | 'array' | 'dictionary' | 'reference' | 'generic' | 'one-of' | 'any-of' | 'all-of';
19
+ export type ModelExport = 'interface' | 'enum' | 'array' | 'tuple' | 'dictionary' | 'reference' | 'generic' | 'one-of' | 'any-of' | 'all-of';
18
20
  /**
19
21
  * Where a parameter-like {@link Model} appears in a request/response.
20
22
  * Empty string is used for models that are not parameters (schemas/properties).
@@ -112,6 +114,13 @@ export interface Model {
112
114
  prop?: string;
113
115
  /** The chosen request/response media type, for body params and responses. */
114
116
  mediaType?: string | null;
117
+ /**
118
+ * Per-part content types declared by the request body `encoding` object
119
+ * (multipart bodies), keyed by property name.
120
+ */
121
+ partContentTypes?: {
122
+ [prop: string]: string;
123
+ };
115
124
  /** All acceptable media types (request body / response). */
116
125
  mediaTypes?: string[];
117
126
  /** The response status code, for response models. */
@@ -162,6 +171,12 @@ export interface Model {
162
171
  itemSchemaModel?: Model;
163
172
  /** Collection serialisation format for array query/header parameters. */
164
173
  collectionFormat?: CollectionFormat;
174
+ /** Path parameter serialization style, when not the default `simple`. */
175
+ pathStyle?: 'matrix' | 'label';
176
+ /** Path parameter explode flag (used with `pathStyle`). */
177
+ pathExplode?: boolean;
178
+ /** Query parameter `allowReserved`: reserved characters are not encoded. */
179
+ allowReserved?: boolean;
165
180
  }
166
181
  /** Vendor extension bag (`x-*` keys copied from a schema/operation/spec). */
167
182
  export type VendorExtensions = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data/types.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\n/**\n * The kind of a {@link Model}, describing how it should be rendered.\n *\n * - `interface` — an object type with named properties\n * - `enum` — a set of string/number literal values\n * - `array` — a list whose element type is described by `link`\n * - `dictionary` — a map whose value type is described by `link`\n * - `reference` — a reference to another named model (`type` is its name)\n * - `generic` — a primitive (string/number/boolean/null/void/binary/any)\n * - `one-of` / `any-of` / `all-of` — a composite of other schemas\n */\nexport type ModelExport =\n | 'interface'\n | 'enum'\n | 'array'\n | 'dictionary'\n | 'reference'\n | 'generic'\n | 'one-of'\n | 'any-of'\n | 'all-of';\n\n/**\n * Where a parameter-like {@link Model} appears in a request/response.\n * Empty string is used for models that are not parameters (schemas/properties).\n */\nexport type ModelIn =\n | ''\n | 'query'\n | 'path'\n | 'header'\n | 'cookie'\n | 'body'\n | 'response';\n\n/**\n * How array/object query & header parameters are serialised on the wire.\n * `deepObject` explodes an object into `key[prop]=value` query pairs.\n */\nexport type CollectionFormat = 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';\n\n/** A single enum member value. */\nexport interface EnumMember {\n value: string | number | boolean;\n}\n\n/**\n * A discriminated-composite mapping entry: a discriminator value and the name\n * of the composed model it selects.\n */\nexport interface DiscriminatorMapping {\n /** The discriminator property value (e.g. `\"cat\"`). */\n value: string;\n /** The name of the composed model this value selects (e.g. `\"Cat\"`). */\n modelName: string;\n}\n\n/**\n * The discriminator of a composite (`oneOf`/`anyOf`) or an inheritance base\n * (an `object` schema whose subtypes `allOf`-compose it), used to marshal\n * directly to the matching branch/subtype rather than merging every branch or\n * dropping subtype-only fields.\n */\nexport interface Discriminator {\n /** The wire property name carrying the discriminator value. */\n propertyName: string;\n /** The TypeScript property name (resolved during augmentation). */\n typescriptPropertyName?: string;\n /** The value → composed-model mapping. */\n mapping: DiscriminatorMapping[];\n /**\n * True when this discriminator sits on an inheritance base (an `object`\n * schema selected by `allOf`-composing subtypes) rather than a `oneOf`/\n * `anyOf` composite. The base marshals via dispatch to its subtypes, but its\n * subtypes compose the base's own (non-dispatching) body — so the base emits\n * a separate non-dispatching marshaller to break the recursion.\n */\n isBase?: boolean;\n}\n\n/** A pattern-property entry: a regex pattern and the model for its values. */\nexport interface PatternPropertyModel {\n pattern: string;\n model: Model;\n}\n\n/**\n * A model represents an OpenAPI schema, or something derived from one (a\n * property, parameter, or response). It is produced by the parser\n * (`../parser.ts`) and progressively augmented by `../codegen-data.ts` with\n * language-specific and code-generation fields before being handed to the\n * templates. Augmentation fields are optional as they are absent on raw parser\n * output.\n */\nexport interface Model {\n /** The schema, property, or parameter name. */\n name: string;\n /** How this model should be rendered. */\n export: ModelExport;\n /**\n * The model's type: a primitive name (`string`, `number`, `boolean`, `null`,\n * `void`, `binary`, `any`), `unknown`, or the name of a referenced model.\n */\n type: string;\n /** The OpenAPI `format` (e.g. `int32`, `date-time`, `binary`), if any. */\n format?: string;\n /** Description, used to render doc comments. */\n description: string | null;\n /** Whether the schema is marked deprecated. */\n deprecated: boolean;\n /** Whether the value may be null. */\n isNullable: boolean;\n /** Whether the property is read-only. */\n isReadOnly: boolean;\n /** Whether the property/parameter is required. */\n isRequired: boolean;\n /** Whether an array enforces uniqueness (rendered as a `Set`). */\n uniqueItems?: boolean;\n /** For arrays/dictionaries, the model describing the element/value type. */\n link?: Model | null;\n /** Child properties (for interfaces) or members (for composites). */\n properties: Model[];\n /** Enum members, when `export === 'enum'`. */\n enum: EnumMember[];\n /** Names of other models this model references (for import generation). */\n imports: string[];\n\n /** Where a parameter appears; `''` for non-parameter models. */\n in: ModelIn;\n /** The source property name for a parameter (body parameters use `body`). */\n prop?: string;\n /** The chosen request/response media type, for body params and responses. */\n mediaType?: string | null;\n /** All acceptable media types (request body / response). */\n mediaTypes?: string[];\n /** The response status code, for response models. */\n code?: number | string;\n\n /**\n * For a discriminated subtype's discriminator property: the rendered literal\n * TypeScript type (e.g. `'cat'`, or `'cat' | 'kitten'` when several values\n * map to one subtype) that makes the union a true tagged union. Absent when\n * the subtype's tag can't be pinned to a literal (e.g. it appears in\n * multiple unions with different values).\n */\n discriminatorValue?: string;\n\n /** The raw OpenAPI `type` (used to distinguish integer from number). */\n openapiType?: string | string[];\n /** Vendor extensions (`x-*`) copied from the schema. */\n vendorExtensions?: VendorExtensions;\n /** True when the schema has additionalProperties. */\n hasAdditionalProperties?: boolean;\n /** The model describing additionalProperties values. */\n additionalPropertiesModel?: Model;\n /** True when the schema has patternProperties. */\n hasPatternProperties?: boolean;\n /** The models describing each pattern's values. */\n patternPropertiesModels?: PatternPropertyModel[];\n\n /** For composites: the referenced (object) models composed together. */\n composedModels?: Model[];\n /** For composites: the primitive/enum/array members composed together. */\n composedPrimitives?: Model[];\n /** For discriminated one-of/any-of composites: the discriminator metadata. */\n discriminator?: Discriminator;\n\n /** The TypeScript identifier for this model/property. */\n typescriptName?: string;\n /** The rendered TypeScript type. */\n typescriptType?: string;\n /** The Python identifier for this model/property. */\n pythonName?: string;\n /** The rendered Python type. */\n pythonType?: string;\n /** snake_case model name (Python). */\n nameSnakeCase?: string;\n /** True when the model is a renderable primitive (not composite/collection). */\n isPrimitive?: boolean;\n /** True when the schema declares an enum. */\n isEnum?: boolean;\n\n /** True for JSON-lines streaming responses. */\n isJsonlStreaming?: boolean;\n /** The model describing each streamed item. */\n itemSchemaModel?: Model;\n\n /** Collection serialisation format for array query/header parameters. */\n collectionFormat?: CollectionFormat;\n}\n\n/** Vendor extension bag (`x-*` keys copied from a schema/operation/spec). */\nexport type VendorExtensions = { [key: string]: unknown };\n\n/**\n * An operation represents a single OpenAPI path + method. Produced by the\n * parser and augmented by `../codegen-data.ts`.\n */\nexport interface Operation {\n id: string;\n name: string;\n method: string;\n path: string;\n description: string | null;\n tags?: string[] | null;\n deprecated: boolean;\n imports: string[];\n parameters: Model[];\n /** The request body parameter (same object reference as in `parameters`). */\n parametersBody?: Model | null;\n responses: Model[];\n\n /** Deduplicated operation name used throughout generated code. */\n uniqueName?: string;\n /** Dot-notation name (tag-qualified), used for metadata keys. */\n dotNotationName?: string;\n operationIdPascalCase?: string;\n operationIdSnakeCase?: string;\n /** The generated request type name (e.g. `FooRequest`). */\n requestTypeName?: string;\n\n /** The response model used as the operation's result. */\n result?: Model;\n\n /** The explicit body parameter when the body is not inlined. */\n explicitRequestBodyParameter?: Model;\n\n vendorExtensions?: VendorExtensions;\n isMutation?: boolean;\n isQuery?: boolean;\n isStreaming?: boolean;\n isInfiniteQuery?: boolean;\n /** The cursor parameter, for infinite queries. */\n infiniteQueryCursorProperty?: Model;\n}\n\n/**\n * A service groups operations. Currently the parser produces a single\n * `Default` service; operations are re-grouped by tag downstream.\n */\nexport interface Service {\n name: string;\n operations: Operation[];\n imports: string[];\n\n /** All model names the service (API client) needs to import. */\n modelImports?: string[];\n className?: string;\n nameSnakeCase?: string;\n}\n\n/**\n * The initial data structure produced by the OpenAPI parser.\n */\nexport interface ClientData {\n models: Model[];\n services: Service[];\n}\n\n/** Models indexed by name, for reference resolution during augmentation. */\nexport type ModelsByName = { [name: string]: Model };\n\n/** Index a list of models by name. */\nexport const indexModelsByName = (models: Model[]): ModelsByName =>\n Object.fromEntries(models.map((m) => [m.name, m]));\n\n/** The single service the parser emits; operations are re-grouped by tag. */\nexport const DEFAULT_SERVICE_NAME = 'Default';\n\n/**\n * The full data structure handed to the code generation templates.\n */\nexport interface CodeGenData extends ClientData {\n className: string;\n info: OpenAPIV3.InfoObject | OpenAPIV3_1.InfoObject;\n allOperations: Operation[];\n operationsByTag: { [tag: string]: Operation[] };\n untaggedOperations: Operation[];\n vendorExtensions: VendorExtensions;\n}\n\n/**\n * Create a {@link Model} with the default fields the parser always emits.\n * Callers override the fields relevant to their specific schema.\n */\nexport const createModel = (overrides: Partial<Model> = {}): Model => ({\n name: '',\n export: 'interface',\n type: 'unknown',\n description: null,\n deprecated: false,\n isNullable: false,\n isReadOnly: false,\n isRequired: false,\n link: null,\n properties: [],\n enum: [],\n imports: [],\n in: '',\n ...overrides,\n});\n\n// Model types which indicate it is composed (ie inherits/mixin's another schema)\nexport const COMPOSED_SCHEMA_TYPES = new Set<ModelExport>([\n 'one-of',\n 'any-of',\n 'all-of',\n]);\nexport const COLLECTION_TYPES = new Set<ModelExport>(['array', 'dictionary']);\nexport const PRIMITIVE_TYPES = new Set([\n 'string',\n 'integer',\n 'number',\n 'boolean',\n 'null',\n 'any',\n 'binary',\n 'void',\n]);\n\n/**\n * Content types that indicate JSON Lines streaming (OpenAPI 3.2)\n */\nexport const STREAMING_CONTENT_TYPES = new Set([\n 'application/jsonl',\n 'application/x-ndjson',\n]);\n\n/**\n * Vendor extensions which are used to customise generated code\n */\nexport const VENDOR_EXTENSIONS = {\n /**\n * Set to 'true' to indicate this is a streaming API\n */\n STREAMING: 'x-streaming',\n /**\n * Set to true to indicate this is a mutation, regardless of its HTTP method\n */\n MUTATION: 'x-mutation',\n /**\n * Set to true to indicate this is a query, regardless of its HTTP method\n */\n QUERY: 'x-query',\n /**\n * Set to the name of the input property used as the cursor for pagination if\n * the API accepts a cursor that is not named 'cursor'.\n * This can also be set to false to override behaviour and indicate this is not\n * a paginated API.\n * Used for tanstack infinite query hooks.\n */\n CURSOR: 'x-cursor',\n} as const;\n"],"names":["indexModelsByName","models","Object","fromEntries","map","m","name","DEFAULT_SERVICE_NAME","createModel","overrides","export","type","description","deprecated","isNullable","isReadOnly","isRequired","link","properties","enum","imports","in","COMPOSED_SCHEMA_TYPES","Set","COLLECTION_TYPES","PRIMITIVE_TYPES","STREAMING_CONTENT_TYPES","VENDOR_EXTENSIONS","STREAMING","MUTATION","QUERY","CURSOR"],"mappings":"AAAA;;;CAGC,GAyQD,oCAAoC,GACpC,OAAO,MAAMA,oBAAoB,CAACC,SAChCC,OAAOC,WAAW,CAACF,OAAOG,GAAG,CAAC,CAACC,IAAM;YAACA,EAAEC,IAAI;YAAED;SAAE,GAAG;AAErD,2EAA2E,GAC3E,OAAO,MAAME,uBAAuB,UAAU;AAc9C;;;CAGC,GACD,OAAO,MAAMC,cAAc,CAACC,YAA4B,CAAC,CAAC,GAAa,CAAA;QACrEH,MAAM;QACNI,QAAQ;QACRC,MAAM;QACNC,aAAa;QACbC,YAAY;QACZC,YAAY;QACZC,YAAY;QACZC,YAAY;QACZC,MAAM;QACNC,YAAY,EAAE;QACdC,MAAM,EAAE;QACRC,SAAS,EAAE;QACXC,IAAI;QACJ,GAAGZ,SAAS;IACd,CAAA,EAAG;AAEH,iFAAiF;AACjF,OAAO,MAAMa,wBAAwB,IAAIC,IAAiB;IACxD;IACA;IACA;CACD,EAAE;AACH,OAAO,MAAMC,mBAAmB,IAAID,IAAiB;IAAC;IAAS;CAAa,EAAE;AAC9E,OAAO,MAAME,kBAAkB,IAAIF,IAAI;IACrC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;CAEC,GACD,OAAO,MAAMG,0BAA0B,IAAIH,IAAI;IAC7C;IACA;CACD,EAAE;AAEH;;CAEC,GACD,OAAO,MAAMI,oBAAoB;IAC/B;;GAEC,GACDC,WAAW;IACX;;GAEC,GACDC,UAAU;IACV;;GAEC,GACDC,OAAO;IACP;;;;;;GAMC,GACDC,QAAQ;AACV,EAAW"}
1
+ {"version":3,"sources":["../../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data/types.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';\n\n/**\n * The kind of a {@link Model}, describing how it should be rendered.\n *\n * - `interface` — an object type with named properties\n * - `enum` — a set of string/number literal values\n * - `array` — a list whose element type is described by `link`\n * - `tuple` — a fixed-length array (`prefixItems`) whose element types are the\n * `properties`, in order\n * - `dictionary` — a map whose value type is described by `link`\n * - `reference` — a reference to another named model (`type` is its name)\n * - `generic` — a primitive (string/number/boolean/null/void/binary/any)\n * - `one-of` / `any-of` / `all-of` — a composite of other schemas\n */\nexport type ModelExport =\n | 'interface'\n | 'enum'\n | 'array'\n | 'tuple'\n | 'dictionary'\n | 'reference'\n | 'generic'\n | 'one-of'\n | 'any-of'\n | 'all-of';\n\n/**\n * Where a parameter-like {@link Model} appears in a request/response.\n * Empty string is used for models that are not parameters (schemas/properties).\n */\nexport type ModelIn =\n | ''\n | 'query'\n | 'path'\n | 'header'\n | 'cookie'\n | 'body'\n | 'response';\n\n/**\n * How array/object query & header parameters are serialised on the wire.\n * `deepObject` explodes an object into `key[prop]=value` query pairs.\n */\nexport type CollectionFormat = 'multi' | 'csv' | 'ssv' | 'pipes' | 'deepObject';\n\n/** A single enum member value. */\nexport interface EnumMember {\n value: string | number | boolean;\n}\n\n/**\n * A discriminated-composite mapping entry: a discriminator value and the name\n * of the composed model it selects.\n */\nexport interface DiscriminatorMapping {\n /** The discriminator property value (e.g. `\"cat\"`). */\n value: string;\n /** The name of the composed model this value selects (e.g. `\"Cat\"`). */\n modelName: string;\n}\n\n/**\n * The discriminator of a composite (`oneOf`/`anyOf`) or an inheritance base\n * (an `object` schema whose subtypes `allOf`-compose it), used to marshal\n * directly to the matching branch/subtype rather than merging every branch or\n * dropping subtype-only fields.\n */\nexport interface Discriminator {\n /** The wire property name carrying the discriminator value. */\n propertyName: string;\n /** The TypeScript property name (resolved during augmentation). */\n typescriptPropertyName?: string;\n /** The value → composed-model mapping. */\n mapping: DiscriminatorMapping[];\n /**\n * True when this discriminator sits on an inheritance base (an `object`\n * schema selected by `allOf`-composing subtypes) rather than a `oneOf`/\n * `anyOf` composite. The base marshals via dispatch to its subtypes, but its\n * subtypes compose the base's own (non-dispatching) body — so the base emits\n * a separate non-dispatching marshaller to break the recursion.\n */\n isBase?: boolean;\n}\n\n/** A pattern-property entry: a regex pattern and the model for its values. */\nexport interface PatternPropertyModel {\n pattern: string;\n model: Model;\n}\n\n/**\n * A model represents an OpenAPI schema, or something derived from one (a\n * property, parameter, or response). It is produced by the parser\n * (`../parser.ts`) and progressively augmented by `../codegen-data.ts` with\n * language-specific and code-generation fields before being handed to the\n * templates. Augmentation fields are optional as they are absent on raw parser\n * output.\n */\nexport interface Model {\n /** The schema, property, or parameter name. */\n name: string;\n /** How this model should be rendered. */\n export: ModelExport;\n /**\n * The model's type: a primitive name (`string`, `number`, `boolean`, `null`,\n * `void`, `binary`, `any`), `unknown`, or the name of a referenced model.\n */\n type: string;\n /** The OpenAPI `format` (e.g. `int32`, `date-time`, `binary`), if any. */\n format?: string;\n /** Description, used to render doc comments. */\n description: string | null;\n /** Whether the schema is marked deprecated. */\n deprecated: boolean;\n /** Whether the value may be null. */\n isNullable: boolean;\n /** Whether the property is read-only. */\n isReadOnly: boolean;\n /** Whether the property/parameter is required. */\n isRequired: boolean;\n /** Whether an array enforces uniqueness (rendered as a `Set`). */\n uniqueItems?: boolean;\n /** For arrays/dictionaries, the model describing the element/value type. */\n link?: Model | null;\n /** Child properties (for interfaces) or members (for composites). */\n properties: Model[];\n /** Enum members, when `export === 'enum'`. */\n enum: EnumMember[];\n /** Names of other models this model references (for import generation). */\n imports: string[];\n\n /** Where a parameter appears; `''` for non-parameter models. */\n in: ModelIn;\n /** The source property name for a parameter (body parameters use `body`). */\n prop?: string;\n /** The chosen request/response media type, for body params and responses. */\n mediaType?: string | null;\n /**\n * Per-part content types declared by the request body `encoding` object\n * (multipart bodies), keyed by property name.\n */\n partContentTypes?: { [prop: string]: string };\n /** All acceptable media types (request body / response). */\n mediaTypes?: string[];\n /** The response status code, for response models. */\n code?: number | string;\n\n /**\n * For a discriminated subtype's discriminator property: the rendered literal\n * TypeScript type (e.g. `'cat'`, or `'cat' | 'kitten'` when several values\n * map to one subtype) that makes the union a true tagged union. Absent when\n * the subtype's tag can't be pinned to a literal (e.g. it appears in\n * multiple unions with different values).\n */\n discriminatorValue?: string;\n\n /** The raw OpenAPI `type` (used to distinguish integer from number). */\n openapiType?: string | string[];\n /** Vendor extensions (`x-*`) copied from the schema. */\n vendorExtensions?: VendorExtensions;\n /** True when the schema has additionalProperties. */\n hasAdditionalProperties?: boolean;\n /** The model describing additionalProperties values. */\n additionalPropertiesModel?: Model;\n /** True when the schema has patternProperties. */\n hasPatternProperties?: boolean;\n /** The models describing each pattern's values. */\n patternPropertiesModels?: PatternPropertyModel[];\n\n /** For composites: the referenced (object) models composed together. */\n composedModels?: Model[];\n /** For composites: the primitive/enum/array members composed together. */\n composedPrimitives?: Model[];\n /** For discriminated one-of/any-of composites: the discriminator metadata. */\n discriminator?: Discriminator;\n\n /** The TypeScript identifier for this model/property. */\n typescriptName?: string;\n /** The rendered TypeScript type. */\n typescriptType?: string;\n /** The Python identifier for this model/property. */\n pythonName?: string;\n /** The rendered Python type. */\n pythonType?: string;\n /** snake_case model name (Python). */\n nameSnakeCase?: string;\n /** True when the model is a renderable primitive (not composite/collection). */\n isPrimitive?: boolean;\n /** True when the schema declares an enum. */\n isEnum?: boolean;\n\n /** True for JSON-lines streaming responses. */\n isJsonlStreaming?: boolean;\n /** The model describing each streamed item. */\n itemSchemaModel?: Model;\n\n /** Collection serialisation format for array query/header parameters. */\n collectionFormat?: CollectionFormat;\n /** Path parameter serialization style, when not the default `simple`. */\n pathStyle?: 'matrix' | 'label';\n /** Path parameter explode flag (used with `pathStyle`). */\n pathExplode?: boolean;\n /** Query parameter `allowReserved`: reserved characters are not encoded. */\n allowReserved?: boolean;\n}\n\n/** Vendor extension bag (`x-*` keys copied from a schema/operation/spec). */\nexport type VendorExtensions = { [key: string]: unknown };\n\n/**\n * An operation represents a single OpenAPI path + method. Produced by the\n * parser and augmented by `../codegen-data.ts`.\n */\nexport interface Operation {\n id: string;\n name: string;\n method: string;\n path: string;\n description: string | null;\n tags?: string[] | null;\n deprecated: boolean;\n imports: string[];\n parameters: Model[];\n /** The request body parameter (same object reference as in `parameters`). */\n parametersBody?: Model | null;\n responses: Model[];\n\n /** Deduplicated operation name used throughout generated code. */\n uniqueName?: string;\n /** Dot-notation name (tag-qualified), used for metadata keys. */\n dotNotationName?: string;\n operationIdPascalCase?: string;\n operationIdSnakeCase?: string;\n /** The generated request type name (e.g. `FooRequest`). */\n requestTypeName?: string;\n\n /** The response model used as the operation's result. */\n result?: Model;\n\n /** The explicit body parameter when the body is not inlined. */\n explicitRequestBodyParameter?: Model;\n\n vendorExtensions?: VendorExtensions;\n isMutation?: boolean;\n isQuery?: boolean;\n isStreaming?: boolean;\n isInfiniteQuery?: boolean;\n /** The cursor parameter, for infinite queries. */\n infiniteQueryCursorProperty?: Model;\n}\n\n/**\n * A service groups operations. Currently the parser produces a single\n * `Default` service; operations are re-grouped by tag downstream.\n */\nexport interface Service {\n name: string;\n operations: Operation[];\n imports: string[];\n\n /** All model names the service (API client) needs to import. */\n modelImports?: string[];\n className?: string;\n nameSnakeCase?: string;\n}\n\n/**\n * The initial data structure produced by the OpenAPI parser.\n */\nexport interface ClientData {\n models: Model[];\n services: Service[];\n}\n\n/** Models indexed by name, for reference resolution during augmentation. */\nexport type ModelsByName = { [name: string]: Model };\n\n/** Index a list of models by name. */\nexport const indexModelsByName = (models: Model[]): ModelsByName =>\n Object.fromEntries(models.map((m) => [m.name, m]));\n\n/** The single service the parser emits; operations are re-grouped by tag. */\nexport const DEFAULT_SERVICE_NAME = 'Default';\n\n/**\n * The full data structure handed to the code generation templates.\n */\nexport interface CodeGenData extends ClientData {\n className: string;\n info: OpenAPIV3.InfoObject | OpenAPIV3_1.InfoObject;\n allOperations: Operation[];\n operationsByTag: { [tag: string]: Operation[] };\n untaggedOperations: Operation[];\n vendorExtensions: VendorExtensions;\n}\n\n/**\n * Create a {@link Model} with the default fields the parser always emits.\n * Callers override the fields relevant to their specific schema.\n */\nexport const createModel = (overrides: Partial<Model> = {}): Model => ({\n name: '',\n export: 'interface',\n type: 'unknown',\n description: null,\n deprecated: false,\n isNullable: false,\n isReadOnly: false,\n isRequired: false,\n link: null,\n properties: [],\n enum: [],\n imports: [],\n in: '',\n ...overrides,\n});\n\n// Model types which indicate it is composed (ie inherits/mixin's another schema)\nexport const COMPOSED_SCHEMA_TYPES = new Set<ModelExport>([\n 'one-of',\n 'any-of',\n 'all-of',\n]);\nexport const COLLECTION_TYPES = new Set<ModelExport>(['array', 'dictionary']);\nexport const PRIMITIVE_TYPES = new Set([\n 'string',\n 'integer',\n 'number',\n 'boolean',\n 'null',\n 'any',\n 'binary',\n 'void',\n]);\n\n/**\n * Content types that indicate JSON Lines streaming (OpenAPI 3.2)\n */\nexport const STREAMING_CONTENT_TYPES = new Set([\n 'application/jsonl',\n 'application/x-ndjson',\n]);\n\n/**\n * Vendor extensions which are used to customise generated code\n */\nexport const VENDOR_EXTENSIONS = {\n /**\n * Set to 'true' to indicate this is a streaming API\n */\n STREAMING: 'x-streaming',\n /**\n * Set to true to indicate this is a mutation, regardless of its HTTP method\n */\n MUTATION: 'x-mutation',\n /**\n * Set to true to indicate this is a query, regardless of its HTTP method\n */\n QUERY: 'x-query',\n /**\n * Set to the name of the input property used as the cursor for pagination if\n * the API accepts a cursor that is not named 'cursor'.\n * This can also be set to false to override behaviour and indicate this is not\n * a paginated API.\n * Used for tanstack infinite query hooks.\n */\n CURSOR: 'x-cursor',\n} as const;\n"],"names":["indexModelsByName","models","Object","fromEntries","map","m","name","DEFAULT_SERVICE_NAME","createModel","overrides","export","type","description","deprecated","isNullable","isReadOnly","isRequired","link","properties","enum","imports","in","COMPOSED_SCHEMA_TYPES","Set","COLLECTION_TYPES","PRIMITIVE_TYPES","STREAMING_CONTENT_TYPES","VENDOR_EXTENSIONS","STREAMING","MUTATION","QUERY","CURSOR"],"mappings":"AAAA;;;CAGC,GAuRD,oCAAoC,GACpC,OAAO,MAAMA,oBAAoB,CAACC,SAChCC,OAAOC,WAAW,CAACF,OAAOG,GAAG,CAAC,CAACC,IAAM;YAACA,EAAEC,IAAI;YAAED;SAAE,GAAG;AAErD,2EAA2E,GAC3E,OAAO,MAAME,uBAAuB,UAAU;AAc9C;;;CAGC,GACD,OAAO,MAAMC,cAAc,CAACC,YAA4B,CAAC,CAAC,GAAa,CAAA;QACrEH,MAAM;QACNI,QAAQ;QACRC,MAAM;QACNC,aAAa;QACbC,YAAY;QACZC,YAAY;QACZC,YAAY;QACZC,YAAY;QACZC,MAAM;QACNC,YAAY,EAAE;QACdC,MAAM,EAAE;QACRC,SAAS,EAAE;QACXC,IAAI;QACJ,GAAGZ,SAAS;IACd,CAAA,EAAG;AAEH,iFAAiF;AACjF,OAAO,MAAMa,wBAAwB,IAAIC,IAAiB;IACxD;IACA;IACA;CACD,EAAE;AACH,OAAO,MAAMC,mBAAmB,IAAID,IAAiB;IAAC;IAAS;CAAa,EAAE;AAC9E,OAAO,MAAME,kBAAkB,IAAIF,IAAI;IACrC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,EAAE;AAEH;;CAEC,GACD,OAAO,MAAMG,0BAA0B,IAAIH,IAAI;IAC7C;IACA;CACD,EAAE;AAEH;;CAEC,GACD,OAAO,MAAMI,oBAAoB;IAC/B;;GAEC,GACDC,WAAW;IACX;;GAEC,GACDC,UAAU;IACV;;GAEC,GACDC,OAAO;IACP;;;;;;GAMC,GACDC,QAAQ;AACV,EAAW"}
@@ -34,6 +34,7 @@ import { isRef, resolveIfRef, splitRef } from "./refs.js";
34
34
  }
35
35
  for (const model of data.models){
36
36
  assertNoClashingPropertyNames(model);
37
+ assertNoConflictingUnionMemberMarshalling(model);
37
38
  }
38
39
  data.models = orderBy(data.models, (d)=>d.name);
39
40
  // Default service first, then by name.
@@ -163,6 +164,15 @@ import { isRef, resolveIfRef, splitRef } from "./refs.js";
163
164
  augmentBodyParameter(spec, parameter, specOp, modelsByName);
164
165
  } else if ((parameter.in === 'query' || parameter.in === 'header') && specParameter) {
165
166
  parameter.collectionFormat = getCollectionFormat(parameter.in, specParameter);
167
+ if (parameter.in === 'query' && specParameter.allowReserved) {
168
+ parameter.allowReserved = true;
169
+ }
170
+ } else if (parameter.in === 'path' && specParameter) {
171
+ const style = specParameter.style;
172
+ if (style === 'matrix' || style === 'label') {
173
+ parameter.pathStyle = style;
174
+ parameter.pathExplode = !!specParameter.explode;
175
+ }
166
176
  }
167
177
  addLanguageTypes(parameter);
168
178
  }
@@ -296,6 +306,57 @@ import { isRef, resolveIfRef, splitRef } from "./refs.js";
296
306
  seen.set(property.typescriptName, property.name);
297
307
  }
298
308
  };
309
+ /**
310
+ * The marshalling semantics of a property — two properties with the same key
311
+ * convert identically on the wire (so either branch's conversion is safe).
312
+ */ const marshallingKey = (m)=>{
313
+ if ([
314
+ 'date',
315
+ 'date-time'
316
+ ].includes(m.format ?? '')) return 'date';
317
+ if (m.type === 'binary') return 'binary';
318
+ // Enums serialise as their bare primitive (no conversion).
319
+ if (m.isEnum || m.export === 'enum') return 'plain';
320
+ if (COLLECTION_TYPES.has(m.export)) {
321
+ return `${m.export}<${m.link ? marshallingKey(m.link) : 'plain'}>`;
322
+ }
323
+ if (m.export === 'tuple') {
324
+ return `tuple<${m.properties.map(marshallingKey).join(',')}>`;
325
+ }
326
+ if (m.export === 'reference' && !PRIMITIVE_TYPES.has(m.type)) {
327
+ return `ref:${m.type}`;
328
+ }
329
+ return 'plain';
330
+ };
331
+ /**
332
+ * A non-discriminated `oneOf`/`anyOf` of object members marshals by composing
333
+ * every member, taking only the properties present on the value. That is sound
334
+ * exactly when no wire property is claimed by two members with different
335
+ * marshalling (e.g. a `date-time` in one and a plain string in another) —
336
+ * otherwise the branch cannot be determined without guessing, so fail fast and
337
+ * ask for a discriminator rather than corrupt data at runtime.
338
+ */ const assertNoConflictingUnionMemberMarshalling = (model)=>{
339
+ if (model.export !== 'one-of' && model.export !== 'any-of' || model.discriminator) {
340
+ return;
341
+ }
342
+ const seen = new Map();
343
+ for (const member of model.composedModels ?? []){
344
+ for (const property of member.properties){
345
+ if (!property.name) continue;
346
+ const key = marshallingKey(property);
347
+ const existing = seen.get(property.name);
348
+ if (existing && existing.key !== key) {
349
+ throw new Error(`Schema "${model.name}" is a non-discriminated ${camelCase(model.export)} of "${existing.memberName}" and "${member.name}", which both declare a property "${property.name}" with different types, so the correct conversion cannot be determined. Add a discriminator to the union in your OpenAPI specification (e.g. with Pydantic, Field(discriminator=...)).`);
350
+ }
351
+ if (!existing) {
352
+ seen.set(property.name, {
353
+ memberName: member.name,
354
+ key
355
+ });
356
+ }
357
+ }
358
+ }
359
+ };
299
360
  /**
300
361
  * Group operations by their (camelCased) tags, collecting any untagged
301
362
  * operations separately.
@@ -385,6 +446,16 @@ const augmentModelFromSchema = (spec, model, schema, modelsByName, visited = new
385
446
  recurse(model.link, subSchema);
386
447
  }
387
448
  }
449
+ // Tuple element types (3.1 `prefixItems`), positionally.
450
+ if (model.export === 'tuple' && 'prefixItems' in schema) {
451
+ const memberSchemas = schema.prefixItems ?? [];
452
+ model.properties.forEach((member, i)=>{
453
+ const subSchema = resolveIfRef(spec, memberSchemas[i]);
454
+ if (subSchema && !visited.has(member)) {
455
+ recurse(member, subSchema);
456
+ }
457
+ });
458
+ }
388
459
  model.properties.filter((p)=>!visited.has(p) && schema.properties?.[trim(p.name, `"'`)]).forEach((property)=>recurse(property, resolveIfRef(spec, schema.properties[trim(property.name, `"'`)])));
389
460
  if (COMPOSED_SCHEMA_TYPES.has(model.export)) {
390
461
  const memberSchemas = compositeMemberSchemas(schema, model.export);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport orderBy from 'lodash.orderby';\nimport trim from 'lodash.trim';\nimport uniqBy from 'lodash.uniqby';\nimport type { OpenAPIV3 } from 'openapi-types';\nimport {\n camelCase,\n pascalCase,\n snakeCase,\n toClassName,\n upperFirst,\n} from '../../utils/names';\nimport {\n toPythonName,\n toPythonType,\n toTypeScriptModelName,\n toTypeScriptName,\n toTypeScriptType,\n} from './codegen-data/languages';\nimport {\n COLLECTION_TYPES,\n COMPOSED_SCHEMA_TYPES,\n type CodeGenData,\n type CollectionFormat,\n createModel,\n DEFAULT_SERVICE_NAME,\n indexModelsByName,\n type Model,\n type ModelsByName,\n type Operation,\n type PatternPropertyModel,\n PRIMITIVE_TYPES,\n type Service,\n STREAMING_CONTENT_TYPES,\n VENDOR_EXTENSIONS,\n type VendorExtensions,\n} from './codegen-data/types';\nimport { normaliseOpenApiSpecForCodeGen } from './normalise';\nimport {\n buildClientData,\n buildInlineModel,\n compositeMemberSchemas,\n getSpecOperation,\n getSpecParametersByKey,\n getSpecPathParameters,\n linkModel,\n specParameterKey,\n} from './parser';\nimport { isRef, resolveIfRef, splitRef } from './refs';\nimport type { OpenApiSchema, OpenApiSchemaOrRef, Spec } from './types';\n\n/**\n * Build the data structure used to generate code from an OpenAPI spec.\n */\nexport const buildOpenApiCodeGenData = (inSpec: Spec): CodeGenData => {\n const spec = normaliseOpenApiSpecForCodeGen(inSpec);\n const data = buildClientData(spec);\n\n const modelsByName = indexModelsByName(data.models);\n\n for (const service of data.services) {\n augmentService(spec, service, modelsByName);\n }\n\n const allOperations = uniqBy(\n data.services.flatMap((s) => s.operations),\n (o) => o.uniqueName,\n );\n\n // A model per operation request parameter position (query/path/body/...).\n data.models = [\n ...data.models,\n ...allOperations.flatMap((op) =>\n buildRequestParameterModels(op, modelsByName),\n ),\n ];\n\n for (const model of data.models) {\n augmentModel(spec, model, modelsByName);\n }\n for (const model of data.models) {\n model.typescriptName = toTypeScriptModelName(model.name);\n model.typescriptType = model.typescriptName;\n }\n\n for (const model of data.models) {\n assertNoClashingPropertyNames(model);\n }\n\n data.models = orderBy(data.models, (d) => d.name);\n // Default service first, then by name.\n data.services = orderBy(data.services, (s) =>\n s.name === DEFAULT_SERVICE_NAME ? '' : s.name,\n );\n\n const { operationsByTag, untaggedOperations } =\n groupOperationsByTag(allOperations);\n\n return {\n ...data,\n operationsByTag,\n untaggedOperations,\n info: spec.info,\n allOperations,\n vendorExtensions: vendorExtensionsOf(spec),\n className: toClassName(spec.info.title),\n };\n};\n\n/**\n * Augment a service and each of its operations with the data needed for code\n * generation (names, imports, result/request types, behavioural flags), and\n * compute the set of models the service (ie API client) needs to import.\n */\nconst augmentService = (\n spec: Spec,\n service: Service,\n modelsByName: ModelsByName,\n): void => {\n const modelImports = service.operations.flatMap((op) =>\n augmentOperation(spec, op, modelsByName),\n );\n\n service.operations = orderBy(service.operations, (op) => op.uniqueName);\n service.modelImports = orderBy(\n uniqBy([...service.imports, ...modelImports], (x) => x),\n );\n service.className = `${service.name}Api`;\n service.nameSnakeCase = snakeCase(service.name);\n};\n\n/**\n * Augment a single operation with all the data the templates need, returning\n * the names of the models it references (for the service's import list).\n */\nconst augmentOperation = (\n spec: Spec,\n op: Operation,\n modelsByName: ModelsByName,\n): string[] => {\n const specOp = getSpecOperation(spec, op);\n\n assignOperationNames(op, specOp);\n\n op.vendorExtensions = vendorExtensionsOf(specOp);\n\n const modelImports = [\n ...(specOp ? augmentResponses(spec, op, specOp, modelsByName) : []),\n ...augmentParameters(spec, op, specOp, modelsByName),\n ];\n\n op.responses.forEach(addLanguageTypes);\n op.responses = orderBy(op.responses, (r) => r.code);\n\n // Result is the lowest successful response, otherwise the 2XX or default.\n op.result =\n op.responses.find(\n (r) => typeof r.code === 'number' && r.code >= 200 && r.code < 300,\n ) ?? op.responses.find((r) => r.code === '2XX' || r.code === 'default');\n\n op.operationIdPascalCase = pascalCase(op.uniqueName);\n op.operationIdSnakeCase = toPythonName('operation', op.uniqueName);\n\n if (op.parameters.length > 0) {\n const baseRequestTypeName = `${op.operationIdPascalCase}Request`;\n // Use the OperationRequest suffix when the standard Request name clashes\n // with an existing schema.\n op.requestTypeName = spec.components?.schemas?.[baseRequestTypeName]\n ? `${op.operationIdPascalCase}OperationRequest`\n : baseRequestTypeName;\n }\n\n augmentOperationBehaviour(op);\n\n return modelImports;\n};\n\n/**\n * Set an operation's name and its deduplicated variants from the vendor\n * extensions the normaliser added.\n */\nconst assignOperationNames = (\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n): void => {\n const deduplicatedOpId = specOp?.['x-aws-nx-deduplicated-op-id'] as\n | string\n | undefined;\n const dotNotationOpId = specOp?.['x-aws-nx-deduplicated-dot-op-id'] as\n | string\n | undefined;\n\n op.name = op.id ?? op.name;\n op.uniqueName = deduplicatedOpId ?? op.name;\n if (dotNotationOpId) {\n op.dotNotationName = dotNotationOpId;\n }\n};\n\n/**\n * Augment an operation's response models with schema-derived data, resolving\n * void responses and streaming item schemas. Returns the response model names\n * to import.\n */\nconst augmentResponses = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject,\n modelsByName: ModelsByName,\n): string[] => {\n const modelImports = op.responses\n .filter((r) => r.export === 'reference')\n .map((r) => r.type);\n\n for (const response of op.responses) {\n // We cannot distinguish a composite of primitives at runtime (it all comes\n // back as text), so validate this away.\n if (\n response.export === 'reference' &&\n COMPOSED_SCHEMA_TYPES.has(modelsByName[response.type]?.export)\n ) {\n const composedPrimitives = (\n modelsByName[response.type].composedPrimitives ?? []\n ).filter((p) => !COLLECTION_TYPES.has(p.export));\n if (composedPrimitives.length > 0) {\n throw new Error(\n `Operation \"${op.method} ${op.path}\" returns a composite schema of primitives with ${camelCase(modelsByName[response.type].export)}, which cannot be distinguished at runtime`,\n );\n }\n }\n\n const matchingSpecResponse = specOp.responses[`${response.code}`];\n if (!matchingSpecResponse) continue;\n\n const specResponse = resolveIfRef(spec, matchingSpecResponse);\n\n // When there's no content, the response type is 'void'\n if (!specResponse.content) {\n response.type = 'void';\n continue;\n }\n\n const mediaTypes = Object.keys(specResponse.content);\n response.mediaTypes = mediaTypes;\n\n for (const mediaType of mediaTypes) {\n const responseContent = specResponse.content[mediaType];\n const responseSchema = resolveIfRef(spec, responseContent.schema);\n if (responseSchema) {\n augmentModelFromSchema(spec, response, responseSchema, modelsByName);\n }\n if (\n STREAMING_CONTENT_TYPES.has(mediaType) &&\n 'itemSchema' in responseContent\n ) {\n response.isJsonlStreaming = true;\n response.itemSchemaModel = buildOrReferenceModel(\n spec,\n modelsByName,\n responseContent.itemSchema as OpenApiSchemaOrRef,\n );\n }\n }\n }\n\n return modelImports;\n};\n\n/**\n * Augment an operation's parameter models with schema-derived data, resolving\n * request bodies and query/header collection formats. Returns the parameter\n * model names to import.\n */\nconst augmentParameters = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): string[] => {\n const specParametersByKey = getSpecParametersByKey(\n spec,\n specOp,\n getSpecPathParameters(spec, op),\n );\n\n const modelImports: string[] = [];\n\n for (const parameter of op.parameters) {\n if (parameter.export === 'reference') {\n modelImports.push(parameter.type);\n }\n\n const specParameter =\n specParametersByKey[\n specParameterKey({ in: parameter.in, name: parameter.prop })\n ];\n const specParameterSchema = resolveIfRef(spec, specParameter?.schema);\n if (specParameterSchema) {\n augmentModelFromSchema(\n spec,\n parameter,\n specParameterSchema,\n modelsByName,\n );\n }\n\n if (parameter.in === 'body') {\n augmentBodyParameter(spec, parameter, specOp, modelsByName);\n } else if (\n (parameter.in === 'query' || parameter.in === 'header') &&\n specParameter\n ) {\n parameter.collectionFormat = getCollectionFormat(\n parameter.in,\n specParameter,\n );\n }\n\n addLanguageTypes(parameter);\n }\n\n return modelImports;\n};\n\n/**\n * Augment a request body parameter with its schema (the body is not in the\n * spec's `parameters`, so it is resolved from `requestBody` here) and record\n * its acceptable media types.\n */\nconst augmentBodyParameter = (\n spec: Spec,\n parameter: Model,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): void => {\n // The request body parameter is named 'body' downstream.\n parameter.name = 'body';\n parameter.prop = 'body';\n\n const specBody = resolveIfRef(spec, specOp?.requestBody);\n if (!specBody) return;\n\n if (parameter.mediaType) {\n const bodySchema = resolveIfRef(\n spec,\n specBody.content?.[parameter.mediaType]?.schema,\n );\n if (bodySchema) {\n augmentModelFromSchema(spec, parameter, bodySchema, modelsByName);\n }\n }\n // Track all the media types that can be accepted in the request body\n parameter.mediaTypes = Object.keys(specBody.content);\n};\n\n/**\n * Translate an OpenAPI v3 parameter's style/explode into a v2-style\n * collectionFormat used when serialising array parameters.\n * @see https://spec.openapis.org/oas/v3.0.3.html#style-values\n */\nconst getCollectionFormat = (\n position: 'query' | 'header',\n specParameter: OpenAPIV3.ParameterObject,\n): CollectionFormat => {\n const style =\n specParameter.style ?? (position === 'query' ? 'form' : 'simple');\n const explode = specParameter.explode ?? style === 'form';\n\n if (position === 'header') {\n return explode ? 'multi' : 'csv';\n }\n // `deepObject` serialises an object as `key[prop]=value` pairs regardless of\n // explode; the object shape (not array collection) drives its serialisation.\n if (style === 'deepObject') {\n return 'deepObject';\n }\n return explode\n ? 'multi'\n : ((\n {\n spaceDelimited: 'ssv',\n pipeDelimited: 'pipes',\n simple: 'csv',\n form: 'csv',\n } as const\n )[style] ?? 'multi');\n};\n\n/**\n * Build the request parameter models for an operation — one model per parameter\n * position (query/path/header/cookie/body), named e.g.\n * `FooRequestQueryParameters`. Request bodies that can be represented directly\n * (the sole parameter, or a non-clashing object reference) are inlined rather\n * than given a wrapper model, and recorded on `op.explicitRequestBodyParameter`.\n */\nconst buildRequestParameterModels = (\n op: Operation,\n modelsByName: ModelsByName,\n): Model[] => {\n if (!op.parameters || op.parameters.length === 0) {\n return [];\n }\n\n // Whether the request body can be represented directly, without a wrapper\n // model (ie the request will be the body itself).\n const canInlineBody = (body: Model): boolean => {\n // If the body is the only parameter, we can inline it no matter the type\n if (op.parameters.length === 1) {\n return true;\n }\n // We inline object bodies, so long as they aren't dictionaries (as\n // dictionary keys could clash with other parameters), and so long as they\n // don't have a property name that clashes with another parameter\n const hasClashingPropertyName = (\n modelsByName?.[body.type]?.properties ?? []\n ).some((prop) => op.parameters.some((param) => param.name === prop.name));\n return (\n body.export === 'reference' &&\n modelsByName?.[body.type]?.export !== 'dictionary' &&\n !hasClashingPropertyName\n );\n };\n\n // Group parameters by their position (`in`: query/path/header/cookie/body),\n // dropping any body that can be inlined.\n const parametersByPosition = op.parameters\n .filter((p) => !(p.in === 'body' && canInlineBody(p)))\n .reduce<{ [position: string]: Model[] }>(\n (acc, p) => ({ ...acc, [p.in]: [...(acc[p.in] ?? []), p] }),\n {},\n );\n\n // The body parameter was already renamed to \"body\" by augmentBodyParameter.\n op.explicitRequestBodyParameter = parametersByPosition['body']?.[0];\n\n return Object.entries(parametersByPosition).map(([position, parameters]) => {\n const name = `${op.operationIdPascalCase}Request${upperFirst(position)}Parameters`;\n return createModel({\n description: op.description,\n export: 'interface',\n name,\n properties: parameters,\n type: name,\n isRequired: true,\n });\n });\n};\n\n/**\n * Augment a single model with schema-derived data (from its matching spec\n * schema, if any) and language-specific names and types.\n */\nconst augmentModel = (\n spec: Spec,\n model: Model,\n modelsByName: ModelsByName,\n): void => {\n model.nameSnakeCase = toPythonName('model', model.name);\n\n const matchingSpecModel = spec?.components?.schemas?.[model.name];\n if (matchingSpecModel) {\n const specModel = resolveIfRef(spec, matchingSpecModel);\n\n augmentModelFromSchema(spec, model, specModel, modelsByName);\n\n for (const property of model.properties) {\n const matchingSpecProperty = specModel.properties?.[property.name];\n if (matchingSpecProperty) {\n const specProperty = resolveIfRef(spec, matchingSpecProperty);\n augmentModelFromSchema(spec, property, specProperty, modelsByName);\n }\n }\n }\n\n model.properties.forEach(addLanguageTypes);\n\n // Resolve the discriminator's TypeScript property name for marshalling.\n if (model.discriminator) {\n model.discriminator.typescriptPropertyName = toTypeScriptName(\n model.discriminator.propertyName,\n );\n }\n};\n\n/**\n * Ensure no two properties/parameters of an object model collapse onto the same\n * TypeScript identifier (e.g. `foo-bar` and `foo_bar` both camelCase to\n * `fooBar`, or a query and header parameter sharing a name within one request\n * position). Such a clash would emit a type with duplicate members that does\n * not compile, so fail fast with an actionable error instead.\n */\nconst assertNoClashingPropertyNames = (model: Model): void => {\n const seen = new Map<string, string>();\n for (const property of model.properties) {\n // Composite members are unnamed (their names are empty); skip them.\n if (!property.name) continue;\n const existing = seen.get(property.typescriptName!);\n if (existing !== undefined && existing !== property.name) {\n throw new Error(\n `Property name conflict in \"${model.name}\": \"${existing}\" and \"${property.name}\" both map to the TypeScript name \"${property.typescriptName}\". Please rename one of these in your OpenAPI specification.`,\n );\n }\n seen.set(property.typescriptName!, property.name);\n }\n};\n\n/**\n * Group operations by their (camelCased) tags, collecting any untagged\n * operations separately.\n */\nconst groupOperationsByTag = (\n allOperations: Operation[],\n): {\n operationsByTag: { [tag: string]: Operation[] };\n untaggedOperations: Operation[];\n} => {\n const isTagged = (op: Operation): boolean => !!op.tags && op.tags.length > 0;\n\n const operationsByTag = allOperations\n .filter(isTagged)\n .flatMap((op) => op.tags!.map((tag) => [camelCase(tag), op] as const))\n .reduce<{ [tag: string]: Operation[] }>(\n (acc, [tag, op]) => ({ ...acc, [tag]: [...(acc[tag] ?? []), op] }),\n {},\n );\n\n return {\n operationsByTag,\n untaggedOperations: allOperations.filter((op) => !isTagged(op)),\n };\n};\n\n/**\n * Resolve a schema to its model: an existing named model for a `$ref`, or a\n * freshly built-and-augmented model for an inline (nested value) schema.\n */\nconst buildOrReferenceModel = (\n spec: Spec,\n modelsByName: ModelsByName,\n schema: OpenApiSchemaOrRef,\n): Model => {\n if (isRef(schema)) {\n const name = splitRef(schema.$ref)[2];\n return modelsByName[name];\n }\n const model = buildInlineModel(spec, schema);\n linkModel(spec, modelsByName, model, schema);\n augmentModelFromSchema(spec, model, schema, modelsByName);\n return model;\n};\n\n/**\n * The `x-*` vendor extensions declared on an object.\n */\nconst vendorExtensionsOf = (object: object | undefined): VendorExtensions =>\n Object.fromEntries(\n Object.entries(object ?? {}).filter(([key]) => key.startsWith('x-')),\n );\n\nconst augmentModelFromSchema = (\n spec: Spec,\n model: Model,\n schema: OpenApiSchema,\n modelsByName: ModelsByName,\n visited: Set<Model> = new Set(),\n) => {\n model.format = schema.format;\n model.deprecated = !!schema.deprecated;\n model.openapiType = schema.type;\n model.isEnum = !!schema.enum && schema.enum.length > 0;\n model.vendorExtensions = vendorExtensionsOf(schema);\n\n // A \"dictionary\" has only additional properties; an \"interface\" may mix\n // explicit and additional properties.\n if (schema.additionalProperties) {\n const additionalPropertiesModel = buildOrReferenceModel(\n spec,\n modelsByName,\n schema.additionalProperties === true ? {} : schema.additionalProperties,\n );\n\n if (model.export === 'dictionary') {\n // A dictionary carries a self-referential property; the rest are explicit\n const explicitProperties = model.properties.filter(\n (p) => !(p.export === 'dictionary' && p.name === model.name),\n );\n\n // Explicit properties make this an interface rather than a dictionary\n if (explicitProperties.length > 0 || schema.patternProperties) {\n model.export = 'interface';\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n model.properties = explicitProperties;\n }\n } else {\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n }\n }\n\n // Pattern properties can have different value types per pattern, so the model\n // is an interface rather than a dictionary.\n if (schema.patternProperties) {\n const patternProperties = resolveIfRef(spec, schema.patternProperties);\n\n if (model.export === 'dictionary') {\n model.export = 'interface';\n }\n\n model.hasPatternProperties = true;\n model.patternPropertiesModels = Object.entries(patternProperties)\n .map(([pattern, patternProperty]) => ({\n pattern,\n model: buildOrReferenceModel(spec, modelsByName, patternProperty),\n }))\n .filter((entry): entry is PatternPropertyModel => !!entry.model);\n }\n\n addLanguageTypes(model);\n\n visited.add(model);\n\n const recurse = (target: Model, subSchema: OpenApiSchema): void =>\n augmentModelFromSchema(spec, target, subSchema, modelsByName, visited);\n\n // Array element type.\n if (\n model.export === 'array' &&\n model.link &&\n 'items' in schema &&\n schema.items &&\n !visited.has(model.link)\n ) {\n recurse(model.link, resolveIfRef(spec, schema.items));\n }\n\n // Dictionary value type (additionalProperties may be `true` rather than a\n // schema).\n if (\n model.export === 'dictionary' &&\n model.link &&\n 'additionalProperties' in schema &&\n schema.additionalProperties &&\n !visited.has(model.link)\n ) {\n const subSchema = resolveIfRef(spec, schema.additionalProperties);\n if (subSchema !== true) {\n recurse(model.link, subSchema);\n }\n }\n\n model.properties\n .filter((p) => !visited.has(p) && schema.properties?.[trim(p.name, `\"'`)])\n .forEach((property) =>\n recurse(\n property,\n resolveIfRef(spec, schema.properties![trim(property.name, `\"'`)]),\n ),\n );\n\n if (COMPOSED_SCHEMA_TYPES.has(model.export)) {\n const memberSchemas = compositeMemberSchemas(schema, model.export);\n model.properties.forEach((property, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema) {\n recurse(property, subSchema);\n }\n });\n }\n};\n\nconst addLanguageTypes = (model: Model) => {\n model.name = trim(model.name, `\"'`);\n model.typescriptName = toTypeScriptName(model.name);\n model.typescriptType = toTypeScriptType(model);\n model.pythonName = toPythonName('property', model.name);\n model.pythonType = toPythonType(model);\n model.isPrimitive =\n PRIMITIVE_TYPES.has(model.type) &&\n !COMPOSED_SCHEMA_TYPES.has(model.export) &&\n !COLLECTION_TYPES.has(model.export);\n};\n\nconst isOperationMutation = (op: Operation): boolean => {\n // x-mutation/x-query override the HTTP-method default.\n const { vendorExtensions } = op;\n if (vendorExtensions?.[VENDOR_EXTENSIONS.MUTATION]) {\n return true;\n } else if (vendorExtensions?.[VENDOR_EXTENSIONS.QUERY]) {\n return false;\n }\n return ['PATCH', 'POST', 'PUT', 'DELETE'].includes(op.method);\n};\n\nconst augmentInfiniteQuery = (op: Operation) => {\n const { paginationDisabled, cursorPropertyName } = getCursorOptions(op);\n\n const cursorProperty = op.parameters.find(\n (p) => p.name === cursorPropertyName,\n );\n\n // An infinite query is a paginated operation that accepts the cursor parameter\n op.isInfiniteQuery = !paginationDisabled && !!cursorProperty;\n if (op.isInfiniteQuery) {\n op.infiniteQueryCursorProperty = cursorProperty;\n }\n};\n\n/**\n * Resolve the pagination cursor options from an operation's `x-cursor` vendor\n * extension. Accepted forms (object variants exist because Smithy vendor\n * extensions must be objects):\n *\n * - `'property'` / `{ inputToken: 'property' }` — the input property to page on\n * - `false` / `{ enabled: false }` — disable pagination\n */\nconst getCursorOptions = (\n op: Operation,\n): { paginationDisabled: boolean; cursorPropertyName: string } => {\n const cursor = op.vendorExtensions?.[VENDOR_EXTENSIONS.CURSOR];\n\n // Defaults: pagination enabled, paging on a property named 'cursor'.\n if (cursor === false) {\n return { paginationDisabled: true, cursorPropertyName: 'cursor' };\n }\n if (typeof cursor === 'string') {\n return { paginationDisabled: false, cursorPropertyName: cursor };\n }\n const options = (cursor ?? {}) as { enabled?: boolean; inputToken?: unknown };\n return {\n paginationDisabled: options.enabled === false,\n cursorPropertyName:\n typeof options.inputToken === 'string' ? options.inputToken : 'cursor',\n };\n};\n\n/**\n * Add query/mutation, streaming and infinite-query flags to an operation.\n */\nconst augmentOperationBehaviour = (op: Operation) => {\n const isMutation = isOperationMutation(op);\n op.isMutation = isMutation;\n op.isQuery = !isMutation;\n\n op.isStreaming =\n !!op.vendorExtensions?.[VENDOR_EXTENSIONS.STREAMING] ||\n op.responses.some((res) => res.isJsonlStreaming);\n\n // For JSON-lines streaming, the result is each streamed item, so the client\n // method returns AsyncIterableIterator<itemSchemaModel>. Named (hoisted)\n // item schemas become references; inline primitives keep their own type.\n const jsonlResponse = op.responses.find((res) => res.isJsonlStreaming);\n if (jsonlResponse) {\n const itemSchemaModel = jsonlResponse.itemSchemaModel;\n const result = op.result;\n if (result && itemSchemaModel) {\n if (itemSchemaModel.name) {\n result.type = itemSchemaModel.name;\n result.typescriptType = itemSchemaModel.name;\n result.export = 'reference';\n } else {\n result.type = itemSchemaModel.type;\n result.typescriptType = itemSchemaModel.typescriptType;\n result.export = itemSchemaModel.export;\n result.format = itemSchemaModel.format;\n result.link = itemSchemaModel.link;\n result.isPrimitive = itemSchemaModel.isPrimitive;\n }\n }\n }\n\n // Add infinite query details if applicable\n if (!isMutation) {\n augmentInfiniteQuery(op);\n }\n};\n"],"names":["orderBy","trim","uniqBy","camelCase","pascalCase","snakeCase","toClassName","upperFirst","toPythonName","toPythonType","toTypeScriptModelName","toTypeScriptName","toTypeScriptType","COLLECTION_TYPES","COMPOSED_SCHEMA_TYPES","createModel","DEFAULT_SERVICE_NAME","indexModelsByName","PRIMITIVE_TYPES","STREAMING_CONTENT_TYPES","VENDOR_EXTENSIONS","normaliseOpenApiSpecForCodeGen","buildClientData","buildInlineModel","compositeMemberSchemas","getSpecOperation","getSpecParametersByKey","getSpecPathParameters","linkModel","specParameterKey","isRef","resolveIfRef","splitRef","buildOpenApiCodeGenData","inSpec","spec","data","modelsByName","models","service","services","augmentService","allOperations","flatMap","s","operations","o","uniqueName","op","buildRequestParameterModels","model","augmentModel","typescriptName","name","typescriptType","assertNoClashingPropertyNames","d","operationsByTag","untaggedOperations","groupOperationsByTag","info","vendorExtensions","vendorExtensionsOf","className","title","modelImports","augmentOperation","imports","x","nameSnakeCase","specOp","assignOperationNames","augmentResponses","augmentParameters","responses","forEach","addLanguageTypes","r","code","result","find","operationIdPascalCase","operationIdSnakeCase","parameters","length","baseRequestTypeName","requestTypeName","components","schemas","augmentOperationBehaviour","deduplicatedOpId","dotNotationOpId","id","dotNotationName","filter","export","map","type","response","has","composedPrimitives","p","Error","method","path","matchingSpecResponse","specResponse","content","mediaTypes","Object","keys","mediaType","responseContent","responseSchema","schema","augmentModelFromSchema","isJsonlStreaming","itemSchemaModel","buildOrReferenceModel","itemSchema","specParametersByKey","parameter","push","specParameter","in","prop","specParameterSchema","augmentBodyParameter","collectionFormat","getCollectionFormat","specBody","requestBody","bodySchema","position","style","explode","spaceDelimited","pipeDelimited","simple","form","canInlineBody","body","hasClashingPropertyName","properties","some","param","parametersByPosition","reduce","acc","explicitRequestBodyParameter","entries","description","isRequired","matchingSpecModel","specModel","property","matchingSpecProperty","specProperty","discriminator","typescriptPropertyName","propertyName","seen","Map","existing","get","undefined","set","isTagged","tags","tag","$ref","object","fromEntries","key","startsWith","visited","Set","format","deprecated","openapiType","isEnum","enum","additionalProperties","additionalPropertiesModel","explicitProperties","patternProperties","hasAdditionalProperties","hasPatternProperties","patternPropertiesModels","pattern","patternProperty","entry","add","recurse","target","subSchema","link","items","memberSchemas","i","pythonName","pythonType","isPrimitive","isOperationMutation","MUTATION","QUERY","includes","augmentInfiniteQuery","paginationDisabled","cursorPropertyName","getCursorOptions","cursorProperty","isInfiniteQuery","infiniteQueryCursorProperty","cursor","CURSOR","options","enabled","inputToken","isMutation","isQuery","isStreaming","STREAMING","res","jsonlResponse"],"mappings":"AAAA;;;CA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IAAI;gBAC5C0B,OAAOgB,MAAM,GAAG;YAClB,OAAO;gBACLhB,OAAOkB,IAAI,GAAGoB,gBAAgBpB,IAAI;gBAClClB,OAAOzB,cAAc,GAAG+D,gBAAgB/D,cAAc;gBACtDyB,OAAOgB,MAAM,GAAGsB,gBAAgBtB,MAAM;gBACtChB,OAAOkG,MAAM,GAAG5D,gBAAgB4D,MAAM;gBACtClG,OAAOqH,IAAI,GAAG/E,gBAAgB+E,IAAI;gBAClCrH,OAAO2H,WAAW,GAAGrF,gBAAgBqF,WAAW;YAClD;QACF;IACF;IAEA,2CAA2C;IAC3C,IAAI,CAACiB,YAAY;QACfZ,qBAAqB/J;IACvB;AACF"}
1
+ {"version":3,"sources":["../../../../../../packages/nx-plugin/src/open-api/utils/codegen-data.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport orderBy from 'lodash.orderby';\nimport trim from 'lodash.trim';\nimport uniqBy from 'lodash.uniqby';\nimport type { OpenAPIV3 } from 'openapi-types';\nimport {\n camelCase,\n pascalCase,\n snakeCase,\n toClassName,\n upperFirst,\n} from '../../utils/names';\nimport {\n toPythonName,\n toPythonType,\n toTypeScriptModelName,\n toTypeScriptName,\n toTypeScriptType,\n} from './codegen-data/languages';\nimport {\n COLLECTION_TYPES,\n COMPOSED_SCHEMA_TYPES,\n type CodeGenData,\n type CollectionFormat,\n createModel,\n DEFAULT_SERVICE_NAME,\n indexModelsByName,\n type Model,\n type ModelsByName,\n type Operation,\n type PatternPropertyModel,\n PRIMITIVE_TYPES,\n type Service,\n STREAMING_CONTENT_TYPES,\n VENDOR_EXTENSIONS,\n type VendorExtensions,\n} from './codegen-data/types';\nimport { normaliseOpenApiSpecForCodeGen } from './normalise';\nimport {\n buildClientData,\n buildInlineModel,\n compositeMemberSchemas,\n getSpecOperation,\n getSpecParametersByKey,\n getSpecPathParameters,\n linkModel,\n specParameterKey,\n} from './parser';\nimport { isRef, resolveIfRef, splitRef } from './refs';\nimport type { OpenApiSchema, OpenApiSchemaOrRef, Spec } from './types';\n\n/**\n * Build the data structure used to generate code from an OpenAPI spec.\n */\nexport const buildOpenApiCodeGenData = (inSpec: Spec): CodeGenData => {\n const spec = normaliseOpenApiSpecForCodeGen(inSpec);\n const data = buildClientData(spec);\n\n const modelsByName = indexModelsByName(data.models);\n\n for (const service of data.services) {\n augmentService(spec, service, modelsByName);\n }\n\n const allOperations = uniqBy(\n data.services.flatMap((s) => s.operations),\n (o) => o.uniqueName,\n );\n\n // A model per operation request parameter position (query/path/body/...).\n data.models = [\n ...data.models,\n ...allOperations.flatMap((op) =>\n buildRequestParameterModels(op, modelsByName),\n ),\n ];\n\n for (const model of data.models) {\n augmentModel(spec, model, modelsByName);\n }\n for (const model of data.models) {\n model.typescriptName = toTypeScriptModelName(model.name);\n model.typescriptType = model.typescriptName;\n }\n\n for (const model of data.models) {\n assertNoClashingPropertyNames(model);\n assertNoConflictingUnionMemberMarshalling(model);\n }\n\n data.models = orderBy(data.models, (d) => d.name);\n // Default service first, then by name.\n data.services = orderBy(data.services, (s) =>\n s.name === DEFAULT_SERVICE_NAME ? '' : s.name,\n );\n\n const { operationsByTag, untaggedOperations } =\n groupOperationsByTag(allOperations);\n\n return {\n ...data,\n operationsByTag,\n untaggedOperations,\n info: spec.info,\n allOperations,\n vendorExtensions: vendorExtensionsOf(spec),\n className: toClassName(spec.info.title),\n };\n};\n\n/**\n * Augment a service and each of its operations with the data needed for code\n * generation (names, imports, result/request types, behavioural flags), and\n * compute the set of models the service (ie API client) needs to import.\n */\nconst augmentService = (\n spec: Spec,\n service: Service,\n modelsByName: ModelsByName,\n): void => {\n const modelImports = service.operations.flatMap((op) =>\n augmentOperation(spec, op, modelsByName),\n );\n\n service.operations = orderBy(service.operations, (op) => op.uniqueName);\n service.modelImports = orderBy(\n uniqBy([...service.imports, ...modelImports], (x) => x),\n );\n service.className = `${service.name}Api`;\n service.nameSnakeCase = snakeCase(service.name);\n};\n\n/**\n * Augment a single operation with all the data the templates need, returning\n * the names of the models it references (for the service's import list).\n */\nconst augmentOperation = (\n spec: Spec,\n op: Operation,\n modelsByName: ModelsByName,\n): string[] => {\n const specOp = getSpecOperation(spec, op);\n\n assignOperationNames(op, specOp);\n\n op.vendorExtensions = vendorExtensionsOf(specOp);\n\n const modelImports = [\n ...(specOp ? augmentResponses(spec, op, specOp, modelsByName) : []),\n ...augmentParameters(spec, op, specOp, modelsByName),\n ];\n\n op.responses.forEach(addLanguageTypes);\n op.responses = orderBy(op.responses, (r) => r.code);\n\n // Result is the lowest successful response, otherwise the 2XX or default.\n op.result =\n op.responses.find(\n (r) => typeof r.code === 'number' && r.code >= 200 && r.code < 300,\n ) ?? op.responses.find((r) => r.code === '2XX' || r.code === 'default');\n\n op.operationIdPascalCase = pascalCase(op.uniqueName);\n op.operationIdSnakeCase = toPythonName('operation', op.uniqueName);\n\n if (op.parameters.length > 0) {\n const baseRequestTypeName = `${op.operationIdPascalCase}Request`;\n // Use the OperationRequest suffix when the standard Request name clashes\n // with an existing schema.\n op.requestTypeName = spec.components?.schemas?.[baseRequestTypeName]\n ? `${op.operationIdPascalCase}OperationRequest`\n : baseRequestTypeName;\n }\n\n augmentOperationBehaviour(op);\n\n return modelImports;\n};\n\n/**\n * Set an operation's name and its deduplicated variants from the vendor\n * extensions the normaliser added.\n */\nconst assignOperationNames = (\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n): void => {\n const deduplicatedOpId = specOp?.['x-aws-nx-deduplicated-op-id'] as\n | string\n | undefined;\n const dotNotationOpId = specOp?.['x-aws-nx-deduplicated-dot-op-id'] as\n | string\n | undefined;\n\n op.name = op.id ?? op.name;\n op.uniqueName = deduplicatedOpId ?? op.name;\n if (dotNotationOpId) {\n op.dotNotationName = dotNotationOpId;\n }\n};\n\n/**\n * Augment an operation's response models with schema-derived data, resolving\n * void responses and streaming item schemas. Returns the response model names\n * to import.\n */\nconst augmentResponses = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject,\n modelsByName: ModelsByName,\n): string[] => {\n const modelImports = op.responses\n .filter((r) => r.export === 'reference')\n .map((r) => r.type);\n\n for (const response of op.responses) {\n // We cannot distinguish a composite of primitives at runtime (it all comes\n // back as text), so validate this away.\n if (\n response.export === 'reference' &&\n COMPOSED_SCHEMA_TYPES.has(modelsByName[response.type]?.export)\n ) {\n const composedPrimitives = (\n modelsByName[response.type].composedPrimitives ?? []\n ).filter((p) => !COLLECTION_TYPES.has(p.export));\n if (composedPrimitives.length > 0) {\n throw new Error(\n `Operation \"${op.method} ${op.path}\" returns a composite schema of primitives with ${camelCase(modelsByName[response.type].export)}, which cannot be distinguished at runtime`,\n );\n }\n }\n\n const matchingSpecResponse = specOp.responses[`${response.code}`];\n if (!matchingSpecResponse) continue;\n\n const specResponse = resolveIfRef(spec, matchingSpecResponse);\n\n // When there's no content, the response type is 'void'\n if (!specResponse.content) {\n response.type = 'void';\n continue;\n }\n\n const mediaTypes = Object.keys(specResponse.content);\n response.mediaTypes = mediaTypes;\n\n for (const mediaType of mediaTypes) {\n const responseContent = specResponse.content[mediaType];\n const responseSchema = resolveIfRef(spec, responseContent.schema);\n if (responseSchema) {\n augmentModelFromSchema(spec, response, responseSchema, modelsByName);\n }\n if (\n STREAMING_CONTENT_TYPES.has(mediaType) &&\n 'itemSchema' in responseContent\n ) {\n response.isJsonlStreaming = true;\n response.itemSchemaModel = buildOrReferenceModel(\n spec,\n modelsByName,\n responseContent.itemSchema as OpenApiSchemaOrRef,\n );\n }\n }\n }\n\n return modelImports;\n};\n\n/**\n * Augment an operation's parameter models with schema-derived data, resolving\n * request bodies and query/header collection formats. Returns the parameter\n * model names to import.\n */\nconst augmentParameters = (\n spec: Spec,\n op: Operation,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): string[] => {\n const specParametersByKey = getSpecParametersByKey(\n spec,\n specOp,\n getSpecPathParameters(spec, op),\n );\n\n const modelImports: string[] = [];\n\n for (const parameter of op.parameters) {\n if (parameter.export === 'reference') {\n modelImports.push(parameter.type);\n }\n\n const specParameter =\n specParametersByKey[\n specParameterKey({ in: parameter.in, name: parameter.prop })\n ];\n const specParameterSchema = resolveIfRef(spec, specParameter?.schema);\n if (specParameterSchema) {\n augmentModelFromSchema(\n spec,\n parameter,\n specParameterSchema,\n modelsByName,\n );\n }\n\n if (parameter.in === 'body') {\n augmentBodyParameter(spec, parameter, specOp, modelsByName);\n } else if (\n (parameter.in === 'query' || parameter.in === 'header') &&\n specParameter\n ) {\n parameter.collectionFormat = getCollectionFormat(\n parameter.in,\n specParameter,\n );\n if (parameter.in === 'query' && specParameter.allowReserved) {\n parameter.allowReserved = true;\n }\n } else if (parameter.in === 'path' && specParameter) {\n const style = specParameter.style;\n if (style === 'matrix' || style === 'label') {\n parameter.pathStyle = style;\n parameter.pathExplode = !!specParameter.explode;\n }\n }\n\n addLanguageTypes(parameter);\n }\n\n return modelImports;\n};\n\n/**\n * Augment a request body parameter with its schema (the body is not in the\n * spec's `parameters`, so it is resolved from `requestBody` here) and record\n * its acceptable media types.\n */\nconst augmentBodyParameter = (\n spec: Spec,\n parameter: Model,\n specOp: OpenAPIV3.OperationObject | undefined,\n modelsByName: ModelsByName,\n): void => {\n // The request body parameter is named 'body' downstream.\n parameter.name = 'body';\n parameter.prop = 'body';\n\n const specBody = resolveIfRef(spec, specOp?.requestBody);\n if (!specBody) return;\n\n if (parameter.mediaType) {\n const bodySchema = resolveIfRef(\n spec,\n specBody.content?.[parameter.mediaType]?.schema,\n );\n if (bodySchema) {\n augmentModelFromSchema(spec, parameter, bodySchema, modelsByName);\n }\n }\n // Track all the media types that can be accepted in the request body\n parameter.mediaTypes = Object.keys(specBody.content);\n};\n\n/**\n * Translate an OpenAPI v3 parameter's style/explode into a v2-style\n * collectionFormat used when serialising array parameters.\n * @see https://spec.openapis.org/oas/v3.0.3.html#style-values\n */\nconst getCollectionFormat = (\n position: 'query' | 'header',\n specParameter: OpenAPIV3.ParameterObject,\n): CollectionFormat => {\n const style =\n specParameter.style ?? (position === 'query' ? 'form' : 'simple');\n const explode = specParameter.explode ?? style === 'form';\n\n if (position === 'header') {\n return explode ? 'multi' : 'csv';\n }\n // `deepObject` serialises an object as `key[prop]=value` pairs regardless of\n // explode; the object shape (not array collection) drives its serialisation.\n if (style === 'deepObject') {\n return 'deepObject';\n }\n return explode\n ? 'multi'\n : ((\n {\n spaceDelimited: 'ssv',\n pipeDelimited: 'pipes',\n simple: 'csv',\n form: 'csv',\n } as const\n )[style] ?? 'multi');\n};\n\n/**\n * Build the request parameter models for an operation — one model per parameter\n * position (query/path/header/cookie/body), named e.g.\n * `FooRequestQueryParameters`. Request bodies that can be represented directly\n * (the sole parameter, or a non-clashing object reference) are inlined rather\n * than given a wrapper model, and recorded on `op.explicitRequestBodyParameter`.\n */\nconst buildRequestParameterModels = (\n op: Operation,\n modelsByName: ModelsByName,\n): Model[] => {\n if (!op.parameters || op.parameters.length === 0) {\n return [];\n }\n\n // Whether the request body can be represented directly, without a wrapper\n // model (ie the request will be the body itself).\n const canInlineBody = (body: Model): boolean => {\n // If the body is the only parameter, we can inline it no matter the type\n if (op.parameters.length === 1) {\n return true;\n }\n // We inline object bodies, so long as they aren't dictionaries (as\n // dictionary keys could clash with other parameters), and so long as they\n // don't have a property name that clashes with another parameter\n const hasClashingPropertyName = (\n modelsByName?.[body.type]?.properties ?? []\n ).some((prop) => op.parameters.some((param) => param.name === prop.name));\n return (\n body.export === 'reference' &&\n modelsByName?.[body.type]?.export !== 'dictionary' &&\n !hasClashingPropertyName\n );\n };\n\n // Group parameters by their position (`in`: query/path/header/cookie/body),\n // dropping any body that can be inlined.\n const parametersByPosition = op.parameters\n .filter((p) => !(p.in === 'body' && canInlineBody(p)))\n .reduce<{ [position: string]: Model[] }>(\n (acc, p) => ({ ...acc, [p.in]: [...(acc[p.in] ?? []), p] }),\n {},\n );\n\n // The body parameter was already renamed to \"body\" by augmentBodyParameter.\n op.explicitRequestBodyParameter = parametersByPosition['body']?.[0];\n\n return Object.entries(parametersByPosition).map(([position, parameters]) => {\n const name = `${op.operationIdPascalCase}Request${upperFirst(position)}Parameters`;\n return createModel({\n description: op.description,\n export: 'interface',\n name,\n properties: parameters,\n type: name,\n isRequired: true,\n });\n });\n};\n\n/**\n * Augment a single model with schema-derived data (from its matching spec\n * schema, if any) and language-specific names and types.\n */\nconst augmentModel = (\n spec: Spec,\n model: Model,\n modelsByName: ModelsByName,\n): void => {\n model.nameSnakeCase = toPythonName('model', model.name);\n\n const matchingSpecModel = spec?.components?.schemas?.[model.name];\n if (matchingSpecModel) {\n const specModel = resolveIfRef(spec, matchingSpecModel);\n\n augmentModelFromSchema(spec, model, specModel, modelsByName);\n\n for (const property of model.properties) {\n const matchingSpecProperty = specModel.properties?.[property.name];\n if (matchingSpecProperty) {\n const specProperty = resolveIfRef(spec, matchingSpecProperty);\n augmentModelFromSchema(spec, property, specProperty, modelsByName);\n }\n }\n }\n\n model.properties.forEach(addLanguageTypes);\n\n // Resolve the discriminator's TypeScript property name for marshalling.\n if (model.discriminator) {\n model.discriminator.typescriptPropertyName = toTypeScriptName(\n model.discriminator.propertyName,\n );\n }\n};\n\n/**\n * Ensure no two properties/parameters of an object model collapse onto the same\n * TypeScript identifier (e.g. `foo-bar` and `foo_bar` both camelCase to\n * `fooBar`, or a query and header parameter sharing a name within one request\n * position). Such a clash would emit a type with duplicate members that does\n * not compile, so fail fast with an actionable error instead.\n */\nconst assertNoClashingPropertyNames = (model: Model): void => {\n const seen = new Map<string, string>();\n for (const property of model.properties) {\n // Composite members are unnamed (their names are empty); skip them.\n if (!property.name) continue;\n const existing = seen.get(property.typescriptName!);\n if (existing !== undefined && existing !== property.name) {\n throw new Error(\n `Property name conflict in \"${model.name}\": \"${existing}\" and \"${property.name}\" both map to the TypeScript name \"${property.typescriptName}\". Please rename one of these in your OpenAPI specification.`,\n );\n }\n seen.set(property.typescriptName!, property.name);\n }\n};\n\n/**\n * The marshalling semantics of a property — two properties with the same key\n * convert identically on the wire (so either branch's conversion is safe).\n */\nconst marshallingKey = (m: Model): string => {\n if (['date', 'date-time'].includes(m.format ?? '')) return 'date';\n if (m.type === 'binary') return 'binary';\n // Enums serialise as their bare primitive (no conversion).\n if (m.isEnum || m.export === 'enum') return 'plain';\n if (COLLECTION_TYPES.has(m.export)) {\n return `${m.export}<${m.link ? marshallingKey(m.link) : 'plain'}>`;\n }\n if (m.export === 'tuple') {\n return `tuple<${m.properties.map(marshallingKey).join(',')}>`;\n }\n if (m.export === 'reference' && !PRIMITIVE_TYPES.has(m.type)) {\n return `ref:${m.type}`;\n }\n return 'plain';\n};\n\n/**\n * A non-discriminated `oneOf`/`anyOf` of object members marshals by composing\n * every member, taking only the properties present on the value. That is sound\n * exactly when no wire property is claimed by two members with different\n * marshalling (e.g. a `date-time` in one and a plain string in another) —\n * otherwise the branch cannot be determined without guessing, so fail fast and\n * ask for a discriminator rather than corrupt data at runtime.\n */\nconst assertNoConflictingUnionMemberMarshalling = (model: Model): void => {\n if (\n (model.export !== 'one-of' && model.export !== 'any-of') ||\n model.discriminator\n ) {\n return;\n }\n const seen = new Map<string, { memberName: string; key: string }>();\n for (const member of model.composedModels ?? []) {\n for (const property of member.properties) {\n if (!property.name) continue;\n const key = marshallingKey(property);\n const existing = seen.get(property.name);\n if (existing && existing.key !== key) {\n throw new Error(\n `Schema \"${model.name}\" is a non-discriminated ${camelCase(model.export)} of \"${existing.memberName}\" and \"${member.name}\", which both declare a property \"${property.name}\" with different types, so the correct conversion cannot be determined. Add a discriminator to the union in your OpenAPI specification (e.g. with Pydantic, Field(discriminator=...)).`,\n );\n }\n if (!existing) {\n seen.set(property.name, { memberName: member.name, key });\n }\n }\n }\n};\n\n/**\n * Group operations by their (camelCased) tags, collecting any untagged\n * operations separately.\n */\nconst groupOperationsByTag = (\n allOperations: Operation[],\n): {\n operationsByTag: { [tag: string]: Operation[] };\n untaggedOperations: Operation[];\n} => {\n const isTagged = (op: Operation): boolean => !!op.tags && op.tags.length > 0;\n\n const operationsByTag = allOperations\n .filter(isTagged)\n .flatMap((op) => op.tags!.map((tag) => [camelCase(tag), op] as const))\n .reduce<{ [tag: string]: Operation[] }>(\n (acc, [tag, op]) => ({ ...acc, [tag]: [...(acc[tag] ?? []), op] }),\n {},\n );\n\n return {\n operationsByTag,\n untaggedOperations: allOperations.filter((op) => !isTagged(op)),\n };\n};\n\n/**\n * Resolve a schema to its model: an existing named model for a `$ref`, or a\n * freshly built-and-augmented model for an inline (nested value) schema.\n */\nconst buildOrReferenceModel = (\n spec: Spec,\n modelsByName: ModelsByName,\n schema: OpenApiSchemaOrRef,\n): Model => {\n if (isRef(schema)) {\n const name = splitRef(schema.$ref)[2];\n return modelsByName[name];\n }\n const model = buildInlineModel(spec, schema);\n linkModel(spec, modelsByName, model, schema);\n augmentModelFromSchema(spec, model, schema, modelsByName);\n return model;\n};\n\n/**\n * The `x-*` vendor extensions declared on an object.\n */\nconst vendorExtensionsOf = (object: object | undefined): VendorExtensions =>\n Object.fromEntries(\n Object.entries(object ?? {}).filter(([key]) => key.startsWith('x-')),\n );\n\nconst augmentModelFromSchema = (\n spec: Spec,\n model: Model,\n schema: OpenApiSchema,\n modelsByName: ModelsByName,\n visited: Set<Model> = new Set(),\n) => {\n model.format = schema.format;\n model.deprecated = !!schema.deprecated;\n model.openapiType = schema.type;\n model.isEnum = !!schema.enum && schema.enum.length > 0;\n model.vendorExtensions = vendorExtensionsOf(schema);\n\n // A \"dictionary\" has only additional properties; an \"interface\" may mix\n // explicit and additional properties.\n if (schema.additionalProperties) {\n const additionalPropertiesModel = buildOrReferenceModel(\n spec,\n modelsByName,\n schema.additionalProperties === true ? {} : schema.additionalProperties,\n );\n\n if (model.export === 'dictionary') {\n // A dictionary carries a self-referential property; the rest are explicit\n const explicitProperties = model.properties.filter(\n (p) => !(p.export === 'dictionary' && p.name === model.name),\n );\n\n // Explicit properties make this an interface rather than a dictionary\n if (explicitProperties.length > 0 || schema.patternProperties) {\n model.export = 'interface';\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n model.properties = explicitProperties;\n }\n } else {\n model.hasAdditionalProperties = true;\n model.additionalPropertiesModel = additionalPropertiesModel;\n }\n }\n\n // Pattern properties can have different value types per pattern, so the model\n // is an interface rather than a dictionary.\n if (schema.patternProperties) {\n const patternProperties = resolveIfRef(spec, schema.patternProperties);\n\n if (model.export === 'dictionary') {\n model.export = 'interface';\n }\n\n model.hasPatternProperties = true;\n model.patternPropertiesModels = Object.entries(patternProperties)\n .map(([pattern, patternProperty]) => ({\n pattern,\n model: buildOrReferenceModel(spec, modelsByName, patternProperty),\n }))\n .filter((entry): entry is PatternPropertyModel => !!entry.model);\n }\n\n addLanguageTypes(model);\n\n visited.add(model);\n\n const recurse = (target: Model, subSchema: OpenApiSchema): void =>\n augmentModelFromSchema(spec, target, subSchema, modelsByName, visited);\n\n // Array element type.\n if (\n model.export === 'array' &&\n model.link &&\n 'items' in schema &&\n schema.items &&\n !visited.has(model.link)\n ) {\n recurse(model.link, resolveIfRef(spec, schema.items));\n }\n\n // Dictionary value type (additionalProperties may be `true` rather than a\n // schema).\n if (\n model.export === 'dictionary' &&\n model.link &&\n 'additionalProperties' in schema &&\n schema.additionalProperties &&\n !visited.has(model.link)\n ) {\n const subSchema = resolveIfRef(spec, schema.additionalProperties);\n if (subSchema !== true) {\n recurse(model.link, subSchema);\n }\n }\n\n // Tuple element types (3.1 `prefixItems`), positionally.\n if (model.export === 'tuple' && 'prefixItems' in schema) {\n const memberSchemas =\n (schema as { prefixItems?: OpenApiSchemaOrRef[] }).prefixItems ?? [];\n model.properties.forEach((member, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema && !visited.has(member)) {\n recurse(member, subSchema);\n }\n });\n }\n\n model.properties\n .filter((p) => !visited.has(p) && schema.properties?.[trim(p.name, `\"'`)])\n .forEach((property) =>\n recurse(\n property,\n resolveIfRef(spec, schema.properties![trim(property.name, `\"'`)]),\n ),\n );\n\n if (COMPOSED_SCHEMA_TYPES.has(model.export)) {\n const memberSchemas = compositeMemberSchemas(schema, model.export);\n model.properties.forEach((property, i) => {\n const subSchema = resolveIfRef(spec, memberSchemas[i]);\n if (subSchema) {\n recurse(property, subSchema);\n }\n });\n }\n};\n\nconst addLanguageTypes = (model: Model) => {\n model.name = trim(model.name, `\"'`);\n model.typescriptName = toTypeScriptName(model.name);\n model.typescriptType = toTypeScriptType(model);\n model.pythonName = toPythonName('property', model.name);\n model.pythonType = toPythonType(model);\n model.isPrimitive =\n PRIMITIVE_TYPES.has(model.type) &&\n !COMPOSED_SCHEMA_TYPES.has(model.export) &&\n !COLLECTION_TYPES.has(model.export);\n};\n\nconst isOperationMutation = (op: Operation): boolean => {\n // x-mutation/x-query override the HTTP-method default.\n const { vendorExtensions } = op;\n if (vendorExtensions?.[VENDOR_EXTENSIONS.MUTATION]) {\n return true;\n } else if (vendorExtensions?.[VENDOR_EXTENSIONS.QUERY]) {\n return false;\n }\n return ['PATCH', 'POST', 'PUT', 'DELETE'].includes(op.method);\n};\n\nconst augmentInfiniteQuery = (op: Operation) => {\n const { paginationDisabled, cursorPropertyName } = getCursorOptions(op);\n\n const cursorProperty = op.parameters.find(\n (p) => p.name === cursorPropertyName,\n );\n\n // An infinite query is a paginated operation that accepts the cursor parameter\n op.isInfiniteQuery = !paginationDisabled && !!cursorProperty;\n if (op.isInfiniteQuery) {\n op.infiniteQueryCursorProperty = cursorProperty;\n }\n};\n\n/**\n * Resolve the pagination cursor options from an operation's `x-cursor` vendor\n * extension. Accepted forms (object variants exist because Smithy vendor\n * extensions must be objects):\n *\n * - `'property'` / `{ inputToken: 'property' }` — the input property to page on\n * - `false` / `{ enabled: false }` — disable pagination\n */\nconst getCursorOptions = (\n op: Operation,\n): { paginationDisabled: boolean; cursorPropertyName: string } => {\n const cursor = op.vendorExtensions?.[VENDOR_EXTENSIONS.CURSOR];\n\n // Defaults: pagination enabled, paging on a property named 'cursor'.\n if (cursor === false) {\n return { paginationDisabled: true, cursorPropertyName: 'cursor' };\n }\n if (typeof cursor === 'string') {\n return { paginationDisabled: false, cursorPropertyName: cursor };\n }\n const options = (cursor ?? {}) as { enabled?: boolean; inputToken?: unknown };\n return {\n paginationDisabled: options.enabled === false,\n cursorPropertyName:\n typeof options.inputToken === 'string' ? options.inputToken : 'cursor',\n };\n};\n\n/**\n * Add query/mutation, streaming and infinite-query flags to an operation.\n */\nconst augmentOperationBehaviour = (op: Operation) => {\n const isMutation = isOperationMutation(op);\n op.isMutation = isMutation;\n op.isQuery = !isMutation;\n\n op.isStreaming =\n !!op.vendorExtensions?.[VENDOR_EXTENSIONS.STREAMING] ||\n op.responses.some((res) => res.isJsonlStreaming);\n\n // For JSON-lines streaming, the result is each streamed item, so the client\n // method returns AsyncIterableIterator<itemSchemaModel>. Named (hoisted)\n // item schemas become references; inline primitives keep their own type.\n const jsonlResponse = op.responses.find((res) => res.isJsonlStreaming);\n if (jsonlResponse) {\n const itemSchemaModel = jsonlResponse.itemSchemaModel;\n const result = op.result;\n if (result && itemSchemaModel) {\n if (itemSchemaModel.name) {\n result.type = itemSchemaModel.name;\n result.typescriptType = itemSchemaModel.name;\n result.export = 'reference';\n } else {\n result.type = itemSchemaModel.type;\n result.typescriptType = itemSchemaModel.typescriptType;\n result.export = itemSchemaModel.export;\n result.format = itemSchemaModel.format;\n result.link = itemSchemaModel.link;\n result.isPrimitive = itemSchemaModel.isPrimitive;\n }\n }\n }\n\n // Add infinite query details if applicable\n if (!isMutation) {\n augmentInfiniteQuery(op);\n }\n};\n"],"names":["orderBy","trim","uniqBy","camelCase","pascalCase","snakeCase","toClassName","upperFirst","toPythonName","toPythonType","toTypeScriptModelName","toTypeScriptName","toTypeScriptType","COLLECTION_TYPES","COMPOSED_SCHEMA_TYPES","createModel","DEFAULT_SERVICE_NAME","indexModelsByName","PRIMITIVE_TYPES","STREAMING_CONTENT_TYPES","VENDOR_EXTENSIONS","normaliseOpenApiSpecForCodeGen","buildClientData","buildInlineModel","compositeMemberSchemas","getSpecOperation","getSpecParametersByKey","getSpecPathParameters","linkModel","specParameterKey","isRef","resolveIfRef","splitRef","buildOpenApiCodeGenData","inSpec","spec","data","modelsByName","models","service","services","augmentService","allOperations","flatMap","s","operations","o","uniqueName","op","buildRequestParameterModels","model","augmentModel","typescriptName","name","typescriptType","assertNoClashingPropertyNames","assertNoConflictingUnionMemberMarshalling","d","operationsByTag","untaggedOperations","groupOperationsByTag","info","vendorExtensions","vendorExtensionsOf","className","title","modelImports","augmentOperation","imports","x","nameSnakeCase","specOp","assignOperationNames","augmentResponses","augmentParameters","responses","forEach","addLanguageTypes","r","code","result","find","operationIdPascalCase","operationIdSnakeCase","parameters","length","baseRequestTypeName","requestTypeName","components","schemas","augmentOperationBehaviour","deduplicatedOpId","dotNotationOpId","id","dotNotationName","filter","export","map","type","response","has","composedPrimitives","p","Error","method","path","matchingSpecResponse","specResponse","content","mediaTypes","Object","keys","mediaType","responseContent","responseSchema","schema","augmentModelFromSchema","isJsonlStreaming","itemSchemaModel","buildOrReferenceModel","itemSchema","specParametersByKey","parameter","push","specParameter","in","prop","specParameterSchema","augmentBodyParameter","collectionFormat","getCollectionFormat","allowReserved","style","pathStyle","pathExplode","explode","specBody","requestBody","bodySchema","position","spaceDelimited","pipeDelimited","simple","form","canInlineBody","body","hasClashingPropertyName","properties","some","param","parametersByPosition","reduce","acc","explicitRequestBodyParameter","entries","description","isRequired","matchingSpecModel","specModel","property","matchingSpecProperty","specProperty","discriminator","typescriptPropertyName","propertyName","seen","Map","existing","get","undefined","set","marshallingKey","m","includes","format","isEnum","link","join","member","composedModels","key","memberName","isTagged","tags","tag","$ref","object","fromEntries","startsWith","visited","Set","deprecated","openapiType","enum","additionalProperties","additionalPropertiesModel","explicitProperties","patternProperties","hasAdditionalProperties","hasPatternProperties","patternPropertiesModels","pattern","patternProperty","entry","add","recurse","target","subSchema","items","memberSchemas","prefixItems","i","pythonName","pythonType","isPrimitive","isOperationMutation","MUTATION","QUERY","augmentInfiniteQuery","paginationDisabled","cursorPropertyName","getCursorOptions","cursorProperty","isInfiniteQuery","infiniteQueryCursorProperty","cursor","CURSOR","options","enabled","inputToken","isMutation","isQuery","isStreaming","STREAMING","res","jsonlResponse"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,aAAa,iBAAiB;AACrC,OAAOC,UAAU,cAAc;AAC/B,OAAOC,YAAY,gBAAgB;AAEnC,SACEC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,WAAW,EACXC,UAAU,QACL,uBAAoB;AAC3B,SACEC,YAAY,EACZC,YAAY,EACZC,qBAAqB,EACrBC,gBAAgB,EAChBC,gBAAgB,QACX,8BAA2B;AAClC,SACEC,gBAAgB,EAChBC,qBAAqB,EAGrBC,WAAW,EACXC,oBAAoB,EACpBC,iBAAiB,EAKjBC,eAAe,EAEfC,uBAAuB,EACvBC,iBAAiB,QAEZ,0BAAuB;AAC9B,SAASC,8BAA8B,QAAQ,iBAAc;AAC7D,SACEC,eAAe,EACfC,gBAAgB,EAChBC,sBAAsB,EACtBC,gBAAgB,EAChBC,sBAAsB,EACtBC,qBAAqB,EACrBC,SAAS,EACTC,gBAAgB,QACX,cAAW;AAClB,SAASC,KAAK,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,YAAS;AAGvD;;CAEC,GACD,OAAO,MAAMC,0BAA0B,CAACC;IACtC,MAAMC,OAAOd,+BAA+Ba;IAC5C,MAAME,OAAOd,gBAAgBa;IAE7B,MAAME,eAAepB,kBAAkBmB,KAAKE,MAAM;IAElD,KAAK,MAAMC,WAAWH,KAAKI,QAAQ,CAAE;QACnCC,eAAeN,MAAMI,SAASF;IAChC;IAEA,MAAMK,gBAAgBxC,OACpBkC,KAAKI,QAAQ,CAACG,OAAO,CAAC,CAACC,IAAMA,EAAEC,UAAU,GACzC,CAACC,IAAMA,EAAEC,UAAU;IAGrB,0EAA0E;IAC1EX,KAAKE,MAAM,GAAG;WACTF,KAAKE,MAAM;WACXI,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ClC2B,OAAO1B,cAAc,GAAGgE,gBAAgBjE,IAAI;gBAC5C2B,OAAOgB,MAAM,GAAG;YAClB,OAAO;gBACLhB,OAAOkB,IAAI,GAAGoB,gBAAgBpB,IAAI;gBAClClB,OAAO1B,cAAc,GAAGgE,gBAAgBhE,cAAc;gBACtD0B,OAAOgB,MAAM,GAAGsB,gBAAgBtB,MAAM;gBACtChB,OAAO8F,MAAM,GAAGxD,gBAAgBwD,MAAM;gBACtC9F,OAAOgG,IAAI,GAAG1D,gBAAgB0D,IAAI;gBAClChG,OAAOsI,WAAW,GAAGhG,gBAAgBgG,WAAW;YAClD;QACF;IACF;IAEA,2CAA2C;IAC3C,IAAI,CAACgB,YAAY;QACfZ,qBAAqB1K;IACvB;AACF"}
@@ -74,6 +74,32 @@ const isCompositeSchema = (schema)=>!!schema.allOf || !!schema.anyOf || !!schema
74
74
  * `application/json`, falling back to any `+json` vendored type (e.g.
75
75
  * `application/problem+json`).
76
76
  */ const preferredJsonMediaType = (mediaTypes)=>mediaTypes.find((mediaType)=>mediaType === 'application/json') ?? mediaTypes.find((mediaType)=>mediaType.split(';')[0].endsWith('+json'));
77
+ const FORM_MEDIA_TYPES = [
78
+ 'multipart/form-data',
79
+ 'application/x-www-form-urlencoded'
80
+ ];
81
+ const isFormMediaType = (mediaType)=>FORM_MEDIA_TYPES.includes(mediaType.split(';')[0]);
82
+ /**
83
+ * Whether a `contentMediaType` denotes binary (rather than textual/JSON)
84
+ * content — an octet-stream, image, audio, etc.
85
+ */ const isBinaryContentMediaType = (contentMediaType)=>!(contentMediaType.startsWith('text/') || contentMediaType === 'application/json' || contentMediaType.endsWith('+json') || contentMediaType === 'application/xml');
86
+ /**
87
+ * Rewrite file string fields of a form body to `format: binary` so the
88
+ * generator types them as `Blob`. FastAPI emits an identical schema
89
+ * (`{type: string, contentMediaType: ...}`) for a multipart file field and for
90
+ * `bytes` in a JSON body; only the enclosing media type distinguishes them, so
91
+ * this promotion is scoped to form bodies. A base64 `contentEncoding` or a
92
+ * textual/JSON `contentMediaType` keeps the field a string. `format: binary` is
93
+ * left untouched (already binary anywhere).
94
+ */ const markFormBinaryFields = (schema)=>{
95
+ Object.values(schema.properties ?? {}).forEach((prop)=>{
96
+ if (isRef(prop)) return;
97
+ const s = prop;
98
+ if (s.type === 'string' && s.format !== 'binary' && s.contentMediaType && !s.contentEncoding && isBinaryContentMediaType(s.contentMediaType)) {
99
+ s.format = 'binary';
100
+ }
101
+ });
102
+ };
77
103
  const hasSubSchemasToVisit = (schema)=>!!schema && !isRef(schema) && ([
78
104
  'object',
79
105
  'array'
@@ -161,6 +187,22 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
161
187
  ]
162
188
  }
163
189
  ] : [],
190
+ ...(schema.prefixItems ?? []).flatMap((s, i)=>hasSubSchemasToVisit(s) ? [
191
+ {
192
+ nameParts: s.title ? [
193
+ pascalCase(s.title)
194
+ ] : [
195
+ ...nameParts,
196
+ 'Item',
197
+ `${i}`
198
+ ],
199
+ schema: s,
200
+ propPath: [
201
+ 'prefixItems',
202
+ i
203
+ ]
204
+ }
205
+ ] : []),
164
206
  ...Object.entries(schema.properties ?? {}).filter(([, s])=>hasSubSchemasToVisit(s)).map(([name, s])=>({
165
207
  nameParts: s.title ? [
166
208
  pascalCase(s.title)
@@ -441,17 +483,20 @@ const hoistInlineObjectSubSchemas = (nameParts, schema, seenModelNameCounts)=>{
441
483
  // Hoist the JSON body, falling back to a form-data body (multipart or
442
484
  // urlencoded) so an inline form object is fully typed and marshalled
443
485
  // rather than left `unknown`.
444
- const bodyMediaType = preferredJsonMediaType(contentMediaTypes) ?? contentMediaTypes.find((mt)=>[
445
- 'multipart/form-data',
446
- 'application/x-www-form-urlencoded'
447
- ].includes(mt.split(';')[0]));
448
- const bodyRequestSchema = bodyMediaType ? requestBody.content[bodyMediaType].schema : undefined;
449
- if (bodyRequestSchema && !isRef(bodyRequestSchema) && ([
486
+ const bodyMediaType = preferredJsonMediaType(contentMediaTypes) ?? contentMediaTypes.find(isFormMediaType);
487
+ const bodyContentSchema = bodyMediaType ? requestBody.content[bodyMediaType].schema : undefined;
488
+ // A form body's binary string fields are file uploads (Blob). Mark
489
+ // the resolved schema (inline or $ref target) before hoisting.
490
+ if (bodyMediaType && isFormMediaType(bodyMediaType)) {
491
+ const resolved = resolveIfRef(spec, bodyContentSchema);
492
+ if (resolved) markFormBinaryFields(resolved);
493
+ }
494
+ if (bodyContentSchema && !isRef(bodyContentSchema) && ([
450
495
  'object',
451
496
  'array'
452
- ].includes(bodyRequestSchema.type) || isCompositeSchema(bodyRequestSchema) || bodyRequestSchema?.type === 'string' && bodyRequestSchema.enum)) {
497
+ ].includes(bodyContentSchema.type) || isCompositeSchema(bodyContentSchema) || bodyContentSchema?.type === 'string' && bodyContentSchema.enum)) {
453
498
  const schemaName = `${upperFirst(deduplicatedOpId)}RequestContent`;
454
- spec.components.schemas[schemaName] = bodyRequestSchema;
499
+ spec.components.schemas[schemaName] = bodyContentSchema;
455
500
  requestBody.content[bodyMediaType].schema = {
456
501
  $ref: `#/components/schemas/${schemaName}`
457
502
  };