@redocly/client-generator 0.3.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -54
- package/eject-assets/AGENTS.md +137 -0
- package/eject-assets/generators/cli/docs.ts +224 -0
- package/eject-assets/generators/cli/engine-source.ts +21 -0
- package/eject-assets/generators/cli/index.ts +90 -0
- package/eject-assets/generators/cli/render.ts +348 -0
- package/eject-assets/generators/go/client.ts +57 -0
- package/eject-assets/generators/go/descriptor.ts +41 -0
- package/eject-assets/generators/go/index.ts +336 -0
- package/eject-assets/generators/go/models.ts +179 -0
- package/eject-assets/generators/go/naming.ts +49 -0
- package/eject-assets/generators/go/operations.ts +296 -0
- package/eject-assets/generators/go/pagination.ts +194 -0
- package/eject-assets/generators/go/types.ts +60 -0
- package/eject-assets/generators/mock/faker.ts +214 -0
- package/eject-assets/generators/mock/index.ts +35 -0
- package/eject-assets/generators/mock/render.ts +282 -0
- package/eject-assets/generators/mock/sample.ts +316 -0
- package/eject-assets/generators/mock/values.ts +63 -0
- package/eject-assets/generators/php/client.ts +63 -0
- package/eject-assets/generators/php/descriptor.ts +58 -0
- package/eject-assets/generators/php/index.ts +237 -0
- package/eject-assets/generators/php/models.ts +275 -0
- package/eject-assets/generators/php/naming.ts +51 -0
- package/eject-assets/generators/php/operations.ts +232 -0
- package/eject-assets/generators/php/pagination.ts +133 -0
- package/eject-assets/generators/php/types.ts +148 -0
- package/eject-assets/generators/python/client.ts +123 -0
- package/eject-assets/generators/python/descriptor.ts +52 -0
- package/eject-assets/generators/python/index.ts +251 -0
- package/eject-assets/generators/python/models.ts +242 -0
- package/eject-assets/generators/python/naming.ts +46 -0
- package/eject-assets/generators/python/operations.ts +147 -0
- package/eject-assets/generators/python/pagination.ts +128 -0
- package/eject-assets/generators/python/types.ts +54 -0
- package/eject-assets/generators/swr/index.ts +37 -0
- package/eject-assets/generators/swr/render.ts +78 -0
- package/eject-assets/generators/tanstack-query/index.ts +48 -0
- package/eject-assets/generators/tanstack-query/render.ts +346 -0
- package/eject-assets/generators/transformers/index.ts +46 -0
- package/eject-assets/generators/transformers/render.ts +506 -0
- package/eject-assets/generators/typescript/banner.ts +35 -0
- package/eject-assets/generators/typescript/client.ts +254 -0
- package/eject-assets/generators/typescript/descriptor.ts +137 -0
- package/eject-assets/generators/typescript/index.ts +101 -0
- package/eject-assets/generators/typescript/inline-runtime.ts +135 -0
- package/eject-assets/generators/typescript/operation-signature.ts +62 -0
- package/eject-assets/generators/typescript/operation-types.ts +17 -0
- package/eject-assets/generators/typescript/operations.ts +524 -0
- package/eject-assets/generators/typescript/response-headers.ts +74 -0
- package/eject-assets/generators/typescript/type-guards.ts +159 -0
- package/eject-assets/generators/typescript/types.ts +172 -0
- package/eject-assets/generators/zod/index.ts +32 -0
- package/eject-assets/generators/zod/schemas.ts +456 -0
- package/eject-assets/skills/cli-generator/SKILL.md +121 -0
- package/eject-assets/skills/client-generators/SKILL.md +142 -0
- package/eject-assets/skills/go-generator/SKILL.md +96 -0
- package/eject-assets/skills/mock-generator/SKILL.md +50 -0
- package/eject-assets/skills/php-generator/SKILL.md +112 -0
- package/eject-assets/skills/python-generator/SKILL.md +110 -0
- package/eject-assets/skills/swr-generator/SKILL.md +50 -0
- package/eject-assets/skills/tanstack-query-generator/SKILL.md +55 -0
- package/eject-assets/skills/transformers-generator/SKILL.md +47 -0
- package/eject-assets/skills/typescript-generator/SKILL.md +95 -0
- package/eject-assets/skills/zod-generator/SKILL.md +54 -0
- package/lib/authoring/index.d.ts +11 -0
- package/lib/authoring/index.d.ts.map +1 -0
- package/lib/authoring/index.js +42 -0
- package/lib/authoring/index.js.map +1 -0
- package/lib/authoring/naming.d.ts +34 -0
- package/lib/authoring/naming.d.ts.map +1 -0
- package/lib/authoring/naming.js +104 -0
- package/lib/authoring/naming.js.map +1 -0
- package/lib/authoring/operation.d.ts +47 -0
- package/lib/authoring/operation.d.ts.map +1 -0
- package/lib/authoring/operation.js +86 -0
- package/lib/authoring/operation.js.map +1 -0
- package/lib/authoring/options.d.ts +9 -0
- package/lib/authoring/options.d.ts.map +1 -0
- package/lib/authoring/options.js +5 -0
- package/lib/authoring/options.js.map +1 -0
- package/lib/authoring/pagination.d.ts +19 -0
- package/lib/authoring/pagination.d.ts.map +1 -0
- package/lib/authoring/pagination.js +45 -0
- package/lib/authoring/pagination.js.map +1 -0
- package/lib/authoring/printer.d.ts +16 -0
- package/lib/authoring/printer.d.ts.map +1 -0
- package/lib/authoring/printer.js +36 -0
- package/lib/authoring/printer.js.map +1 -0
- package/lib/authoring/reference-page.d.ts +31 -0
- package/lib/authoring/reference-page.d.ts.map +1 -0
- package/lib/authoring/reference-page.js +160 -0
- package/lib/authoring/reference-page.js.map +1 -0
- package/lib/authoring/schema.d.ts +51 -0
- package/lib/authoring/schema.d.ts.map +1 -0
- package/lib/authoring/schema.js +190 -0
- package/lib/authoring/schema.js.map +1 -0
- package/lib/cli-contract.d.ts +126 -0
- package/lib/cli-contract.d.ts.map +1 -0
- package/lib/cli-contract.js +25 -0
- package/lib/cli-contract.js.map +1 -0
- package/lib/{emitters/wrapper-support.d.ts → contracts/typescript.d.ts} +13 -24
- package/lib/contracts/typescript.d.ts.map +1 -0
- package/lib/contracts/typescript.js +87 -0
- package/lib/contracts/typescript.js.map +1 -0
- package/lib/generate.d.ts +10 -10
- package/lib/generate.d.ts.map +1 -1
- package/lib/generate.js +25 -106
- package/lib/generate.js.map +1 -1
- package/lib/generators/cli/docs.d.ts +19 -0
- package/lib/generators/cli/docs.d.ts.map +1 -0
- package/lib/generators/cli/docs.js +187 -0
- package/lib/generators/cli/docs.js.map +1 -0
- package/lib/generators/cli/engine-source.d.ts +5 -0
- package/lib/generators/cli/engine-source.d.ts.map +1 -0
- package/lib/generators/cli/engine-source.js +12 -0
- package/lib/generators/cli/engine-source.js.map +1 -0
- package/lib/generators/cli/index.d.ts +18 -0
- package/lib/generators/cli/index.d.ts.map +1 -0
- package/lib/generators/cli/index.js +67 -0
- package/lib/generators/cli/index.js.map +1 -0
- package/lib/generators/cli/render.d.ts +39 -0
- package/lib/generators/cli/render.d.ts.map +1 -0
- package/lib/generators/cli/render.js +281 -0
- package/lib/generators/cli/render.js.map +1 -0
- package/lib/generators/cli/runtime/cli.d.ts +42 -0
- package/lib/generators/cli/runtime/cli.d.ts.map +1 -0
- package/lib/generators/cli/runtime/cli.js +582 -0
- package/lib/generators/cli/runtime/cli.js.map +1 -0
- package/lib/generators/compatibility.d.ts +10 -0
- package/lib/generators/compatibility.d.ts.map +1 -0
- package/lib/generators/compatibility.js +45 -0
- package/lib/generators/compatibility.js.map +1 -0
- package/lib/generators/go/client.d.ts +5 -0
- package/lib/generators/go/client.d.ts.map +1 -0
- package/lib/generators/go/client.js +34 -0
- package/lib/generators/go/client.js.map +1 -0
- package/lib/generators/go/descriptor.d.ts +6 -0
- package/lib/generators/go/descriptor.d.ts.map +1 -0
- package/lib/generators/go/descriptor.js +26 -0
- package/lib/generators/go/descriptor.js.map +1 -0
- package/lib/generators/go/index.d.ts +14 -0
- package/lib/generators/go/index.d.ts.map +1 -0
- package/lib/generators/go/index.js +240 -0
- package/lib/generators/go/index.js.map +1 -0
- package/lib/generators/go/models.d.ts +4 -0
- package/lib/generators/go/models.d.ts.map +1 -0
- package/lib/generators/go/models.js +125 -0
- package/lib/generators/go/models.js.map +1 -0
- package/lib/generators/go/naming.d.ts +15 -0
- package/lib/generators/go/naming.d.ts.map +1 -0
- package/lib/generators/go/naming.js +36 -0
- package/lib/generators/go/naming.js.map +1 -0
- package/lib/generators/go/operations.d.ts +16 -0
- package/lib/generators/go/operations.d.ts.map +1 -0
- package/lib/generators/go/operations.js +200 -0
- package/lib/generators/go/operations.js.map +1 -0
- package/lib/generators/go/pagination.d.ts +5 -0
- package/lib/generators/go/pagination.d.ts.map +1 -0
- package/lib/generators/go/pagination.js +93 -0
- package/lib/generators/go/pagination.js.map +1 -0
- package/lib/generators/go/types.d.ts +4 -0
- package/lib/generators/go/types.d.ts.map +1 -0
- package/lib/generators/go/types.js +48 -0
- package/lib/generators/go/types.js.map +1 -0
- package/lib/generators/index.d.ts +2 -3
- package/lib/generators/index.d.ts.map +1 -1
- package/lib/generators/index.js +31 -53
- package/lib/generators/index.js.map +1 -1
- package/lib/generators/meta.d.ts +13 -0
- package/lib/generators/meta.d.ts.map +1 -0
- package/lib/generators/meta.js +157 -0
- package/lib/generators/meta.js.map +1 -0
- package/lib/{emitters → generators/mock}/faker.d.ts +4 -5
- package/lib/generators/mock/faker.d.ts.map +1 -0
- package/lib/generators/mock/faker.js +180 -0
- package/lib/generators/mock/faker.js.map +1 -0
- package/lib/generators/{mock.d.ts → mock/index.d.ts} +2 -2
- package/lib/generators/mock/index.d.ts.map +1 -0
- package/lib/generators/{mock.js → mock/index.js} +8 -8
- package/lib/generators/mock/index.js.map +1 -0
- package/lib/{emitters/mock.d.ts → generators/mock/render.d.ts} +2 -3
- package/lib/generators/mock/render.d.ts.map +1 -0
- package/lib/generators/mock/render.js +228 -0
- package/lib/generators/mock/render.js.map +1 -0
- package/lib/{emitters → generators/mock}/sample.d.ts +1 -2
- package/lib/generators/mock/sample.d.ts.map +1 -0
- package/lib/generators/mock/sample.js.map +1 -0
- package/lib/generators/mock/values.d.ts +33 -0
- package/lib/generators/mock/values.d.ts.map +1 -0
- package/lib/generators/mock/values.js +46 -0
- package/lib/generators/mock/values.js.map +1 -0
- package/lib/generators/options.d.ts +7 -0
- package/lib/generators/options.d.ts.map +1 -0
- package/lib/generators/options.js +74 -0
- package/lib/generators/options.js.map +1 -0
- package/lib/generators/php/client.d.ts +5 -0
- package/lib/generators/php/client.d.ts.map +1 -0
- package/lib/generators/php/client.js +38 -0
- package/lib/generators/php/client.js.map +1 -0
- package/lib/generators/php/descriptor.d.ts +7 -0
- package/lib/generators/php/descriptor.d.ts.map +1 -0
- package/lib/generators/php/descriptor.js +42 -0
- package/lib/generators/php/descriptor.js.map +1 -0
- package/lib/generators/php/index.d.ts +14 -0
- package/lib/generators/php/index.d.ts.map +1 -0
- package/lib/generators/php/index.js +166 -0
- package/lib/generators/php/index.js.map +1 -0
- package/lib/generators/php/models.d.ts +8 -0
- package/lib/generators/php/models.d.ts.map +1 -0
- package/lib/generators/php/models.js +200 -0
- package/lib/generators/php/models.js.map +1 -0
- package/lib/generators/php/naming.d.ts +16 -0
- package/lib/generators/php/naming.d.ts.map +1 -0
- package/lib/generators/php/naming.js +31 -0
- package/lib/generators/php/naming.js.map +1 -0
- package/lib/generators/php/operations.d.ts +21 -0
- package/lib/generators/php/operations.d.ts.map +1 -0
- package/lib/generators/php/operations.js +156 -0
- package/lib/generators/php/operations.js.map +1 -0
- package/lib/generators/php/pagination.d.ts +5 -0
- package/lib/generators/php/pagination.d.ts.map +1 -0
- package/lib/generators/php/pagination.js +68 -0
- package/lib/generators/php/pagination.js.map +1 -0
- package/lib/generators/php/types.d.ts +27 -0
- package/lib/generators/php/types.d.ts.map +1 -0
- package/lib/generators/php/types.js +128 -0
- package/lib/generators/php/types.js.map +1 -0
- package/lib/generators/python/client.d.ts +6 -0
- package/lib/generators/python/client.d.ts.map +1 -0
- package/lib/generators/python/client.js +80 -0
- package/lib/generators/python/client.js.map +1 -0
- package/lib/generators/python/descriptor.d.ts +9 -0
- package/lib/generators/python/descriptor.d.ts.map +1 -0
- package/lib/generators/python/descriptor.js +38 -0
- package/lib/generators/python/descriptor.js.map +1 -0
- package/lib/generators/python/index.d.ts +15 -0
- package/lib/generators/python/index.d.ts.map +1 -0
- package/lib/generators/python/index.js +197 -0
- package/lib/generators/python/index.js.map +1 -0
- package/lib/generators/python/models.d.ts +31 -0
- package/lib/generators/python/models.d.ts.map +1 -0
- package/lib/generators/python/models.js +203 -0
- package/lib/generators/python/models.js.map +1 -0
- package/lib/generators/python/naming.d.ts +22 -0
- package/lib/generators/python/naming.d.ts.map +1 -0
- package/lib/generators/python/naming.js +28 -0
- package/lib/generators/python/naming.js.map +1 -0
- package/lib/generators/python/operations.d.ts +4 -0
- package/lib/generators/python/operations.d.ts.map +1 -0
- package/lib/generators/python/operations.js +108 -0
- package/lib/generators/python/operations.js.map +1 -0
- package/lib/generators/python/pagination.d.ts +5 -0
- package/lib/generators/python/pagination.d.ts.map +1 -0
- package/lib/generators/python/pagination.js +95 -0
- package/lib/generators/python/pagination.js.map +1 -0
- package/lib/generators/python/types.d.ts +4 -0
- package/lib/generators/python/types.d.ts.map +1 -0
- package/lib/generators/python/types.js +45 -0
- package/lib/generators/python/types.js.map +1 -0
- package/lib/generators/resolve.d.ts.map +1 -1
- package/lib/generators/resolve.js +92 -13
- package/lib/generators/resolve.js.map +1 -1
- package/lib/generators/{swr.d.ts → swr/index.d.ts} +3 -3
- package/lib/generators/swr/index.d.ts.map +1 -0
- package/lib/generators/{swr.js → swr/index.js} +7 -10
- package/lib/generators/swr/index.js.map +1 -0
- package/lib/{emitters/swr.d.ts → generators/swr/render.d.ts} +2 -4
- package/lib/generators/swr/render.d.ts.map +1 -0
- package/lib/generators/swr/render.js +57 -0
- package/lib/generators/swr/render.js.map +1 -0
- package/lib/generators/{tanstack-query.d.ts → tanstack-query/index.d.ts} +3 -3
- package/lib/generators/tanstack-query/index.d.ts.map +1 -0
- package/lib/generators/{tanstack-query.js → tanstack-query/index.js} +11 -10
- package/lib/generators/tanstack-query/index.js.map +1 -0
- package/lib/{emitters/tanstack-query.d.ts → generators/tanstack-query/render.d.ts} +6 -5
- package/lib/generators/tanstack-query/render.d.ts.map +1 -0
- package/lib/{emitters/tanstack-query.js → generators/tanstack-query/render.js} +33 -21
- package/lib/generators/tanstack-query/render.js.map +1 -0
- package/lib/generators/{transformers.d.ts → transformers/index.d.ts} +2 -2
- package/lib/generators/transformers/index.d.ts.map +1 -0
- package/lib/generators/{transformers.js → transformers/index.js} +11 -8
- package/lib/generators/transformers/index.js.map +1 -0
- package/lib/{emitters/transformers.d.ts → generators/transformers/render.d.ts} +2 -2
- package/lib/generators/transformers/render.d.ts.map +1 -0
- package/lib/{emitters/transformers.js → generators/transformers/render.js} +125 -165
- package/lib/generators/transformers/render.js.map +1 -0
- package/lib/generators/types.d.ts +190 -12
- package/lib/generators/types.d.ts.map +1 -1
- package/lib/generators/typescript/banner.d.ts +12 -0
- package/lib/generators/typescript/banner.d.ts.map +1 -0
- package/lib/{emitters/emit-options.js → generators/typescript/banner.js} +2 -3
- package/lib/generators/typescript/banner.js.map +1 -0
- package/lib/generators/typescript/client.d.ts +25 -0
- package/lib/generators/typescript/client.d.ts.map +1 -0
- package/lib/generators/typescript/client.js +207 -0
- package/lib/generators/typescript/client.js.map +1 -0
- package/lib/generators/typescript/descriptor.d.ts +11 -0
- package/lib/generators/typescript/descriptor.d.ts.map +1 -0
- package/lib/generators/typescript/descriptor.js +97 -0
- package/lib/generators/typescript/descriptor.js.map +1 -0
- package/lib/generators/typescript/index.d.ts +20 -0
- package/lib/generators/typescript/index.d.ts.map +1 -0
- package/lib/generators/typescript/index.js +80 -0
- package/lib/generators/typescript/index.js.map +1 -0
- package/lib/generators/typescript/inline-runtime.d.ts +21 -0
- package/lib/generators/typescript/inline-runtime.d.ts.map +1 -0
- package/lib/generators/typescript/inline-runtime.js +114 -0
- package/lib/generators/typescript/inline-runtime.js.map +1 -0
- package/lib/generators/typescript/operation-signature.d.ts +23 -0
- package/lib/generators/typescript/operation-signature.d.ts.map +1 -0
- package/lib/generators/typescript/operation-signature.js +41 -0
- package/lib/generators/typescript/operation-signature.js.map +1 -0
- package/lib/generators/typescript/operation-types.d.ts +9 -0
- package/lib/generators/typescript/operation-types.d.ts.map +1 -0
- package/lib/generators/typescript/operation-types.js +11 -0
- package/lib/generators/typescript/operation-types.js.map +1 -0
- package/lib/generators/typescript/operations.d.ts +60 -0
- package/lib/generators/typescript/operations.d.ts.map +1 -0
- package/lib/generators/typescript/operations.js +386 -0
- package/lib/generators/typescript/operations.js.map +1 -0
- package/lib/generators/typescript/response-headers.d.ts +12 -0
- package/lib/generators/typescript/response-headers.d.ts.map +1 -0
- package/lib/generators/typescript/response-headers.js +40 -0
- package/lib/generators/typescript/response-headers.js.map +1 -0
- package/lib/generators/typescript/runtime/auth.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/auth.js.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/create-client.d.ts +7 -2
- package/lib/generators/typescript/runtime/create-client.d.ts.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/create-client.js +84 -30
- package/lib/generators/typescript/runtime/create-client.js.map +1 -0
- package/lib/generators/typescript/runtime/errors.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/errors.js.map +1 -0
- package/lib/generators/typescript/runtime/index.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/index.js.map +1 -0
- package/lib/generators/typescript/runtime/multipart.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/multipart.js.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/paginate.d.ts +2 -2
- package/lib/generators/typescript/runtime/paginate.d.ts.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/paginate.js +12 -12
- package/lib/generators/typescript/runtime/paginate.js.map +1 -0
- package/lib/generators/typescript/runtime/parse.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/parse.js.map +1 -0
- package/lib/generators/typescript/runtime/retry.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/retry.js.map +1 -0
- package/lib/generators/typescript/runtime/send.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/send.js.map +1 -0
- package/lib/generators/typescript/runtime/setup.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/setup.js.map +1 -0
- package/lib/generators/typescript/runtime/sse.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/sse.js.map +1 -0
- package/lib/{runtime → generators/typescript/runtime}/types.d.ts +17 -95
- package/lib/generators/typescript/runtime/types.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/types.js.map +1 -0
- package/lib/generators/typescript/runtime/url.d.ts.map +1 -0
- package/lib/generators/typescript/runtime/url.js.map +1 -0
- package/lib/generators/typescript/type-guards.d.ts +4 -0
- package/lib/generators/typescript/type-guards.d.ts.map +1 -0
- package/lib/{emitters → generators/typescript}/type-guards.js +18 -52
- package/lib/generators/typescript/type-guards.js.map +1 -0
- package/lib/generators/typescript/types.d.ts +8 -0
- package/lib/generators/typescript/types.d.ts.map +1 -0
- package/lib/generators/typescript/types.js +132 -0
- package/lib/generators/typescript/types.js.map +1 -0
- package/lib/generators/{zod.d.ts → zod/index.d.ts} +2 -2
- package/lib/generators/zod/index.d.ts.map +1 -0
- package/lib/generators/{zod.js → zod/index.js} +5 -7
- package/lib/generators/zod/index.js.map +1 -0
- package/lib/{emitters/zod.d.ts → generators/zod/schemas.d.ts} +4 -5
- package/lib/generators/zod/schemas.d.ts.map +1 -0
- package/lib/{emitters/zod.js → generators/zod/schemas.js} +118 -154
- package/lib/generators/zod/schemas.js.map +1 -0
- package/lib/index.d.ts +8 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +18 -11
- package/lib/index.js.map +1 -1
- package/lib/intermediate-representation/build.d.ts +8 -1
- package/lib/intermediate-representation/build.d.ts.map +1 -1
- package/lib/intermediate-representation/build.js +59 -4
- package/lib/intermediate-representation/build.js.map +1 -1
- package/lib/intermediate-representation/model.d.ts +26 -1
- package/lib/intermediate-representation/model.d.ts.map +1 -1
- package/lib/intermediate-representation/model.js.map +1 -1
- package/lib/intermediate-representation/sanitize-identifiers.d.ts +1 -10
- package/lib/intermediate-representation/sanitize-identifiers.d.ts.map +1 -1
- package/lib/intermediate-representation/sanitize-identifiers.js +37 -38
- package/lib/intermediate-representation/sanitize-identifiers.js.map +1 -1
- package/lib/{emitters/pagination.d.ts → pagination.d.ts} +39 -15
- package/lib/pagination.d.ts.map +1 -0
- package/lib/{emitters/pagination.js → pagination.js} +13 -52
- package/lib/pagination.js.map +1 -0
- package/lib/pipeline.d.ts +17 -0
- package/lib/pipeline.d.ts.map +1 -0
- package/lib/pipeline.js +244 -0
- package/lib/pipeline.js.map +1 -0
- package/lib/plugin.d.ts +4 -4
- package/lib/plugin.d.ts.map +1 -1
- package/lib/plugin.js +12 -9
- package/lib/plugin.js.map +1 -1
- package/lib/printers/go.d.ts +33 -0
- package/lib/printers/go.d.ts.map +1 -0
- package/lib/printers/go.js +209 -0
- package/lib/printers/go.js.map +1 -0
- package/lib/printers/index.d.ts +5 -0
- package/lib/printers/index.d.ts.map +1 -0
- package/lib/printers/index.js +9 -0
- package/lib/printers/index.js.map +1 -0
- package/lib/printers/php.d.ts +21 -0
- package/lib/printers/php.d.ts.map +1 -0
- package/lib/printers/php.js +68 -0
- package/lib/printers/php.js.map +1 -0
- package/lib/printers/python.d.ts +31 -0
- package/lib/printers/python.d.ts.map +1 -0
- package/lib/printers/python.js +101 -0
- package/lib/printers/python.js.map +1 -0
- package/lib/printers/typescript.d.ts +82 -0
- package/lib/printers/typescript.d.ts.map +1 -0
- package/lib/printers/typescript.js +268 -0
- package/lib/printers/typescript.js.map +1 -0
- package/lib/reserved-names.d.ts +8 -0
- package/lib/reserved-names.d.ts.map +1 -0
- package/lib/{emitters/reserved-names.js → reserved-names.js} +16 -27
- package/lib/reserved-names.js.map +1 -0
- package/lib/runtime-contract.d.ts +62 -2
- package/lib/runtime-contract.d.ts.map +1 -1
- package/lib/runtime-contract.js +3 -3
- package/lib/runtime-contract.js.map +1 -1
- package/lib/runtime-sources/go.d.ts +2 -0
- package/lib/runtime-sources/go.d.ts.map +1 -0
- package/lib/runtime-sources/go.js +3 -0
- package/lib/runtime-sources/go.js.map +1 -0
- package/lib/runtime-sources/php.d.ts +2 -0
- package/lib/runtime-sources/php.d.ts.map +1 -0
- package/lib/runtime-sources/php.js +3 -0
- package/lib/runtime-sources/php.js.map +1 -0
- package/lib/runtime-sources/python.d.ts +12 -0
- package/lib/runtime-sources/python.d.ts.map +1 -0
- package/lib/runtime-sources/python.js +12 -0
- package/lib/runtime-sources/python.js.map +1 -0
- package/lib/runtime-sources/typescript.d.ts +36 -0
- package/lib/runtime-sources/typescript.d.ts.map +1 -0
- package/lib/runtime-sources/typescript.js +152 -0
- package/lib/runtime-sources/typescript.js.map +1 -0
- package/lib/runtime-sources.d.ts +5 -0
- package/lib/runtime-sources.d.ts.map +1 -0
- package/lib/runtime-sources.js +10 -0
- package/lib/runtime-sources.js.map +1 -0
- package/lib/setup-bake.d.ts.map +1 -0
- package/lib/{emitters/setup-bake.js → setup-bake.js} +11 -2
- package/lib/setup-bake.js.map +1 -0
- package/lib/types.d.ts +38 -8
- package/lib/types.d.ts.map +1 -1
- package/package.json +40 -4
- package/lib/emitters/auth.d.ts +0 -14
- package/lib/emitters/auth.d.ts.map +0 -1
- package/lib/emitters/auth.js +0 -30
- package/lib/emitters/auth.js.map +0 -1
- package/lib/emitters/client-assembly.d.ts +0 -15
- package/lib/emitters/client-assembly.d.ts.map +0 -1
- package/lib/emitters/client-assembly.js +0 -358
- package/lib/emitters/client-assembly.js.map +0 -1
- package/lib/emitters/descriptor.d.ts +0 -22
- package/lib/emitters/descriptor.d.ts.map +0 -1
- package/lib/emitters/descriptor.js +0 -199
- package/lib/emitters/descriptor.js.map +0 -1
- package/lib/emitters/emit-options.d.ts +0 -67
- package/lib/emitters/emit-options.d.ts.map +0 -1
- package/lib/emitters/emit-options.js.map +0 -1
- package/lib/emitters/faker.d.ts.map +0 -1
- package/lib/emitters/faker.js +0 -221
- package/lib/emitters/faker.js.map +0 -1
- package/lib/emitters/identifier.d.ts +0 -34
- package/lib/emitters/identifier.d.ts.map +0 -1
- package/lib/emitters/identifier.js +0 -104
- package/lib/emitters/identifier.js.map +0 -1
- package/lib/emitters/inline-runtime.d.ts +0 -11
- package/lib/emitters/inline-runtime.d.ts.map +0 -1
- package/lib/emitters/inline-runtime.js +0 -99
- package/lib/emitters/inline-runtime.js.map +0 -1
- package/lib/emitters/jsdoc.d.ts +0 -9
- package/lib/emitters/jsdoc.d.ts.map +0 -1
- package/lib/emitters/jsdoc.js +0 -83
- package/lib/emitters/jsdoc.js.map +0 -1
- package/lib/emitters/mock.d.ts.map +0 -1
- package/lib/emitters/mock.js +0 -265
- package/lib/emitters/mock.js.map +0 -1
- package/lib/emitters/operation-aliases.d.ts +0 -27
- package/lib/emitters/operation-aliases.d.ts.map +0 -1
- package/lib/emitters/operation-aliases.js +0 -150
- package/lib/emitters/operation-aliases.js.map +0 -1
- package/lib/emitters/operation-signature.d.ts +0 -24
- package/lib/emitters/operation-signature.d.ts.map +0 -1
- package/lib/emitters/operation-signature.js +0 -42
- package/lib/emitters/operation-signature.js.map +0 -1
- package/lib/emitters/operation-types.d.ts +0 -32
- package/lib/emitters/operation-types.d.ts.map +0 -1
- package/lib/emitters/operation-types.js +0 -117
- package/lib/emitters/operation-types.js.map +0 -1
- package/lib/emitters/operations.d.ts +0 -41
- package/lib/emitters/operations.d.ts.map +0 -1
- package/lib/emitters/operations.js +0 -35
- package/lib/emitters/operations.js.map +0 -1
- package/lib/emitters/pagination.d.ts.map +0 -1
- package/lib/emitters/pagination.js.map +0 -1
- package/lib/emitters/reserved-names.d.ts +0 -5
- package/lib/emitters/reserved-names.d.ts.map +0 -1
- package/lib/emitters/reserved-names.js.map +0 -1
- package/lib/emitters/response-headers.d.ts +0 -14
- package/lib/emitters/response-headers.d.ts.map +0 -1
- package/lib/emitters/response-headers.js +0 -91
- package/lib/emitters/response-headers.js.map +0 -1
- package/lib/emitters/runtime-sources.d.ts +0 -16
- package/lib/emitters/runtime-sources.d.ts.map +0 -1
- package/lib/emitters/runtime-sources.js +0 -16
- package/lib/emitters/runtime-sources.js.map +0 -1
- package/lib/emitters/sample.d.ts.map +0 -1
- package/lib/emitters/sample.js.map +0 -1
- package/lib/emitters/setup-bake.d.ts.map +0 -1
- package/lib/emitters/setup-bake.js.map +0 -1
- package/lib/emitters/sse.d.ts +0 -10
- package/lib/emitters/sse.d.ts.map +0 -1
- package/lib/emitters/sse.js +0 -46
- package/lib/emitters/sse.js.map +0 -1
- package/lib/emitters/support.d.ts +0 -18
- package/lib/emitters/support.d.ts.map +0 -1
- package/lib/emitters/support.js +0 -37
- package/lib/emitters/support.js.map +0 -1
- package/lib/emitters/swr.d.ts.map +0 -1
- package/lib/emitters/swr.js +0 -88
- package/lib/emitters/swr.js.map +0 -1
- package/lib/emitters/tanstack-query.d.ts.map +0 -1
- package/lib/emitters/tanstack-query.js.map +0 -1
- package/lib/emitters/transformers.d.ts.map +0 -1
- package/lib/emitters/transformers.js.map +0 -1
- package/lib/emitters/ts.d.ts +0 -42
- package/lib/emitters/ts.d.ts.map +0 -1
- package/lib/emitters/ts.js +0 -116
- package/lib/emitters/ts.js.map +0 -1
- package/lib/emitters/type-guards.d.ts +0 -21
- package/lib/emitters/type-guards.d.ts.map +0 -1
- package/lib/emitters/type-guards.js.map +0 -1
- package/lib/emitters/types.d.ts +0 -15
- package/lib/emitters/types.d.ts.map +0 -1
- package/lib/emitters/types.js +0 -125
- package/lib/emitters/types.js.map +0 -1
- package/lib/emitters/wrapper-support.d.ts.map +0 -1
- package/lib/emitters/wrapper-support.js +0 -127
- package/lib/emitters/wrapper-support.js.map +0 -1
- package/lib/emitters/zod.d.ts.map +0 -1
- package/lib/emitters/zod.js.map +0 -1
- package/lib/generators/anchor.d.ts +0 -9
- package/lib/generators/anchor.d.ts.map +0 -1
- package/lib/generators/anchor.js +0 -10
- package/lib/generators/anchor.js.map +0 -1
- package/lib/generators/mock.d.ts.map +0 -1
- package/lib/generators/mock.js.map +0 -1
- package/lib/generators/sdk.d.ts +0 -12
- package/lib/generators/sdk.d.ts.map +0 -1
- package/lib/generators/sdk.js +0 -26
- package/lib/generators/sdk.js.map +0 -1
- package/lib/generators/swr.d.ts.map +0 -1
- package/lib/generators/swr.js.map +0 -1
- package/lib/generators/tanstack-query.d.ts.map +0 -1
- package/lib/generators/tanstack-query.js.map +0 -1
- package/lib/generators/transformers.d.ts.map +0 -1
- package/lib/generators/transformers.js.map +0 -1
- package/lib/generators/zod.d.ts.map +0 -1
- package/lib/generators/zod.js.map +0 -1
- package/lib/runtime/auth.d.ts.map +0 -1
- package/lib/runtime/auth.js.map +0 -1
- package/lib/runtime/create-client.d.ts.map +0 -1
- package/lib/runtime/create-client.js.map +0 -1
- package/lib/runtime/errors.d.ts.map +0 -1
- package/lib/runtime/errors.js.map +0 -1
- package/lib/runtime/index.d.ts.map +0 -1
- package/lib/runtime/index.js.map +0 -1
- package/lib/runtime/multipart.d.ts.map +0 -1
- package/lib/runtime/multipart.js.map +0 -1
- package/lib/runtime/paginate.d.ts.map +0 -1
- package/lib/runtime/paginate.js.map +0 -1
- package/lib/runtime/parse.d.ts.map +0 -1
- package/lib/runtime/parse.js.map +0 -1
- package/lib/runtime/retry.d.ts.map +0 -1
- package/lib/runtime/retry.js.map +0 -1
- package/lib/runtime/send.d.ts.map +0 -1
- package/lib/runtime/send.js.map +0 -1
- package/lib/runtime/setup.d.ts.map +0 -1
- package/lib/runtime/setup.js.map +0 -1
- package/lib/runtime/sse.d.ts.map +0 -1
- package/lib/runtime/sse.js.map +0 -1
- package/lib/runtime/types.d.ts.map +0 -1
- package/lib/runtime/types.js.map +0 -1
- package/lib/runtime/url.d.ts.map +0 -1
- package/lib/runtime/url.js.map +0 -1
- /package/lib/{emitters → generators/mock}/sample.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/auth.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/auth.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/errors.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/errors.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/index.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/index.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/multipart.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/multipart.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/parse.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/parse.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/retry.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/retry.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/send.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/send.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/setup.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/setup.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/sse.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/sse.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/types.js +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/url.d.ts +0 -0
- /package/lib/{runtime → generators/typescript/runtime}/url.js +0 -0
- /package/lib/{emitters/setup-bake.d.ts → setup-bake.d.ts} +0 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// The `operations` stage: one typed request method per operation (sync and async),
|
|
2
|
+
// with the optional `_with_headers` envelope variant.
|
|
3
|
+
import { isMultipartBody, jsonSuccessSchema, sseResponse, uniqueIdentifiers, } from '@redocly/client-generator';
|
|
4
|
+
import { envelopeHeaderSpecs } from "./descriptor.js";
|
|
5
|
+
import { METHOD_ARG_SLOTS, naming, PY } from "./naming.js";
|
|
6
|
+
import { pythonType } from "./types.js";
|
|
7
|
+
export function writeMethod(printer, op, ident, errorMode, isAsync, dateType, model, envelope = false) {
|
|
8
|
+
// Every parameter is a separate argument, so path and query names share one namespace
|
|
9
|
+
// with the slots this method declares itself. `uniqueIdentifiers` moves a repeat aside
|
|
10
|
+
// (`id`, `id_2`) — a description may legally use one name in two locations, and a
|
|
11
|
+
// signature that declared it twice would not even parse.
|
|
12
|
+
const argNames = uniqueIdentifiers([...op.pathParams, ...op.queryParams].map((param) => param.name), { style: 'snake', reserved: PY, taken: METHOD_ARG_SLOTS });
|
|
13
|
+
const pathArgs = op.pathParams.map((param, index) => ({ param, python: argNames[index] }));
|
|
14
|
+
const queryArgs = op.queryParams.map((param, index) => ({
|
|
15
|
+
param,
|
|
16
|
+
python: argNames[op.pathParams.length + index],
|
|
17
|
+
}));
|
|
18
|
+
const positional = pathArgs.map(({ param, python }) => `${python}: ${pythonType(param.schema, dateType)}`);
|
|
19
|
+
const bodyArg = op.requestBody ? [`body: ${pythonType(op.requestBody.schema, dateType)}`] : [];
|
|
20
|
+
const kwargs = [
|
|
21
|
+
...queryArgs.map(({ param, python }) => {
|
|
22
|
+
const annotation = pythonType(param.schema, dateType);
|
|
23
|
+
const optional = annotation.startsWith('Optional[') ? annotation : `Optional[${annotation}]`;
|
|
24
|
+
return `${python}: ${optional} = None`;
|
|
25
|
+
}),
|
|
26
|
+
'headers: Optional[Dict[str, str]] = None',
|
|
27
|
+
'timeout: Optional[float] = None',
|
|
28
|
+
'retry: Optional[Dict[str, Any]] = None',
|
|
29
|
+
'idempotency_key: Any = None',
|
|
30
|
+
];
|
|
31
|
+
const success = jsonSuccessSchema(op);
|
|
32
|
+
const sse = sseResponse(op);
|
|
33
|
+
const returns = envelope
|
|
34
|
+
? `Envelope[${success === undefined ? 'None' : pythonType(success, dateType)}]`
|
|
35
|
+
: sse !== undefined
|
|
36
|
+
? `${isAsync ? 'AsyncIterator' : 'Iterator'}[ServerSentEvent]`
|
|
37
|
+
: errorMode === 'result'
|
|
38
|
+
? 'Result'
|
|
39
|
+
: success === undefined
|
|
40
|
+
? 'None'
|
|
41
|
+
: pythonType(success, dateType);
|
|
42
|
+
// Streaming methods are plain defs returning an (async) iterator — an `async def`
|
|
43
|
+
// would force awaiting the call before iterating it.
|
|
44
|
+
const prefix = isAsync && sse === undefined ? 'async def' : 'def';
|
|
45
|
+
const awaitKw = isAsync ? 'await ' : '';
|
|
46
|
+
const sendFn = isAsync ? 'send_async' : 'send';
|
|
47
|
+
const signature = ['self', ...positional, ...bodyArg, '*', ...kwargs].join(', ');
|
|
48
|
+
const defName = envelope ? `${ident}_with_headers` : ident;
|
|
49
|
+
printer.block(`${prefix} ${defName}(${signature}) -> ${returns}:`, () => {
|
|
50
|
+
printer.doc(envelope
|
|
51
|
+
? `Like ${ident}(), returning an Envelope with the declared response headers.`
|
|
52
|
+
: op.summary);
|
|
53
|
+
printer.line(`op = _OPERATIONS["${ident}"]`);
|
|
54
|
+
printer.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)');
|
|
55
|
+
printer.line('params: Dict[str, Any] = dict(auth_query)');
|
|
56
|
+
for (const { param, python } of queryArgs) {
|
|
57
|
+
printer.block(`if ${python} is not None:`, () => {
|
|
58
|
+
printer.line(`params[${naming.string(param.name)}] = encode(${python})`);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const pathDict = pathArgs
|
|
62
|
+
.map(({ param, python }) => `${naming.string(param.name)}: ${python}`)
|
|
63
|
+
.join(', ');
|
|
64
|
+
printer.line(`url = build_url(self._server_url, op["path"], {${pathDict}})`);
|
|
65
|
+
if (sse !== undefined) {
|
|
66
|
+
const dataKind = sse.schema !== undefined && sse.schema.kind !== 'unknown' ? 'json' : 'text';
|
|
67
|
+
printer.block('def _open(extra_headers: Dict[str, str]):', () => {
|
|
68
|
+
printer.line('return self._http.stream(op["method"], url, ' +
|
|
69
|
+
'headers={**auth_headers, **(headers or {}), **extra_headers}, params=params, timeout=timeout)');
|
|
70
|
+
});
|
|
71
|
+
printer.line(`return ${isAsync ? 'aiter_sse' : 'iter_sse'}(_open, data_kind="${dataKind}")`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (isMultipartBody(op))
|
|
75
|
+
printer.line('form_data, form_files = to_multipart(body)');
|
|
76
|
+
const bodyKw = op.requestBody
|
|
77
|
+
? isMultipartBody(op)
|
|
78
|
+
? ', data=form_data, files=form_files'
|
|
79
|
+
: ', json_body=encode(body)'
|
|
80
|
+
: '';
|
|
81
|
+
printer.line(`response = ${awaitKw}${sendFn}(self._http, self._config, op, url, method=op["method"], ` +
|
|
82
|
+
`headers={**auth_headers, **(headers or {})}, params=params${bodyKw}, ` +
|
|
83
|
+
'timeout=timeout, retry=retry, idempotency_key=idempotency_key)');
|
|
84
|
+
const decoded = success === undefined
|
|
85
|
+
? 'None'
|
|
86
|
+
: `decode(${pythonType(success, dateType)}, _safe_json(response))`;
|
|
87
|
+
if (envelope) {
|
|
88
|
+
printer.block('if not response.is_success:', () => {
|
|
89
|
+
printer.line('raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))');
|
|
90
|
+
});
|
|
91
|
+
printer.line(`return Envelope(data=${decoded}, headers=read_envelope_headers(response, ${envelopeHeaderSpecs(op, model)}), response=response)`);
|
|
92
|
+
}
|
|
93
|
+
else if (errorMode === 'result') {
|
|
94
|
+
printer.block('if not response.is_success:', () => {
|
|
95
|
+
printer.line('return Result(data=None, error=_safe_json(response), response=response)');
|
|
96
|
+
});
|
|
97
|
+
printer.line(`return Result(data=${decoded}, error=None, response=response)`);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
printer.block('if not response.is_success:', () => {
|
|
101
|
+
printer.line('raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))');
|
|
102
|
+
});
|
|
103
|
+
printer.line(success === undefined ? 'return None' : `return ${decoded}`);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
printer.blank();
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/generators/python/operations.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,sDAAsD;AAEtD,OAAO,EAGL,eAAe,EACf,iBAAiB,EAEjB,WAAW,EACX,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,UAAU,WAAW,CACzB,OAAsB,EACtB,EAAkB,EAClB,KAAa,EACb,SAA6B,EAC7B,OAAgB,EAChB,QAAkB,EA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AmB,CAAC,EAAE,EAAE,KAAM,CAAC,uBAAuB,CACnI,CAAC;QACJ,CAAC;aAAM,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;YAClC,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,EAAE;gBAChD,OAAO,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;YAC1F,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,sBAAsB,OAAO,kCAAkC,CAAC,CAAC;QAChF,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,EAAE;gBAChD,OAAO,CAAC,IAAI,CACV,yFAAyF,CAC1F,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DateType, type OperationModel } from '@redocly/client-generator';
|
|
2
|
+
import type { PythonPrinter } from '@redocly/client-generator/printers/python';
|
|
3
|
+
/** `<ident>_pages` / `<ident>_items` iterator methods for a paginated operation. */
|
|
4
|
+
export declare function writePaginationWrappers(printer: PythonPrinter, op: OperationModel, ident: string, isAsync: boolean, itemType: string, dateType: DateType): void;
|
|
5
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../src/generators/python/pagination.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,cAAc,EAEpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2CAA2C,CAAC;AAK/E,oFAAoF;AACpF,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,aAAa,EACtB,EAAE,EAAE,cAAc,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB,IAAI,CAqGN"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// The `pagination` stage: `<ident>_pages` / `<ident>_items` iterator methods for
|
|
2
|
+
// paginated operations, sync and async.
|
|
3
|
+
import { jsonSuccessSchema, uniqueIdentifiers, } from '@redocly/client-generator';
|
|
4
|
+
import { METHOD_ARG_SLOTS, naming, PY } from "./naming.js";
|
|
5
|
+
import { pythonType } from "./types.js";
|
|
6
|
+
/** `<ident>_pages` / `<ident>_items` iterator methods for a paginated operation. */
|
|
7
|
+
export function writePaginationWrappers(printer, op, ident, isAsync, itemType, dateType) {
|
|
8
|
+
const success = jsonSuccessSchema(op);
|
|
9
|
+
const pageType = success === undefined ? 'Any' : pythonType(success, dateType);
|
|
10
|
+
// The iterators take the same arguments as the operation itself, computed the same way,
|
|
11
|
+
// so a name the method moved aside (`id_2`) is the same name here — copying a call from
|
|
12
|
+
// one to the other has to keep working. Path values are substituted, not dropped.
|
|
13
|
+
const argNames = uniqueIdentifiers([...op.pathParams, ...op.queryParams].map((param) => param.name), { style: 'snake', reserved: PY, taken: METHOD_ARG_SLOTS });
|
|
14
|
+
const pathArgs = op.pathParams.map((param, index) => ({ param, python: argNames[index] }));
|
|
15
|
+
const queryArgs = op.queryParams.map((param, index) => ({
|
|
16
|
+
param,
|
|
17
|
+
python: argNames[op.pathParams.length + index],
|
|
18
|
+
}));
|
|
19
|
+
const positional = pathArgs.map(({ param, python }) => `${python}: ${pythonType(param.schema, dateType)}`);
|
|
20
|
+
const kwargs = [
|
|
21
|
+
...queryArgs.map(({ param, python }) => {
|
|
22
|
+
const annotation = pythonType(param.schema, dateType);
|
|
23
|
+
const optional = annotation.startsWith('Optional[') ? annotation : `Optional[${annotation}]`;
|
|
24
|
+
return `${python}: ${optional} = None`;
|
|
25
|
+
}),
|
|
26
|
+
'headers: Optional[Dict[str, str]] = None',
|
|
27
|
+
'timeout: Optional[float] = None',
|
|
28
|
+
'retry: Optional[Dict[str, Any]] = None',
|
|
29
|
+
];
|
|
30
|
+
const signature = ['self', ...positional, '*', ...kwargs].join(', ');
|
|
31
|
+
const iterType = isAsync ? 'AsyncIterator' : 'Iterator';
|
|
32
|
+
const pagesFn = isAsync ? 'aiter_pages' : 'iter_pages';
|
|
33
|
+
const itemsFn = isAsync ? 'aiter_items' : 'iter_items';
|
|
34
|
+
const writeCallClosure = () => {
|
|
35
|
+
printer.line('base: Dict[str, Any] = {}');
|
|
36
|
+
for (const { param, python } of queryArgs) {
|
|
37
|
+
printer.block(`if ${python} is not None:`, () => {
|
|
38
|
+
printer.line(`base[${naming.string(param.name)}] = encode(${python})`);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const prefix = isAsync ? 'async def' : 'def';
|
|
42
|
+
const awaitKw = isAsync ? 'await ' : '';
|
|
43
|
+
printer.block(`${prefix} _page(page_params: Dict[str, Any]) -> Tuple[Any, Any]:`, () => {
|
|
44
|
+
printer.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)');
|
|
45
|
+
const pathDict = pathArgs
|
|
46
|
+
.map(({ param, python }) => `${naming.string(param.name)}: ${python}`)
|
|
47
|
+
.join(', ');
|
|
48
|
+
printer.line(`url = build_url(self._server_url, op["path"], {${pathDict}})`);
|
|
49
|
+
printer.line(`response = ${awaitKw}${isAsync ? 'send_async' : 'send'}(self._http, self._config, op, url, method=op["method"], ` +
|
|
50
|
+
'headers={**auth_headers, **(headers or {})}, params={**page_params, **auth_query}, ' +
|
|
51
|
+
'timeout=timeout, retry=retry)');
|
|
52
|
+
printer.block('if not response.is_success:', () => {
|
|
53
|
+
printer.line('raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))');
|
|
54
|
+
});
|
|
55
|
+
printer.line('return _safe_json(response), response');
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
// pages: raw page JSON decoded into the page model per page.
|
|
59
|
+
if (isAsync) {
|
|
60
|
+
printer.block(`async def ${ident}_pages(${signature}) -> ${iterType}[${pageType}]:`, () => {
|
|
61
|
+
printer.line(`op = _OPERATIONS["${ident}"]`);
|
|
62
|
+
writeCallClosure();
|
|
63
|
+
printer.block(`async for page in ${pagesFn}(_page, op["pagination"], base):`, () => {
|
|
64
|
+
printer.line(pageType === 'Any' ? 'yield page' : `yield decode(${pageType}, page)`);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
printer.blank();
|
|
68
|
+
printer.block(`async def ${ident}_items(${signature}) -> ${iterType}[${itemType}]:`, () => {
|
|
69
|
+
printer.line(`op = _OPERATIONS["${ident}"]`);
|
|
70
|
+
writeCallClosure();
|
|
71
|
+
printer.block(`async for item in ${itemsFn}(_page, op["pagination"], base):`, () => {
|
|
72
|
+
printer.line(itemType === 'Any' ? 'yield item' : `yield decode(${itemType}, item)`);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
printer.block(`def ${ident}_pages(${signature}) -> ${iterType}[${pageType}]:`, () => {
|
|
78
|
+
printer.line(`op = _OPERATIONS["${ident}"]`);
|
|
79
|
+
writeCallClosure();
|
|
80
|
+
printer.line(pageType === 'Any'
|
|
81
|
+
? `return ${pagesFn}(_page, op["pagination"], base)`
|
|
82
|
+
: `return (decode(${pageType}, page) for page in ${pagesFn}(_page, op["pagination"], base))`);
|
|
83
|
+
});
|
|
84
|
+
printer.blank();
|
|
85
|
+
printer.block(`def ${ident}_items(${signature}) -> ${iterType}[${itemType}]:`, () => {
|
|
86
|
+
printer.line(`op = _OPERATIONS["${ident}"]`);
|
|
87
|
+
writeCallClosure();
|
|
88
|
+
printer.line(itemType === 'Any'
|
|
89
|
+
? `return ${itemsFn}(_page, op["pagination"], base)`
|
|
90
|
+
: `return (decode(${itemType}, item) for item in ${itemsFn}(_page, op["pagination"], base))`);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
printer.blank();
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../src/generators/python/pagination.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,wCAAwC;AAExC,OAAO,EAEL,iBAAiB,EAEjB,iBAAiB,GAClB,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,oFAAoF;AACpF,MAAM,UAAU,uBAAuB,CACrC,OAAsB,EACtB,EAAkB,EAClB,KAAa,EACb,OAAgB,EAChB,QAAgB,EAChB,QAAkB;IAElB,MAAM,OAAO,GAAG,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC/E,wFAAwF;IACxF,wFAAwF;IACxF,kFAAkF;IAClF,MAAM,QAAQ,GAAG,iBAAiB,CAChC,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAChE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,CAC1D,CAAC;IACF,MAAM,QAAQ,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ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AE;YAClF,OAAO,CAAC,IAAI,CAAC,qBAAqB,KAAK,IAAI,CAAC,CAAC;YAC7C,gBAAgB,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CACV,QAAQ,KAAK,KAAK;gBAChB,CAAC,CAAC,UAAU,OAAO,iCAAiC;gBACpD,CAAC,CAAC,kBAAkB,QAAQ,uBAAuB,OAAO,kCAAkC,CAC/F,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,OAAO,KAAK,UAAU,SAAS,QAAQ,QAAQ,IAAI,QAAQ,IAAI,EAAE,GAAG,EAAE;YAClF,OAAO,CAAC,IAAI,CAAC,qBAAqB,KAAK,IAAI,CAAC,CAAC;YAC7C,gBAAgB,EAAE,CAAC;YACnB,OAAO,CAAC,IAAI,CACV,QAAQ,KAAK,KAAK;gBAChB,CAAC,CAAC,UAAU,OAAO,iCAAiC;gBACpD,CAAC,CAAC,kBAAkB,QAAQ,uBAAuB,OAAO,kCAAkC,CAC/F,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,KAAK,EAAE,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type DateType, type SchemaModel } from '@redocly/client-generator';
|
|
2
|
+
/** The Python type annotation for a schema (anonymous complex shapes collapse to Any-ish). */
|
|
3
|
+
export declare function pythonType(schema: SchemaModel, dateType?: DateType): string;
|
|
4
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/generators/python/types.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,WAAW,EAEjB,MAAM,2BAA2B,CAAC;AAInC,8FAA8F;AAC9F,wBAAgB,UAAU,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAE,QAAmB,GAAG,MAAM,CAqCrF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// The `types` stage: schema → Python type annotation.
|
|
2
|
+
import { isNullable, unwrapNullable, } from '@redocly/client-generator';
|
|
3
|
+
import { className, naming } from "./naming.js";
|
|
4
|
+
/** The Python type annotation for a schema (anonymous complex shapes collapse to Any-ish). */
|
|
5
|
+
export function pythonType(schema, dateType = 'string') {
|
|
6
|
+
if (isNullable(schema)) {
|
|
7
|
+
return `Optional[${pythonType(unwrapNullable(schema), dateType)}]`;
|
|
8
|
+
}
|
|
9
|
+
switch (schema.kind) {
|
|
10
|
+
case 'scalar':
|
|
11
|
+
// `dateType: Date` annotates date/date-time as stdlib objects; `_decode.py`
|
|
12
|
+
// converts them from and to ISO strings on the wire.
|
|
13
|
+
if (dateType === 'Date' && schema.scalar === 'string') {
|
|
14
|
+
if (schema.metadata?.format === 'date-time')
|
|
15
|
+
return 'datetime';
|
|
16
|
+
if (schema.metadata?.format === 'date')
|
|
17
|
+
return 'date';
|
|
18
|
+
}
|
|
19
|
+
return { string: 'str', integer: 'int', number: 'float', boolean: 'bool' }[schema.scalar];
|
|
20
|
+
case 'array':
|
|
21
|
+
return `List[${pythonType(schema.items, dateType)}]`;
|
|
22
|
+
case 'record':
|
|
23
|
+
return `Dict[str, ${pythonType(schema.value, dateType)}]`;
|
|
24
|
+
case 'ref':
|
|
25
|
+
return className(schema.name);
|
|
26
|
+
case 'literal':
|
|
27
|
+
return `Literal[${naming.literal(schema.value)}]`;
|
|
28
|
+
case 'enum':
|
|
29
|
+
// Anonymous (inline) enums keep the wire scalar; only NAMED enums get classes.
|
|
30
|
+
return { string: 'str', integer: 'int', number: 'float', boolean: 'bool' }[schema.scalar];
|
|
31
|
+
case 'union':
|
|
32
|
+
return `Union[${schema.members.map((member) => pythonType(member, dateType)).join(', ')}]`;
|
|
33
|
+
case 'null':
|
|
34
|
+
return 'None';
|
|
35
|
+
case 'omit':
|
|
36
|
+
// Python has no Omit; the base class is the honest annotation (readOnly
|
|
37
|
+
// fields are server-managed and simply absent on requests).
|
|
38
|
+
return className(schema.base);
|
|
39
|
+
case 'object':
|
|
40
|
+
case 'intersection':
|
|
41
|
+
case 'unknown':
|
|
42
|
+
return 'Any';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/generators/python/types.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAEtD,OAAO,EAEL,UAAU,EAEV,cAAc,GACf,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEhD,8FAA8F;AAC9F,MAAM,UAAU,UAAU,CAAC,MAAmB,EAAE,WAAqB,QAAQ;IAC3E,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACvB,OAAO,YAAY,UAAU,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC;IACrE,CAAC;IACD,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,QAAQ;YACX,4EAA4E;YAC5E,qDAAqD;YACrD,IAAI,QAAQ,KAAK,MAAM,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACtD,IAAI,MAAM,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW;oBAAE,OAAO,UAAU,CAAC;gBAC/D,IAAI,MAAM,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM;oBAAE,OAAO,MAAM,CAAC;YACxD,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5F,KAAK,OAAO;YACV,OAAO,QAAQ,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;QACvD,KAAK,QAAQ;YACX,OAAO,aAAa,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;QAC5D,KAAK,KAAK;YACR,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChC,KAAK,SAAS;YACZ,OAAO,WAAW,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QACpD,KAAK,MAAM;YACT,+EAA+E;YAC/E,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5F,KAAK,OAAO;YACV,OAAO,SAAS,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QAC7F,KAAK,MAAM;YACT,OAAO,MAAM,CAAC;QAChB,KAAK,MAAM;YACT,wEAAwE;YACxE,4DAA4D;YAC5D,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAChC,KAAK,QAAQ,CAAC;QACd,KAAK,cAAc,CAAC;QACpB,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/generators/resolve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/generators/resolve.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,kDAAkD;IAClD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,gFAAgF;IAChF,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,yGAAyG;IACzG,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,mGAAmG;IACnG,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,GAAE,cAAmB,GAC3B,OAAO,CAAC,kBAAkB,CAAC,CAkC7B"}
|
|
@@ -4,31 +4,82 @@
|
|
|
4
4
|
// already-registered custom name is dynamically `import()`ed (a standard Node ESM dynamic import), its
|
|
5
5
|
// default (or `generator`) export validated, and registered under its declared name. Built-ins are
|
|
6
6
|
// seeded fresh per call (see `builtinGenerators`), so registration never mutates the built-in table.
|
|
7
|
-
|
|
7
|
+
var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
|
|
8
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
9
|
+
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
|
|
10
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return path;
|
|
14
|
+
};
|
|
15
|
+
import { isAbsoluteUrl, isPlainObject, logger } from '@redocly/openapi-core';
|
|
8
16
|
import { isAbsolute, resolve as resolvePath } from 'node:path';
|
|
9
17
|
import { pathToFileURL } from 'node:url';
|
|
10
18
|
import { NotSupportedError } from '../errors.js';
|
|
11
|
-
import {
|
|
19
|
+
import { GENERATOR_VERSION, satisfiesGeneratorRange } from './compatibility.js';
|
|
20
|
+
import { BUILTIN_META } from './meta.js';
|
|
12
21
|
/**
|
|
13
22
|
* Build the run list + registry for a `generators` selection. Each entry is, in order of preference,
|
|
14
23
|
* a built-in name, an already-registered custom name, or an import specifier (path or package).
|
|
15
24
|
*/
|
|
16
25
|
export async function resolveGenerators(entries, options = {}) {
|
|
17
|
-
|
|
26
|
+
// Built-ins are loaded lazily through BUILTIN_META so a selection without a
|
|
27
|
+
// TypeScript-emitting generator never loads the `typescript` package.
|
|
28
|
+
const registry = new Map();
|
|
18
29
|
for (const custom of options.customGenerators ?? [])
|
|
19
30
|
register(registry, custom);
|
|
20
|
-
|
|
31
|
+
// Load every selected entry first: an import specifier's declared name and `requires`
|
|
32
|
+
// are only known once it is imported, and an ejected generator carries the same
|
|
33
|
+
// `requires` as the built-in it replaces.
|
|
34
|
+
const names = [];
|
|
21
35
|
for (const entry of entries) {
|
|
22
|
-
|
|
23
|
-
selected.push(entry);
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
const custom = await importGenerator(entry, options.configDir ?? process.cwd());
|
|
27
|
-
register(registry, custom);
|
|
28
|
-
selected.push(custom.name);
|
|
36
|
+
names.push(await loadEntry(entry, registry, options.configDir));
|
|
29
37
|
}
|
|
38
|
+
// A prerequisite is pulled in rather than demanded: selecting `cli` should give a
|
|
39
|
+
// working CLI without the user knowing which other generators provide its parts.
|
|
40
|
+
const selected = [];
|
|
41
|
+
const visiting = new Set();
|
|
42
|
+
const add = async (name) => {
|
|
43
|
+
if (selected.includes(name) || visiting.has(name))
|
|
44
|
+
return;
|
|
45
|
+
visiting.add(name);
|
|
46
|
+
for (const required of registry.get(name).requires ?? []) {
|
|
47
|
+
// Only pull in a prerequisite we know how to load — an already-registered
|
|
48
|
+
// generator or a built-in. Anything else stays the user's problem and is
|
|
49
|
+
// reported by `validateSelection`.
|
|
50
|
+
if (registry.has(required) || required in BUILTIN_META) {
|
|
51
|
+
await add(await loadEntry(required, registry, options.configDir));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
visiting.delete(name);
|
|
55
|
+
selected.push(name);
|
|
56
|
+
};
|
|
57
|
+
for (const name of names)
|
|
58
|
+
await add(name);
|
|
30
59
|
return { selected, registry };
|
|
31
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Load one entry — an already-registered name, a built-in name, or an import specifier —
|
|
63
|
+
* into the registry, and return the name it is registered under.
|
|
64
|
+
*/
|
|
65
|
+
async function loadEntry(entry, registry, configDir) {
|
|
66
|
+
if (registry.has(entry))
|
|
67
|
+
return entry;
|
|
68
|
+
const meta = BUILTIN_META[entry];
|
|
69
|
+
if (meta !== undefined) {
|
|
70
|
+
const { load, ...compatibility } = meta;
|
|
71
|
+
registry.set(entry, { ...compatibility, ...(await load()) });
|
|
72
|
+
return entry;
|
|
73
|
+
}
|
|
74
|
+
// Without this, the old name falls through to `import('sdk')` and fails with a
|
|
75
|
+
// module-load error that hides the rename.
|
|
76
|
+
if (entry === 'sdk') {
|
|
77
|
+
throw new NotSupportedError('The "sdk" generator is now named "typescript". Update the `generators` list or the --generator flag.');
|
|
78
|
+
}
|
|
79
|
+
const custom = await importGenerator(entry, configDir ?? process.cwd());
|
|
80
|
+
register(registry, custom);
|
|
81
|
+
return custom.name;
|
|
82
|
+
}
|
|
32
83
|
/** Validate a custom generator and add it under its name, rejecting collisions. */
|
|
33
84
|
function register(registry, custom) {
|
|
34
85
|
if (!isPlainObject(custom) ||
|
|
@@ -40,12 +91,35 @@ function register(registry, custom) {
|
|
|
40
91
|
if (registry.has(custom.name)) {
|
|
41
92
|
throw new NotSupportedError(`Generator name "${custom.name}" collides with an existing generator. Rename the custom generator.`);
|
|
42
93
|
}
|
|
94
|
+
// The model and the helpers change under semver, so a declared range that excludes the
|
|
95
|
+
// running version means the generator and this CLI disagree on the contract.
|
|
96
|
+
if (custom.requiresGenerator !== undefined) {
|
|
97
|
+
const satisfied = satisfiesGeneratorRange(GENERATOR_VERSION, custom.requiresGenerator);
|
|
98
|
+
if (satisfied === undefined) {
|
|
99
|
+
throw new NotSupportedError(`Generator "${custom.name}" declares requiresGenerator "${custom.requiresGenerator}", which is not a range we read. Use ^1.2.0, ~1.2.0, >=1.2.0, or an exact version.`);
|
|
100
|
+
}
|
|
101
|
+
if (!satisfied) {
|
|
102
|
+
throw new NotSupportedError(`Generator "${custom.name}" needs @redocly/client-generator ${custom.requiresGenerator}; this CLI ships ${GENERATOR_VERSION}. ` +
|
|
103
|
+
'Upgrade @redocly/cli if the generator is newer, or update the generator — `redocly eject-generator <name> --update` for an ejected file, or upgrade its package.');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// A custom generator MAY take over a built-in name — that's how an ejected
|
|
107
|
+
// generator replaces its origin without a config rename. Announce the takeover.
|
|
108
|
+
if (custom.name in BUILTIN_META) {
|
|
109
|
+
logger.warn(`generate-client: custom generator "${custom.name}" takes over the built-in generator of the same name.\n`);
|
|
110
|
+
}
|
|
43
111
|
registry.set(custom.name, {
|
|
44
112
|
run: custom.run,
|
|
113
|
+
sample: custom.sample,
|
|
114
|
+
// `docs` and `notApplicable` are part of the contract the ejected files export —
|
|
115
|
+
// dropping either makes an ejected generator quietly do less than the built-in it
|
|
116
|
+
// replaced (`--docs` writes no page, ignored options stop warning).
|
|
117
|
+
docs: custom.docs,
|
|
118
|
+
notApplicable: custom.notApplicable,
|
|
119
|
+
options: custom.options,
|
|
45
120
|
requires: custom.requires,
|
|
46
121
|
errorModes: custom.errorModes,
|
|
47
122
|
dateTypes: custom.dateTypes,
|
|
48
|
-
runtimes: custom.runtimes,
|
|
49
123
|
});
|
|
50
124
|
}
|
|
51
125
|
/** Dynamically import a generator from a path (resolved against `configDir`) or package specifier. */
|
|
@@ -57,9 +131,14 @@ async function importGenerator(specifier, configDir) {
|
|
|
57
131
|
}
|
|
58
132
|
const isPath = specifier.startsWith('.') || isAbsolute(specifier);
|
|
59
133
|
const target = isPath ? pathToFileURL(resolvePath(configDir, specifier)).href : specifier;
|
|
134
|
+
// An ejected generator is TypeScript source, run through Node's own type stripping —
|
|
135
|
+
// absent that, `import()` would die with ERR_UNKNOWN_FILE_EXTENSION deep in the loader.
|
|
136
|
+
if (isPath && specifier.endsWith('.ts') && !process.features.typescript) {
|
|
137
|
+
throw new NotSupportedError(`Generator "${specifier}" is TypeScript, which this Node cannot run directly — use Node 22.18, 23.6, or newer.`);
|
|
138
|
+
}
|
|
60
139
|
let module;
|
|
61
140
|
try {
|
|
62
|
-
module = (await import(target));
|
|
141
|
+
module = (await import(__rewriteRelativeImportExtension(target)));
|
|
63
142
|
}
|
|
64
143
|
catch (cause) {
|
|
65
144
|
throw new NotSupportedError(`Could not load generator "${specifier}": ${cause.message}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/generators/resolve.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oGAAoG;AACpG,sGAAsG;AACtG,uGAAuG;AACvG,mGAAmG;AACnG,qGAAqG
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/generators/resolve.ts"],"names":[],"mappings":"AAAA,mGAAmG;AACnG,oGAAoG;AACpG,sGAAsG;AACtG,uGAAuG;AACvG,mGAAmG;AACnG,qGAAqG;;;;;;;;;AAErG,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAAE,YAAY,EAAoB,MAAM,WAAW,CAAC;AAiB3D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,OAAiB,EACjB,UAA0B,EAAE;IA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A4B,CAAC;AACtC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Generator } from '
|
|
1
|
+
import type { Generator } from '@redocly/client-generator';
|
|
2
2
|
/**
|
|
3
3
|
* The swr generator: a standalone `<stem>.swr.ts` module of SWR hooks wrapping the
|
|
4
4
|
* sdk operation functions — `<op>Key` + `use<Op>` (`useSWR`) per query (GET/HEAD),
|
|
5
5
|
* `use<Op>` (`useSWRMutation`) per mutation. It imports the operation functions +
|
|
6
6
|
* their `<Op>Variables` types from the sdk entry (`./<stem>.js`), so it requires the
|
|
7
|
-
* `
|
|
7
|
+
* `typescript` generator and targets its throw-mode operation functions. `swr`/`swr/mutation`
|
|
8
8
|
* are the consumer's peer; the sdk client stays dependency-free.
|
|
9
9
|
*
|
|
10
10
|
* Output-mode-agnostic: `./<stem>.js` resolves to the single-file client or the
|
|
@@ -12,4 +12,4 @@ import type { Generator } from './types.js';
|
|
|
12
12
|
* no operations.
|
|
13
13
|
*/
|
|
14
14
|
export declare const swrGenerator: Generator;
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/swr/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAK3D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,EAAE,SAO1B,CAAC"}
|
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
import { join } from 'node:path';
|
|
2
|
-
import {
|
|
3
|
-
import { renderSwrModule } from '../emitters/swr.js';
|
|
4
|
-
import { anchor } from './anchor.js';
|
|
2
|
+
import { renderSwrModule } from "./render.js";
|
|
5
3
|
/**
|
|
6
4
|
* The swr generator: a standalone `<stem>.swr.ts` module of SWR hooks wrapping the
|
|
7
5
|
* sdk operation functions — `<op>Key` + `use<Op>` (`useSWR`) per query (GET/HEAD),
|
|
8
6
|
* `use<Op>` (`useSWRMutation`) per mutation. It imports the operation functions +
|
|
9
7
|
* their `<Op>Variables` types from the sdk entry (`./<stem>.js`), so it requires the
|
|
10
|
-
* `
|
|
8
|
+
* `typescript` generator and targets its throw-mode operation functions. `swr`/`swr/mutation`
|
|
11
9
|
* are the consumer's peer; the sdk client stays dependency-free.
|
|
12
10
|
*
|
|
13
11
|
* Output-mode-agnostic: `./<stem>.js` resolves to the single-file client or the
|
|
14
12
|
* multi-file barrel at the output anchor either way. Emits nothing when there are
|
|
15
13
|
* no operations.
|
|
16
14
|
*/
|
|
17
|
-
export const swrGenerator = ({ model,
|
|
18
|
-
const { dir, stem } = anchor(outputPath);
|
|
15
|
+
export const swrGenerator = ({ model, output, banner, emit }) => {
|
|
19
16
|
const content = renderSwrModule(model, {
|
|
20
|
-
|
|
21
|
-
sdkModule: `./${stem}.${emit.importExt ?? 'js'}`,
|
|
17
|
+
sdkModule: `./${output.stem}.${emit.importExt ?? 'js'}`,
|
|
22
18
|
});
|
|
23
19
|
if (content === '')
|
|
24
20
|
return [];
|
|
25
|
-
|
|
21
|
+
const header = banner.map((line) => `// ${line}`).join('\n');
|
|
22
|
+
return [{ path: join(output.dir, `${output.stem}.swr.ts`), content: `${header}\n\n${content}` }];
|
|
26
23
|
};
|
|
27
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/generators/swr/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,YAAY,GAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IACzE,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,EAAE;QACrC,SAAS,EAAE,KAAK,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,EAAE;KACxD,CAAC,CAAC;IACH,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,IAAI,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,MAAM,OAAO,OAAO,EAAE,EAAE,CAAC,CAAC;AACnG,CAAC,CAAC"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { ApiModel } from '
|
|
1
|
+
import type { ApiModel } from '@redocly/client-generator';
|
|
2
2
|
export type SwrOptions = {
|
|
3
3
|
/** Import specifier for the sdk entry the operation functions/types live in. */
|
|
4
4
|
sdkModule: string;
|
|
5
|
-
/** How the sdk function takes its inputs — must match the generated client. */
|
|
6
|
-
argsStyle: 'flat' | 'grouped';
|
|
7
5
|
};
|
|
8
6
|
/** Render the full SWR module source. `''` when there are no wrappable operations. */
|
|
9
7
|
export declare function renderSwrModule(model: ApiModel, opts: SwrOptions): string;
|
|
10
|
-
//# sourceMappingURL=
|
|
8
|
+
//# sourceMappingURL=render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../../src/generators/swr/render.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,2BAA2B,CAAC;AAW1E,MAAM,MAAM,UAAU,GAAG;IACvB,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;CAEnB,CAAC;AAEF,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAYzE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Emits an idiomatic SWR module wrapping the sdk operation functions. Per query
|
|
2
|
+
// operation (GET/HEAD) a `<op>Key(vars)` tuple factory + a `use<Op>(vars, init?)`
|
|
3
|
+
// hook returning `useSWR(key, fetcher)`; per mutation (everything else) a
|
|
4
|
+
// `use<Op>()` hook returning `useSWRMutation(key, (key, { arg }) => <op>(arg))`.
|
|
5
|
+
// The fetcher forwards args per the configured args style (grouped `<op>(vars, init)`
|
|
6
|
+
// or flat `<op>(vars.petId, …, init)`) via the shared `operationSignature`, so the
|
|
7
|
+
// call type-checks against the generated sdk.
|
|
8
|
+
// `swr`/`swr/mutation` are the consumer's peer; the sdk stays dependency-free.
|
|
9
|
+
// Source-text templates throughout.
|
|
10
|
+
import { hasInputs, isQuery, sdkCallText, sdkNamedImportText, variablesName, wrappableOperations, } from '@redocly/client-generator/contracts/typescript';
|
|
11
|
+
import { pascalCase } from '@redocly/client-generator/printers/typescript';
|
|
12
|
+
/** Render the full SWR module source. `''` when there are no wrappable operations. */
|
|
13
|
+
export function renderSwrModule(model, opts) {
|
|
14
|
+
const ops = wrappableOperations(model, 'swr');
|
|
15
|
+
if (ops.length === 0)
|
|
16
|
+
return '';
|
|
17
|
+
const hasQuery = ops.some(isQuery);
|
|
18
|
+
const hasMutation = ops.some((op) => !isQuery(op));
|
|
19
|
+
const blocks = [
|
|
20
|
+
...(hasQuery ? ['import useSWR from "swr";'] : []),
|
|
21
|
+
...(hasMutation ? ['import useSWRMutation from "swr/mutation";'] : []),
|
|
22
|
+
sdkNamedImportText(ops, opts.sdkModule, hasQuery),
|
|
23
|
+
...ops.flatMap((op) => (isQuery(op) ? queryBlocks(op) : [mutationBlock(op)])),
|
|
24
|
+
];
|
|
25
|
+
return blocks.join('\n\n');
|
|
26
|
+
}
|
|
27
|
+
/** An exported `function use<Op>(<params>) { return <expr>; }` declaration. */
|
|
28
|
+
function hookBlock(op, params, expr) {
|
|
29
|
+
return `export function use${pascalCase(op.name)}(${params}) {\n return ${expr};\n}`;
|
|
30
|
+
}
|
|
31
|
+
/** A query op's `<op>Key` factory + `use<Op>` hook calling `useSWR`. */
|
|
32
|
+
function queryBlocks(op) {
|
|
33
|
+
const inputs = hasInputs(op);
|
|
34
|
+
const keyParams = inputs ? `vars: ${variablesName(op)}` : '';
|
|
35
|
+
const keyElements = inputs
|
|
36
|
+
? `[${JSON.stringify(op.name)}, vars]`
|
|
37
|
+
: `[${JSON.stringify(op.name)}]`;
|
|
38
|
+
const key = `export const ${op.name}Key = (${keyParams}) => ${keyElements} as const;`;
|
|
39
|
+
const keyCall = `${op.name}Key(${inputs ? 'vars' : ''})`;
|
|
40
|
+
const useSwr = `useSWR(${keyCall}, () => ${sdkCallText(op, 'vars', true)})`;
|
|
41
|
+
// The throw-only `envelope` option is excluded — cached data must stay the plain body.
|
|
42
|
+
const params = inputs
|
|
43
|
+
? `vars: ${variablesName(op)}, init?: Omit<RequestOptions, "envelope">`
|
|
44
|
+
: 'init?: Omit<RequestOptions, "envelope">';
|
|
45
|
+
return [key, hookBlock(op, params, useSwr)];
|
|
46
|
+
}
|
|
47
|
+
/** A mutation op's `use<Op>` hook calling `useSWRMutation`. */
|
|
48
|
+
function mutationBlock(op) {
|
|
49
|
+
// `(_key: string, { arg }: { arg: <Op>Variables }) => <op>(…arg)` when the op has
|
|
50
|
+
// inputs; a no-arg `() => <op>()` when it has none (`arg` would be unused).
|
|
51
|
+
const trigger = hasInputs(op)
|
|
52
|
+
? `(_key: string, { arg }: {\n arg: ${variablesName(op)};\n }) => ${sdkCallText(op, 'arg', false)}`
|
|
53
|
+
: `() => ${sdkCallText(op, 'arg', false)}`;
|
|
54
|
+
const useSwrMutation = `useSWRMutation(${JSON.stringify(op.name)}, ${trigger})`;
|
|
55
|
+
return hookBlock(op, '', useSwrMutation);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/generators/swr/render.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,kFAAkF;AAClF,0EAA0E;AAC1E,iFAAiF;AACjF,sFAAsF;AACtF,mFAAmF;AACnF,8CAA8C;AAC9C,+EAA+E;AAC/E,oCAAoC;AAGpC,OAAO,EACL,SAAS,EACT,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,aAAa,EACb,mBAAmB,GACpB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAQ3E,sFAAsF;AACtF,MAAM,UAAU,eAAe,CAAC,KAAe,EAAE,IAAgB;IAC/D,MAAM,GAAG,GAAG,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC9C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG;QACb,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAClD,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,4CAA4C,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;QACjD,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAA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