@kattebak/openapi-generator-ts 1.0.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/LICENSE +21 -0
- package/README.md +189 -0
- package/dist/cli/commands/generate.d.ts +23 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +116 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/list.d.ts +2 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +26 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +6 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +80 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/convert-template.d.ts +31 -0
- package/dist/cli/convert-template.d.ts.map +1 -0
- package/dist/cli/convert-template.js +204 -0
- package/dist/cli/convert-template.js.map +1 -0
- package/dist/cli/convert-template.test.d.ts +2 -0
- package/dist/cli/convert-template.test.d.ts.map +1 -0
- package/dist/cli/convert-template.test.js +74 -0
- package/dist/cli/convert-template.test.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +246 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/core/config.d.ts +252 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +31 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/generator.d.ts +99 -0
- package/dist/core/generator.d.ts.map +1 -0
- package/dist/core/generator.js +492 -0
- package/dist/core/generator.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/types.d.ts +47 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +5 -0
- package/dist/core/types.js.map +1 -0
- package/dist/generators/generators.test.d.ts +6 -0
- package/dist/generators/generators.test.d.ts.map +1 -0
- package/dist/generators/generators.test.js +247 -0
- package/dist/generators/generators.test.js.map +1 -0
- package/dist/generators/go.d.ts +10 -0
- package/dist/generators/go.d.ts.map +1 -0
- package/dist/generators/go.js +327 -0
- package/dist/generators/go.js.map +1 -0
- package/dist/generators/index.d.ts +29 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +58 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/php.d.ts +14 -0
- package/dist/generators/php.d.ts.map +1 -0
- package/dist/generators/php.js +241 -0
- package/dist/generators/php.js.map +1 -0
- package/dist/generators/python.d.ts +10 -0
- package/dist/generators/python.d.ts.map +1 -0
- package/dist/generators/python.js +273 -0
- package/dist/generators/python.js.map +1 -0
- package/dist/generators/typescript-fetch.d.ts +14 -0
- package/dist/generators/typescript-fetch.d.ts.map +1 -0
- package/dist/generators/typescript-fetch.js +217 -0
- package/dist/generators/typescript-fetch.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/models/codegen-model.d.ts +123 -0
- package/dist/models/codegen-model.d.ts.map +1 -0
- package/dist/models/codegen-model.js +64 -0
- package/dist/models/codegen-model.js.map +1 -0
- package/dist/models/codegen-model.test.d.ts +6 -0
- package/dist/models/codegen-model.test.d.ts.map +1 -0
- package/dist/models/codegen-model.test.js +143 -0
- package/dist/models/codegen-model.test.js.map +1 -0
- package/dist/models/codegen-operation.d.ts +95 -0
- package/dist/models/codegen-operation.d.ts.map +1 -0
- package/dist/models/codegen-operation.js +54 -0
- package/dist/models/codegen-operation.js.map +1 -0
- package/dist/models/codegen-parameter.d.ts +86 -0
- package/dist/models/codegen-parameter.d.ts.map +1 -0
- package/dist/models/codegen-parameter.js +47 -0
- package/dist/models/codegen-parameter.js.map +1 -0
- package/dist/models/codegen-property.d.ts +95 -0
- package/dist/models/codegen-property.d.ts.map +1 -0
- package/dist/models/codegen-property.js +47 -0
- package/dist/models/codegen-property.js.map +1 -0
- package/dist/models/codegen-response.d.ts +64 -0
- package/dist/models/codegen-response.d.ts.map +1 -0
- package/dist/models/codegen-response.js +42 -0
- package/dist/models/codegen-response.js.map +1 -0
- package/dist/models/codegen-security.d.ts +34 -0
- package/dist/models/codegen-security.d.ts.map +1 -0
- package/dist/models/codegen-security.js +18 -0
- package/dist/models/codegen-security.js.map +1 -0
- package/dist/models/index.d.ts +8 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +7 -0
- package/dist/models/index.js.map +1 -0
- package/dist/parser/index.d.ts +4 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +4 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/openapi-parser.d.ts +71 -0
- package/dist/parser/openapi-parser.d.ts.map +1 -0
- package/dist/parser/openapi-parser.js +195 -0
- package/dist/parser/openapi-parser.js.map +1 -0
- package/dist/parser/openapi-parser.test.d.ts +6 -0
- package/dist/parser/openapi-parser.test.d.ts.map +1 -0
- package/dist/parser/openapi-parser.test.js +238 -0
- package/dist/parser/openapi-parser.test.js.map +1 -0
- package/dist/parser/operation-transformer.d.ts +95 -0
- package/dist/parser/operation-transformer.d.ts.map +1 -0
- package/dist/parser/operation-transformer.js +634 -0
- package/dist/parser/operation-transformer.js.map +1 -0
- package/dist/parser/schema-transformer.d.ts +134 -0
- package/dist/parser/schema-transformer.d.ts.map +1 -0
- package/dist/parser/schema-transformer.js +557 -0
- package/dist/parser/schema-transformer.js.map +1 -0
- package/dist/template/engine-adapter.d.ts +55 -0
- package/dist/template/engine-adapter.d.ts.map +1 -0
- package/dist/template/engine-adapter.js +178 -0
- package/dist/template/engine-adapter.js.map +1 -0
- package/dist/template/engine-adapter.test.d.ts +6 -0
- package/dist/template/engine-adapter.test.d.ts.map +1 -0
- package/dist/template/engine-adapter.test.js +186 -0
- package/dist/template/engine-adapter.test.js.map +1 -0
- package/dist/template/index.d.ts +5 -0
- package/dist/template/index.d.ts.map +1 -0
- package/dist/template/index.js +5 -0
- package/dist/template/index.js.map +1 -0
- package/dist/template/lambdas/indent-lambdas.d.ts +40 -0
- package/dist/template/lambdas/indent-lambdas.d.ts.map +1 -0
- package/dist/template/lambdas/indent-lambdas.js +98 -0
- package/dist/template/lambdas/indent-lambdas.js.map +1 -0
- package/dist/template/lambdas/index.d.ts +44 -0
- package/dist/template/lambdas/index.d.ts.map +1 -0
- package/dist/template/lambdas/index.js +79 -0
- package/dist/template/lambdas/index.js.map +1 -0
- package/dist/template/lambdas/string-lambdas.d.ts +78 -0
- package/dist/template/lambdas/string-lambdas.d.ts.map +1 -0
- package/dist/template/lambdas/string-lambdas.js +148 -0
- package/dist/template/lambdas/string-lambdas.js.map +1 -0
- package/dist/template/lambdas/string-lambdas.test.d.ts +6 -0
- package/dist/template/lambdas/string-lambdas.test.d.ts.map +1 -0
- package/dist/template/lambdas/string-lambdas.test.js +158 -0
- package/dist/template/lambdas/string-lambdas.test.js.map +1 -0
- package/dist/template/template-locator.d.ts +72 -0
- package/dist/template/template-locator.d.ts.map +1 -0
- package/dist/template/template-locator.js +173 -0
- package/dist/template/template-locator.js.map +1 -0
- package/dist/template/template-manager.d.ts +65 -0
- package/dist/template/template-manager.d.ts.map +1 -0
- package/dist/template/template-manager.js +185 -0
- package/dist/template/template-manager.js.map +1 -0
- package/package.json +67 -0
- package/templates/go/.travis.yml +8 -0
- package/templates/go/README.mustache +236 -0
- package/templates/go/api.mustache +452 -0
- package/templates/go/api_doc.mustache +92 -0
- package/templates/go/api_test.mustache +59 -0
- package/templates/go/client.mustache +761 -0
- package/templates/go/configuration.mustache +332 -0
- package/templates/go/git_push.sh.mustache +57 -0
- package/templates/go/gitignore.mustache +24 -0
- package/templates/go/go.mod.mustache +16 -0
- package/templates/go/go.sum.mustache +19 -0
- package/templates/go/model.mustache +21 -0
- package/templates/go/model_anyof.mustache +93 -0
- package/templates/go/model_doc.mustache +97 -0
- package/templates/go/model_enum.mustache +101 -0
- package/templates/go/model_oneof.mustache +160 -0
- package/templates/go/model_simple.mustache +572 -0
- package/templates/go/nullable_model.mustache +35 -0
- package/templates/go/openapi.mustache +1 -0
- package/templates/go/partial_header.mustache +18 -0
- package/templates/go/response.mustache +38 -0
- package/templates/go/signing.mustache +453 -0
- package/templates/go/utils.mustache +352 -0
- package/templates/php/.php-cs-fixer.dist.php +29 -0
- package/templates/php/.travis.yml +8 -0
- package/templates/php/ApiException.mustache +111 -0
- package/templates/php/Configuration.mustache +606 -0
- package/templates/php/FormDataProcessor.mustache +238 -0
- package/templates/php/HeaderSelector.mustache +265 -0
- package/templates/php/ModelInterface.mustache +103 -0
- package/templates/php/ObjectSerializer.mustache +591 -0
- package/templates/php/README.mustache +151 -0
- package/templates/php/api.mustache +891 -0
- package/templates/php/api_doc.mustache +105 -0
- package/templates/php/api_test.mustache +80 -0
- package/templates/php/composer.mustache +44 -0
- package/templates/php/git_push.sh.mustache +57 -0
- package/templates/php/gitignore +15 -0
- package/templates/php/libraries/psr-18/ApiException.mustache +114 -0
- package/templates/php/libraries/psr-18/DebugPlugin.mustache +93 -0
- package/templates/php/libraries/psr-18/README.mustache +161 -0
- package/templates/php/libraries/psr-18/api.mustache +833 -0
- package/templates/php/libraries/psr-18/api_doc.mustache +79 -0
- package/templates/php/libraries/psr-18/composer.mustache +56 -0
- package/templates/php/model.mustache +47 -0
- package/templates/php/model_doc.mustache +10 -0
- package/templates/php/model_enum.mustache +33 -0
- package/templates/php/model_generic.mustache +565 -0
- package/templates/php/model_test.mustache +88 -0
- package/templates/php/partial_header.mustache +18 -0
- package/templates/php/php_doc_auth_partial.mustache +23 -0
- package/templates/php/phpunit.xml.mustache +18 -0
- package/templates/python/README.mustache +60 -0
- package/templates/python/README_onlypackage.mustache +50 -0
- package/templates/python/__init__.mustache +1 -0
- package/templates/python/__init__api.mustache +19 -0
- package/templates/python/__init__model.mustache +22 -0
- package/templates/python/__init__package.mustache +49 -0
- package/templates/python/api.mustache +244 -0
- package/templates/python/api_client.mustache +822 -0
- package/templates/python/api_doc.mustache +81 -0
- package/templates/python/api_doc_example.mustache +38 -0
- package/templates/python/api_response.mustache +21 -0
- package/templates/python/api_test.mustache +48 -0
- package/templates/python/asyncio/rest.mustache +209 -0
- package/templates/python/common_README.mustache +85 -0
- package/templates/python/configuration.mustache +806 -0
- package/templates/python/exceptions.mustache +210 -0
- package/templates/python/exports_api.mustache +3 -0
- package/templates/python/exports_model.mustache +3 -0
- package/templates/python/exports_package.mustache +20 -0
- package/templates/python/git_push.sh.mustache +57 -0
- package/templates/python/github-workflow.mustache +35 -0
- package/templates/python/gitignore.mustache +66 -0
- package/templates/python/gitlab-ci.mustache +31 -0
- package/templates/python/httpx/rest.mustache +190 -0
- package/templates/python/model.mustache +16 -0
- package/templates/python/model_anyof.mustache +182 -0
- package/templates/python/model_doc.mustache +40 -0
- package/templates/python/model_enum.mustache +36 -0
- package/templates/python/model_generic.mustache +403 -0
- package/templates/python/model_oneof.mustache +209 -0
- package/templates/python/model_test.mustache +60 -0
- package/templates/python/partial_api.mustache +52 -0
- package/templates/python/partial_api_args.mustache +18 -0
- package/templates/python/partial_header.mustache +19 -0
- package/templates/python/py.typed.mustache +1 -0
- package/templates/python/pyproject.mustache +172 -0
- package/templates/python/python_doc_auth_partial.mustache +108 -0
- package/templates/python/requirements.mustache +23 -0
- package/templates/python/rest.mustache +254 -0
- package/templates/python/setup.mustache +60 -0
- package/templates/python/setup_cfg.mustache +2 -0
- package/templates/python/signing.mustache +422 -0
- package/templates/python/test-requirements.mustache +6 -0
- package/templates/python/tornado/rest.mustache +148 -0
- package/templates/python/tox.mustache +9 -0
- package/templates/python/travis.mustache +17 -0
- package/templates/typescript-fetch/ApiEntitiesRecord.mustache +26 -0
- package/templates/typescript-fetch/ApiEntitiesReducer.mustache +21 -0
- package/templates/typescript-fetch/ApiEntitiesSelectors.mustache +5 -0
- package/templates/typescript-fetch/README.mustache +127 -0
- package/templates/typescript-fetch/allSagas.mustache +19 -0
- package/templates/typescript-fetch/api_doc.mustache +63 -0
- package/templates/typescript-fetch/api_example.mustache +44 -0
- package/templates/typescript-fetch/apis.index.mustache +16 -0
- package/templates/typescript-fetch/apis.mustache +483 -0
- package/templates/typescript-fetch/apisAssignQueryParam.mustache +12 -0
- package/templates/typescript-fetch/gitignore +4 -0
- package/templates/typescript-fetch/index.mustache +17 -0
- package/templates/typescript-fetch/licenseInfo.mustache +11 -0
- package/templates/typescript-fetch/modelEnum.mustache +28 -0
- package/templates/typescript-fetch/modelEnumInterfaces.mustache +37 -0
- package/templates/typescript-fetch/modelGeneric.mustache +261 -0
- package/templates/typescript-fetch/modelGenericInterfaces.mustache +50 -0
- package/templates/typescript-fetch/modelOneOf.mustache +255 -0
- package/templates/typescript-fetch/modelOneOfInterfaces.mustache +6 -0
- package/templates/typescript-fetch/model_doc.mustache +41 -0
- package/templates/typescript-fetch/models.index.mustache +32 -0
- package/templates/typescript-fetch/models.mustache +24 -0
- package/templates/typescript-fetch/npmignore.mustache +1 -0
- package/templates/typescript-fetch/package.mustache +43 -0
- package/templates/typescript-fetch/recordGeneric.mustache +295 -0
- package/templates/typescript-fetch/records.mustache +17 -0
- package/templates/typescript-fetch/runtime.mustache +424 -0
- package/templates/typescript-fetch/runtimeSagasAndRecords.mustache +120 -0
- package/templates/typescript-fetch/sagaApiManager.mustache +28 -0
- package/templates/typescript-fetch/sagas.mustache +245 -0
- package/templates/typescript-fetch/sourceLibraryIndex.mustache +1 -0
- package/templates/typescript-fetch/tsconfig.esm.mustache +7 -0
- package/templates/typescript-fetch/tsconfig.mustache +25 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { createGoMetadata, getGoAdditionalProperties } from "./go.js";
|
|
2
|
+
import { createPhpMetadata, getPhpAdditionalProperties } from "./php.js";
|
|
3
|
+
import { createPythonMetadata, getPythonAdditionalProperties, } from "./python.js";
|
|
4
|
+
import { createTypescriptFetchMetadata, getTypescriptAdditionalProperties, } from "./typescript-fetch.js";
|
|
5
|
+
export * from "./go.js";
|
|
6
|
+
export * from "./php.js";
|
|
7
|
+
export * from "./python.js";
|
|
8
|
+
export * from "./typescript-fetch.js";
|
|
9
|
+
/**
|
|
10
|
+
* Registry of available generators
|
|
11
|
+
*/
|
|
12
|
+
const generators = new Map();
|
|
13
|
+
const additionalPropertiesProviders = new Map();
|
|
14
|
+
// Register built-in generators
|
|
15
|
+
generators.set("typescript-fetch", createTypescriptFetchMetadata);
|
|
16
|
+
generators.set("typescript", createTypescriptFetchMetadata); // Alias
|
|
17
|
+
generators.set("python", createPythonMetadata);
|
|
18
|
+
generators.set("go", createGoMetadata);
|
|
19
|
+
generators.set("php", createPhpMetadata);
|
|
20
|
+
// Register additional properties providers
|
|
21
|
+
additionalPropertiesProviders.set("go", getGoAdditionalProperties);
|
|
22
|
+
additionalPropertiesProviders.set("typescript-fetch", getTypescriptAdditionalProperties);
|
|
23
|
+
additionalPropertiesProviders.set("typescript", getTypescriptAdditionalProperties);
|
|
24
|
+
additionalPropertiesProviders.set("python", getPythonAdditionalProperties);
|
|
25
|
+
additionalPropertiesProviders.set("php", getPhpAdditionalProperties);
|
|
26
|
+
/**
|
|
27
|
+
* Get a generator by name
|
|
28
|
+
*/
|
|
29
|
+
export function getGenerator(name) {
|
|
30
|
+
const factory = generators.get(name);
|
|
31
|
+
return factory?.();
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Get additional properties for a generator
|
|
35
|
+
*/
|
|
36
|
+
export function getGeneratorAdditionalProperties(name, config) {
|
|
37
|
+
const provider = additionalPropertiesProviders.get(name);
|
|
38
|
+
return provider ? provider(config) : {};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* List all available generators
|
|
42
|
+
*/
|
|
43
|
+
export function listGenerators() {
|
|
44
|
+
return Array.from(generators.keys());
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Register a custom generator
|
|
48
|
+
*/
|
|
49
|
+
export function registerGenerator(name, factory) {
|
|
50
|
+
generators.set(name, factory);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Check if a generator exists
|
|
54
|
+
*/
|
|
55
|
+
export function hasGenerator(name) {
|
|
56
|
+
return generators.has(name);
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/generators/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AACzE,OAAO,EACN,oBAAoB,EACpB,6BAA6B,GAC7B,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,6BAA6B,EAC7B,iCAAiC,GACjC,MAAM,uBAAuB,CAAC;AAE/B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,EAAmC,CAAC;AAC9D,MAAM,6BAA6B,GAAG,IAAI,GAAG,EAG1C,CAAC;AAEJ,+BAA+B;AAC/B,UAAU,CAAC,GAAG,CAAC,kBAAkB,EAAE,6BAA6B,CAAC,CAAC;AAClE,UAAU,CAAC,GAAG,CAAC,YAAY,EAAE,6BAA6B,CAAC,CAAC,CAAC,QAAQ;AACrE,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;AAC/C,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AACvC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;AAEzC,2CAA2C;AAC3C,6BAA6B,CAAC,GAAG,CAAC,IAAI,EAAE,yBAAyB,CAAC,CAAC;AACnE,6BAA6B,CAAC,GAAG,CAChC,kBAAkB,EAClB,iCAAiC,CACjC,CAAC;AACF,6BAA6B,CAAC,GAAG,CAChC,YAAY,EACZ,iCAAiC,CACjC,CAAC;AACF,6BAA6B,CAAC,GAAG,CAAC,QAAQ,EAAE,6BAA6B,CAAC,CAAC;AAC3E,6BAA6B,CAAC,GAAG,CAAC,KAAK,EAAE,0BAA0B,CAAC,CAAC;AAErE;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,OAAO,EAAE,EAAE,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gCAAgC,CAC/C,IAAY,EACZ,MAAqB;IAErB,MAAM,QAAQ,GAAG,6BAA6B,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACzD,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACzC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC7B,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAChC,IAAY,EACZ,OAAgC;IAEhC,UAAU,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACxC,OAAO,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP Generator
|
|
3
|
+
* Generates PHP client code using Guzzle or PSR-18
|
|
4
|
+
*/
|
|
5
|
+
import type { CodegenConfig, GeneratorMetadata } from "../core/config.js";
|
|
6
|
+
/**
|
|
7
|
+
* Create PHP generator metadata
|
|
8
|
+
*/
|
|
9
|
+
export declare function createPhpMetadata(): GeneratorMetadata;
|
|
10
|
+
/**
|
|
11
|
+
* Get PHP-specific additional properties
|
|
12
|
+
*/
|
|
13
|
+
export declare function getPhpAdditionalProperties(config: CodegenConfig): Record<string, unknown>;
|
|
14
|
+
//# sourceMappingURL=php.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.d.ts","sourceRoot":"","sources":["../../src/generators/php.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAmI1E;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,iBAAiB,CAsFrD;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,aAAa,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkCzB"}
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PHP reserved words
|
|
3
|
+
* From https://www.php.net/manual/en/reserved.keywords.php
|
|
4
|
+
* Plus local variables used in API methods
|
|
5
|
+
*/
|
|
6
|
+
const PHP_RESERVED_WORDS = new Set([
|
|
7
|
+
// Local variables used in API methods (endpoints)
|
|
8
|
+
"resourcePath",
|
|
9
|
+
"httpBody",
|
|
10
|
+
"queryParams",
|
|
11
|
+
"headerParams",
|
|
12
|
+
"formParams",
|
|
13
|
+
"_header_accept",
|
|
14
|
+
"_tempBody",
|
|
15
|
+
// PHP reserved words
|
|
16
|
+
"__halt_compiler",
|
|
17
|
+
"abstract",
|
|
18
|
+
"and",
|
|
19
|
+
"array",
|
|
20
|
+
"as",
|
|
21
|
+
"break",
|
|
22
|
+
"callable",
|
|
23
|
+
"case",
|
|
24
|
+
"catch",
|
|
25
|
+
"class",
|
|
26
|
+
"clone",
|
|
27
|
+
"const",
|
|
28
|
+
"continue",
|
|
29
|
+
"declare",
|
|
30
|
+
"default",
|
|
31
|
+
"die",
|
|
32
|
+
"do",
|
|
33
|
+
"echo",
|
|
34
|
+
"else",
|
|
35
|
+
"elseif",
|
|
36
|
+
"empty",
|
|
37
|
+
"enddeclare",
|
|
38
|
+
"endfor",
|
|
39
|
+
"endforeach",
|
|
40
|
+
"endif",
|
|
41
|
+
"endswitch",
|
|
42
|
+
"endwhile",
|
|
43
|
+
"eval",
|
|
44
|
+
"exit",
|
|
45
|
+
"extends",
|
|
46
|
+
"final",
|
|
47
|
+
"for",
|
|
48
|
+
"foreach",
|
|
49
|
+
"function",
|
|
50
|
+
"global",
|
|
51
|
+
"goto",
|
|
52
|
+
"if",
|
|
53
|
+
"implements",
|
|
54
|
+
"include",
|
|
55
|
+
"include_once",
|
|
56
|
+
"instanceof",
|
|
57
|
+
"insteadof",
|
|
58
|
+
"interface",
|
|
59
|
+
"isset",
|
|
60
|
+
"list",
|
|
61
|
+
"namespace",
|
|
62
|
+
"new",
|
|
63
|
+
"or",
|
|
64
|
+
"print",
|
|
65
|
+
"private",
|
|
66
|
+
"protected",
|
|
67
|
+
"public",
|
|
68
|
+
"require",
|
|
69
|
+
"require_once",
|
|
70
|
+
"return",
|
|
71
|
+
"static",
|
|
72
|
+
"switch",
|
|
73
|
+
"throw",
|
|
74
|
+
"trait",
|
|
75
|
+
"try",
|
|
76
|
+
"unset",
|
|
77
|
+
"use",
|
|
78
|
+
"var",
|
|
79
|
+
"while",
|
|
80
|
+
"xor",
|
|
81
|
+
]);
|
|
82
|
+
/**
|
|
83
|
+
* PHP type mappings
|
|
84
|
+
*/
|
|
85
|
+
const PHP_TYPE_MAPPINGS = {
|
|
86
|
+
// Primitives
|
|
87
|
+
integer: "int",
|
|
88
|
+
long: "int",
|
|
89
|
+
number: "float",
|
|
90
|
+
float: "float",
|
|
91
|
+
decimal: "float",
|
|
92
|
+
double: "float",
|
|
93
|
+
string: "string",
|
|
94
|
+
byte: "int",
|
|
95
|
+
boolean: "bool",
|
|
96
|
+
// Date/Time
|
|
97
|
+
date: "\\DateTime",
|
|
98
|
+
Date: "\\DateTime",
|
|
99
|
+
DateTime: "\\DateTime",
|
|
100
|
+
// File
|
|
101
|
+
file: "\\SplFileObject",
|
|
102
|
+
// Collections
|
|
103
|
+
map: "array",
|
|
104
|
+
array: "array",
|
|
105
|
+
list: "array",
|
|
106
|
+
// Object
|
|
107
|
+
object: "object",
|
|
108
|
+
// Binary
|
|
109
|
+
binary: "string",
|
|
110
|
+
ByteArray: "string",
|
|
111
|
+
// Special
|
|
112
|
+
UUID: "string",
|
|
113
|
+
URI: "string",
|
|
114
|
+
AnyType: "mixed",
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* PHP import mappings
|
|
118
|
+
*/
|
|
119
|
+
const PHP_IMPORT_MAPPINGS = {};
|
|
120
|
+
/**
|
|
121
|
+
* Create PHP generator metadata
|
|
122
|
+
*/
|
|
123
|
+
export function createPhpMetadata() {
|
|
124
|
+
return {
|
|
125
|
+
name: "php",
|
|
126
|
+
description: "Generates PHP client code using Guzzle or PSR-18",
|
|
127
|
+
type: "client",
|
|
128
|
+
language: "PHP",
|
|
129
|
+
libraries: ["guzzle", "psr-18"],
|
|
130
|
+
defaultLibrary: "guzzle",
|
|
131
|
+
embeddedTemplateDir: "php",
|
|
132
|
+
modelFileExtension: ".php",
|
|
133
|
+
apiFileExtension: ".php",
|
|
134
|
+
modelTemplateFile: "model.mustache",
|
|
135
|
+
apiTemplateFile: "api.mustache",
|
|
136
|
+
defaultModelPackage: "{{srcBasePath}}/Model",
|
|
137
|
+
defaultApiPackage: "{{srcBasePath}}/Api",
|
|
138
|
+
supportingFiles: [
|
|
139
|
+
{
|
|
140
|
+
templateFile: "ApiException.mustache",
|
|
141
|
+
folder: "{{srcBasePath}}",
|
|
142
|
+
destinationFilename: "ApiException.php",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
templateFile: "Configuration.mustache",
|
|
146
|
+
folder: "{{srcBasePath}}",
|
|
147
|
+
destinationFilename: "Configuration.php",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
templateFile: "FormDataProcessor.mustache",
|
|
151
|
+
folder: "{{srcBasePath}}",
|
|
152
|
+
destinationFilename: "FormDataProcessor.php",
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
templateFile: "ObjectSerializer.mustache",
|
|
156
|
+
folder: "{{srcBasePath}}",
|
|
157
|
+
destinationFilename: "ObjectSerializer.php",
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
templateFile: "ModelInterface.mustache",
|
|
161
|
+
folder: "{{srcBasePath}}/Model",
|
|
162
|
+
destinationFilename: "ModelInterface.php",
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
templateFile: "HeaderSelector.mustache",
|
|
166
|
+
folder: "{{srcBasePath}}",
|
|
167
|
+
destinationFilename: "HeaderSelector.php",
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
templateFile: "composer.mustache",
|
|
171
|
+
folder: "",
|
|
172
|
+
destinationFilename: "composer.json",
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
templateFile: "README.mustache",
|
|
176
|
+
folder: "",
|
|
177
|
+
destinationFilename: "README.md",
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
templateFile: "phpunit.xml.mustache",
|
|
181
|
+
folder: "",
|
|
182
|
+
destinationFilename: "phpunit.xml.dist",
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
templateFile: ".travis.yml",
|
|
186
|
+
folder: "",
|
|
187
|
+
destinationFilename: ".travis.yml",
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
templateFile: ".php-cs-fixer.dist.php",
|
|
191
|
+
folder: "",
|
|
192
|
+
destinationFilename: ".php-cs-fixer.dist.php",
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
templateFile: "git_push.sh.mustache",
|
|
196
|
+
folder: "",
|
|
197
|
+
destinationFilename: "git_push.sh",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
templateFile: "gitignore",
|
|
201
|
+
folder: "",
|
|
202
|
+
destinationFilename: ".gitignore",
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
reservedWords: PHP_RESERVED_WORDS,
|
|
206
|
+
defaultTypeMappings: PHP_TYPE_MAPPINGS,
|
|
207
|
+
defaultImportMappings: PHP_IMPORT_MAPPINGS,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Get PHP-specific additional properties
|
|
212
|
+
*/
|
|
213
|
+
export function getPhpAdditionalProperties(config) {
|
|
214
|
+
const invokerPackage = config.additionalProperties?.invokerPackage ?? "OpenAPI\\Client";
|
|
215
|
+
const packageName = config.packageName ?? "OpenAPIClient-php";
|
|
216
|
+
return {
|
|
217
|
+
invokerPackage,
|
|
218
|
+
packageName,
|
|
219
|
+
srcBasePath: config.additionalProperties?.srcBasePath ?? "lib",
|
|
220
|
+
testBasePath: config.additionalProperties?.testBasePath ?? "test",
|
|
221
|
+
apiDirName: "Api",
|
|
222
|
+
modelDirName: "Model",
|
|
223
|
+
variableNamingConvention: config.additionalProperties?.variableNamingConvention ?? "snake_case",
|
|
224
|
+
artifactVersion: config.additionalProperties?.artifactVersion ?? "1.0.0",
|
|
225
|
+
artifactUrl: config.additionalProperties?.artifactUrl ??
|
|
226
|
+
"https://openapi-generator.tech",
|
|
227
|
+
licenseName: config.additionalProperties?.licenseName ?? "unlicense",
|
|
228
|
+
developerOrganization: config.additionalProperties?.developerOrganization ?? "OpenAPI",
|
|
229
|
+
developerOrganizationUrl: config.additionalProperties?.developerOrganizationUrl ??
|
|
230
|
+
"https://openapi-generator.tech",
|
|
231
|
+
hideGenerationTimestamp: config.additionalProperties?.hideGenerationTimestamp ?? true,
|
|
232
|
+
apiDocPath: "docs/Api",
|
|
233
|
+
modelDocPath: "docs/Model",
|
|
234
|
+
// Git repository metadata
|
|
235
|
+
gitHost: config.additionalProperties?.gitHost ?? "github.com",
|
|
236
|
+
gitUserId: config.additionalProperties?.gitUserId ?? "GIT_USER_ID",
|
|
237
|
+
gitRepoId: config.additionalProperties?.gitRepoId ?? "GIT_REPO_ID",
|
|
238
|
+
...config.additionalProperties,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
//# sourceMappingURL=php.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"php.js","sourceRoot":"","sources":["../../src/generators/php.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IAClC,kDAAkD;IAClD,cAAc;IACd,UAAU;IACV,aAAa;IACb,cAAc;IACd,YAAY;IACZ,gBAAgB;IAChB,WAAW;IAEX,qBAAqB;IACrB,iBAAiB;IACjB,UAAU;IACV,KAAK;IACL,OAAO;IACP,IAAI;IACJ,OAAO;IACP,UAAU;IACV,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,SAAS;IACT,SAAS;IACT,KAAK;IACL,IAAI;IACJ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,QAAQ;IACR,YAAY;IACZ,OAAO;IACP,WAAW;IACX,UAAU;IACV,MAAM;IACN,MAAM;IACN,SAAS;IACT,OAAO;IACP,KAAK;IACL,SAAS;IACT,UAAU;IACV,QAAQ;IACR,MAAM;IACN,IAAI;IACJ,YAAY;IACZ,SAAS;IACT,cAAc;IACd,YAAY;IACZ,WAAW;IACX,WAAW;IACX,OAAO;IACP,MAAM;IACN,WAAW;IACX,KAAK;IACL,IAAI;IACJ,OAAO;IACP,SAAS;IACT,WAAW;IACX,QAAQ;IACR,SAAS;IACT,cAAc;IACd,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,OAAO;IACP,KAAK;IACL,OAAO;IACP,KAAK;IACL,KAAK;IACL,OAAO;IACP,KAAK;CACL,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,iBAAiB,GAA2B;IACjD,aAAa;IACb,OA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adata
|
|
4
|
+
*/
|
|
5
|
+
export declare function createPythonMetadata(): GeneratorMetadata;
|
|
6
|
+
/**
|
|
7
|
+
* Get Python-specific additional properties
|
|
8
|
+
*/
|
|
9
|
+
export declare function getPythonAdditionalProperties(config: CodegenConfig): Record<string, unknown>;
|
|
10
|
+
//# sourceMappingURL=python.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.d.ts","sourceRoot":"","sources":["../../src/generators/python.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA8I1E;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CA4GxD;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC5C,MAAM,EAAE,aAAa,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA4BzB"}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python Generator
|
|
3
|
+
* Generates Python client code using urllib3, asyncio, or httpx
|
|
4
|
+
*/
|
|
5
|
+
import { snakeCase } from "es-toolkit/string";
|
|
6
|
+
/**
|
|
7
|
+
* Python reserved words
|
|
8
|
+
* From https://docs.python.org/3/reference/lexical_analysis.html#keywords
|
|
9
|
+
* Plus pydantic and API method local variables
|
|
10
|
+
*/
|
|
11
|
+
const PYTHON_RESERVED_WORDS = new Set([
|
|
12
|
+
// pydantic
|
|
13
|
+
"field",
|
|
14
|
+
// local variable name used in API methods (endpoints)
|
|
15
|
+
"all_params",
|
|
16
|
+
"resource_path",
|
|
17
|
+
"path_params",
|
|
18
|
+
"query_params",
|
|
19
|
+
"header_params",
|
|
20
|
+
"form_params",
|
|
21
|
+
"local_var_files",
|
|
22
|
+
"body_params",
|
|
23
|
+
"auth_settings",
|
|
24
|
+
// @property
|
|
25
|
+
"property",
|
|
26
|
+
// typing keywords
|
|
27
|
+
"schema",
|
|
28
|
+
"base64",
|
|
29
|
+
"json",
|
|
30
|
+
"date",
|
|
31
|
+
"float",
|
|
32
|
+
// python reserved words
|
|
33
|
+
"and",
|
|
34
|
+
"del",
|
|
35
|
+
"from",
|
|
36
|
+
"not",
|
|
37
|
+
"while",
|
|
38
|
+
"as",
|
|
39
|
+
"elif",
|
|
40
|
+
"global",
|
|
41
|
+
"or",
|
|
42
|
+
"with",
|
|
43
|
+
"assert",
|
|
44
|
+
"else",
|
|
45
|
+
"if",
|
|
46
|
+
"pass",
|
|
47
|
+
"yield",
|
|
48
|
+
"break",
|
|
49
|
+
"except",
|
|
50
|
+
"import",
|
|
51
|
+
"print",
|
|
52
|
+
"class",
|
|
53
|
+
"exec",
|
|
54
|
+
"in",
|
|
55
|
+
"raise",
|
|
56
|
+
"continue",
|
|
57
|
+
"finally",
|
|
58
|
+
"is",
|
|
59
|
+
"return",
|
|
60
|
+
"def",
|
|
61
|
+
"for",
|
|
62
|
+
"lambda",
|
|
63
|
+
"try",
|
|
64
|
+
"self",
|
|
65
|
+
"nonlocal",
|
|
66
|
+
"None",
|
|
67
|
+
"True",
|
|
68
|
+
"False",
|
|
69
|
+
"async",
|
|
70
|
+
"await",
|
|
71
|
+
]);
|
|
72
|
+
/**
|
|
73
|
+
* Python type mappings
|
|
74
|
+
*/
|
|
75
|
+
const PYTHON_TYPE_MAPPINGS = {
|
|
76
|
+
// Primitives
|
|
77
|
+
integer: "int",
|
|
78
|
+
long: "int",
|
|
79
|
+
float: "float",
|
|
80
|
+
double: "float",
|
|
81
|
+
number: "float",
|
|
82
|
+
string: "str",
|
|
83
|
+
boolean: "bool",
|
|
84
|
+
// Date/Time
|
|
85
|
+
date: "date",
|
|
86
|
+
DateTime: "datetime",
|
|
87
|
+
"date-time": "datetime",
|
|
88
|
+
// Binary/File
|
|
89
|
+
binary: "bytearray",
|
|
90
|
+
byte: "str",
|
|
91
|
+
ByteArray: "bytearray",
|
|
92
|
+
file: "bytearray",
|
|
93
|
+
File: "file",
|
|
94
|
+
// Special
|
|
95
|
+
uuid: "str",
|
|
96
|
+
UUID: "str",
|
|
97
|
+
uri: "str",
|
|
98
|
+
URI: "str",
|
|
99
|
+
email: "str",
|
|
100
|
+
password: "str",
|
|
101
|
+
// Collections
|
|
102
|
+
array: "List",
|
|
103
|
+
list: "List",
|
|
104
|
+
set: "List",
|
|
105
|
+
map: "Dict",
|
|
106
|
+
object: "object",
|
|
107
|
+
// Any/Null
|
|
108
|
+
AnyType: "object",
|
|
109
|
+
null: "None",
|
|
110
|
+
// Decimal
|
|
111
|
+
decimal: "Decimal",
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Python import mappings
|
|
115
|
+
*/
|
|
116
|
+
const PYTHON_IMPORT_MAPPINGS = {
|
|
117
|
+
datetime: "datetime",
|
|
118
|
+
date: "datetime",
|
|
119
|
+
Decimal: "decimal",
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* Convert model name to Python snake_case filename
|
|
123
|
+
*/
|
|
124
|
+
function toPythonModelFilename(modelName) {
|
|
125
|
+
return `${snakeCase(modelName)}.py`;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Convert API class name to Python snake_case filename
|
|
129
|
+
*/
|
|
130
|
+
function toPythonApiFilename(className) {
|
|
131
|
+
// Remove 'Api' suffix if present before converting to snake_case
|
|
132
|
+
const baseName = className.replace(/Api$/i, "");
|
|
133
|
+
return `${snakeCase(baseName)}_api.py`;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Create Python generator metadata
|
|
137
|
+
*/
|
|
138
|
+
export function createPythonMetadata() {
|
|
139
|
+
return {
|
|
140
|
+
name: "python",
|
|
141
|
+
description: "Generates Python client code",
|
|
142
|
+
type: "client",
|
|
143
|
+
language: "Python",
|
|
144
|
+
libraries: ["urllib3", "asyncio", "httpx"],
|
|
145
|
+
defaultLibrary: "urllib3",
|
|
146
|
+
embeddedTemplateDir: "python",
|
|
147
|
+
modelFileExtension: ".py",
|
|
148
|
+
apiFileExtension: ".py",
|
|
149
|
+
modelTemplateFile: "model.mustache",
|
|
150
|
+
apiTemplateFile: "api.mustache",
|
|
151
|
+
defaultModelPackage: "{{packageName}}/models",
|
|
152
|
+
defaultApiPackage: "{{packageName}}/api",
|
|
153
|
+
toModelFilename: toPythonModelFilename,
|
|
154
|
+
toApiFilename: toPythonApiFilename,
|
|
155
|
+
supportingFiles: [
|
|
156
|
+
{
|
|
157
|
+
templateFile: "__init__package.mustache",
|
|
158
|
+
folder: "{{packageName}}",
|
|
159
|
+
destinationFilename: "__init__.py",
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
templateFile: "__init__model.mustache",
|
|
163
|
+
folder: "{{packageName}}/models",
|
|
164
|
+
destinationFilename: "__init__.py",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
templateFile: "__init__api.mustache",
|
|
168
|
+
folder: "{{packageName}}/api",
|
|
169
|
+
destinationFilename: "__init__.py",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
templateFile: "api_client.mustache",
|
|
173
|
+
folder: "{{packageName}}",
|
|
174
|
+
destinationFilename: "api_client.py",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
templateFile: "api_response.mustache",
|
|
178
|
+
folder: "{{packageName}}",
|
|
179
|
+
destinationFilename: "api_response.py",
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
templateFile: "configuration.mustache",
|
|
183
|
+
folder: "{{packageName}}",
|
|
184
|
+
destinationFilename: "configuration.py",
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
templateFile: "exceptions.mustache",
|
|
188
|
+
folder: "{{packageName}}",
|
|
189
|
+
destinationFilename: "exceptions.py",
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
templateFile: "rest.mustache",
|
|
193
|
+
folder: "{{packageName}}",
|
|
194
|
+
destinationFilename: "rest.py",
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
templateFile: "requirements.mustache",
|
|
198
|
+
folder: "",
|
|
199
|
+
destinationFilename: "requirements.txt",
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
templateFile: "test-requirements.mustache",
|
|
203
|
+
folder: "",
|
|
204
|
+
destinationFilename: "test-requirements.txt",
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
templateFile: "setup.mustache",
|
|
208
|
+
folder: "",
|
|
209
|
+
destinationFilename: "setup.py",
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
templateFile: "pyproject.mustache",
|
|
213
|
+
folder: "",
|
|
214
|
+
destinationFilename: "pyproject.toml",
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
templateFile: "README.mustache",
|
|
218
|
+
folder: "",
|
|
219
|
+
destinationFilename: "README.md",
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
templateFile: "gitignore.mustache",
|
|
223
|
+
folder: "",
|
|
224
|
+
destinationFilename: ".gitignore",
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
templateFile: "py.typed.mustache",
|
|
228
|
+
folder: "{{packageName}}",
|
|
229
|
+
destinationFilename: "py.typed",
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
templateFile: "travis.mustache",
|
|
233
|
+
folder: "",
|
|
234
|
+
destinationFilename: ".travis.yml",
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
templateFile: "gitlab-ci.mustache",
|
|
238
|
+
folder: "",
|
|
239
|
+
destinationFilename: ".gitlab-ci.yml",
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
reservedWords: PYTHON_RESERVED_WORDS,
|
|
243
|
+
defaultTypeMappings: PYTHON_TYPE_MAPPINGS,
|
|
244
|
+
defaultImportMappings: PYTHON_IMPORT_MAPPINGS,
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Get Python-specific additional properties
|
|
249
|
+
*/
|
|
250
|
+
export function getPythonAdditionalProperties(config) {
|
|
251
|
+
return {
|
|
252
|
+
packageName: config.packageName ?? "openapi_client",
|
|
253
|
+
packageVersion: config.additionalProperties?.packageVersion ?? "1.0.0",
|
|
254
|
+
projectName: config.additionalProperties?.projectName ??
|
|
255
|
+
(config.packageName ?? "openapi_client").replace(/_/g, "-"),
|
|
256
|
+
packageUrl: config.additionalProperties?.packageUrl,
|
|
257
|
+
hideGenerationTimestamp: config.additionalProperties?.hideGenerationTimestamp ?? true,
|
|
258
|
+
recursionLimit: config.additionalProperties?.recursionLimit,
|
|
259
|
+
datetimeFormat: config.additionalProperties?.datetimeFormat ?? "%Y-%m-%dT%H:%M:%S.%f%z",
|
|
260
|
+
dateFormat: config.additionalProperties?.dateFormat ?? "%Y-%m-%d",
|
|
261
|
+
useOneOfDiscriminatorLookup: config.additionalProperties?.useOneOfDiscriminatorLookup ?? false,
|
|
262
|
+
mapNumberTo: config.additionalProperties?.mapNumberTo ??
|
|
263
|
+
"Union[StrictFloat, StrictInt]",
|
|
264
|
+
// Python version for README
|
|
265
|
+
generatorLanguageVersion: config.additionalProperties?.generatorLanguageVersion ?? "3.8+",
|
|
266
|
+
// Git repository metadata
|
|
267
|
+
gitHost: config.additionalProperties?.gitHost ?? "github.com",
|
|
268
|
+
gitUserId: config.additionalProperties?.gitUserId ?? "GIT_USER_ID",
|
|
269
|
+
gitRepoId: config.additionalProperties?.gitRepoId ?? "GIT_REPO_ID",
|
|
270
|
+
...config.additionalProperties,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
//# sourceMappingURL=python.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python.js","sourceRoot":"","sources":["../../src/generators/python.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACrC,WAAW;IACX,OAAO;IACP,sDAAsD;IACtD,YAAY;IACZ,eAAe;I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B,OAAO,EAAE,MAAM,CAAC,oBAAoB,EAAE,OAAO,IAAI,YAAY;QAC7D,SAAS,EAAE,MAAM,CAAC,oBAAoB,EAAE,SAAS,IAAI,aAAa;QAClE,SAAS,EAAE,MAAM,CAAC,oBAAoB,EAAE,SAAS,IAAI,aAAa;QAClE,GAAG,MAAM,CAAC,oBAAoB;KAC9B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript Fetch Generator
|
|
3
|
+
* Generates TypeScript client code using the Fetch API
|
|
4
|
+
*/
|
|
5
|
+
import type { CodegenConfig, GeneratorMetadata } from "../core/config.js";
|
|
6
|
+
/**
|
|
7
|
+
* Create TypeScript Fetch generator metadata
|
|
8
|
+
*/
|
|
9
|
+
export declare function createTypescriptFetchMetadata(): GeneratorMetadata;
|
|
10
|
+
/**
|
|
11
|
+
* Get TypeScript-specific additional properties
|
|
12
|
+
*/
|
|
13
|
+
export declare function getTypescriptAdditionalProperties(config: CodegenConfig): Record<string, unknown>;
|
|
14
|
+
//# sourceMappingURL=typescript-fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript-fetch.d.ts","sourceRoot":"","sources":["../../src/generators/typescript-fetch.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAqI1E;;GAEG;AACH,wBAAgB,6BAA6B,IAAI,iBAAiB,CAuEjE;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAChD,MAAM,EAAE,aAAa,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAezB"}
|