codepot-gen 0.1.0__tar.gz
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.
- codepot_gen-0.1.0/PKG-INFO +106 -0
- codepot_gen-0.1.0/README.md +81 -0
- codepot_gen-0.1.0/cli/__init__.py +7 -0
- codepot_gen-0.1.0/cli/bootstrap.py +24 -0
- codepot_gen-0.1.0/cli/commands/__init__.py +6 -0
- codepot_gen-0.1.0/cli/commands/emit.py +138 -0
- codepot_gen-0.1.0/cli/commands/infer.py +92 -0
- codepot_gen-0.1.0/cli/commands/inspect.py +73 -0
- codepot_gen-0.1.0/cli/commands/validate.py +73 -0
- codepot_gen-0.1.0/cli/constants/__init__.py +6 -0
- codepot_gen-0.1.0/cli/constants/constants.py +42 -0
- codepot_gen-0.1.0/cli/constants/defaults.py +41 -0
- codepot_gen-0.1.0/cli/main.py +97 -0
- codepot_gen-0.1.0/cli/paths.py +24 -0
- codepot_gen-0.1.0/cli/presentation/__init__.py +5 -0
- codepot_gen-0.1.0/cli/presentation/core/__init__.py +5 -0
- codepot_gen-0.1.0/cli/presentation/core/console.py +59 -0
- codepot_gen-0.1.0/cli/presentation/core/diagnostics.py +47 -0
- codepot_gen-0.1.0/cli/presentation/core/interactive.py +135 -0
- codepot_gen-0.1.0/cli/presentation/core/tables.py +139 -0
- codepot_gen-0.1.0/cli/presentation/emit/__init__.py +5 -0
- codepot_gen-0.1.0/cli/presentation/emit/diagnostics.py +7 -0
- codepot_gen-0.1.0/cli/presentation/emit/files.py +19 -0
- codepot_gen-0.1.0/cli/presentation/emit/renderer.py +29 -0
- codepot_gen-0.1.0/cli/presentation/emit/status.py +22 -0
- codepot_gen-0.1.0/cli/presentation/emit/summary.py +24 -0
- codepot_gen-0.1.0/cli/presentation/infer/__init__.py +5 -0
- codepot_gen-0.1.0/cli/presentation/infer/diagnostics.py +7 -0
- codepot_gen-0.1.0/cli/presentation/infer/files.py +19 -0
- codepot_gen-0.1.0/cli/presentation/infer/renderer.py +21 -0
- codepot_gen-0.1.0/cli/presentation/infer/schemas.py +52 -0
- codepot_gen-0.1.0/cli/presentation/infer/status.py +11 -0
- codepot_gen-0.1.0/cli/presentation/infer/summary.py +28 -0
- codepot_gen-0.1.0/cli/presentation/inspect/__init__.py +5 -0
- codepot_gen-0.1.0/cli/presentation/inspect/diagnostics.py +7 -0
- codepot_gen-0.1.0/cli/presentation/inspect/renderer.py +18 -0
- codepot_gen-0.1.0/cli/presentation/inspect/resources.py +26 -0
- codepot_gen-0.1.0/cli/presentation/inspect/status.py +11 -0
- codepot_gen-0.1.0/cli/presentation/inspect/summary.py +27 -0
- codepot_gen-0.1.0/cli/presentation/validate/__init__.py +5 -0
- codepot_gen-0.1.0/cli/presentation/validate/diagnostics.py +7 -0
- codepot_gen-0.1.0/cli/presentation/validate/issues.py +29 -0
- codepot_gen-0.1.0/cli/presentation/validate/renderer.py +21 -0
- codepot_gen-0.1.0/cli/presentation/validate/summary.py +17 -0
- codepot_gen-0.1.0/pyproject.toml +86 -0
- codepot_gen-0.1.0/setup.cfg +4 -0
- codepot_gen-0.1.0/src/app/__init__.py +9 -0
- codepot_gen-0.1.0/src/app/app.py +77 -0
- codepot_gen-0.1.0/src/app/io/__init__.py +5 -0
- codepot_gen-0.1.0/src/app/io/inference_output.py +20 -0
- codepot_gen-0.1.0/src/app/models/__init__.py +35 -0
- codepot_gen-0.1.0/src/app/models/diagnostics.py +15 -0
- codepot_gen-0.1.0/src/app/models/events.py +22 -0
- codepot_gen-0.1.0/src/app/models/inputs.py +45 -0
- codepot_gen-0.1.0/src/app/models/outputs.py +108 -0
- codepot_gen-0.1.0/src/app/workflows/__init__.py +7 -0
- codepot_gen-0.1.0/src/app/workflows/emit.py +143 -0
- codepot_gen-0.1.0/src/app/workflows/infer.py +102 -0
- codepot_gen-0.1.0/src/app/workflows/inspect.py +99 -0
- codepot_gen-0.1.0/src/app/workflows/template_paths.py +26 -0
- codepot_gen-0.1.0/src/app/workflows/validate.py +142 -0
- codepot_gen-0.1.0/src/codepot_gen/__init__.py +9 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/.gitignore +5 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/.prettierrc +5 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/CHANGELOG.md.j2 +5 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/README.md.j2 +55 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/analysis_options.yaml.j2 +12 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/lib/[project.name.path].dart.j2 +12 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/paths.yaml +69 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/pubspec.yaml.j2 +23 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{dto}/index.dart.j2 +1 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{dto}/model.dart.j2 +37 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{enum}/enum.dart.j2 +8 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{enum}/index.dart.j2 +1 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{feature}/[resource.name.path]_feature.dart.j2 +104 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{model}/index.dart.j2 +1 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{model}/model.dart.j2 +37 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{route_group}/[resource.name.path]_endpoints.dart.j2 +15 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{route_root}/routes.dart.j2 +11 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{version}/client.dart.j2 +22 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/dart/{version}/v1.dart.j2 +18 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/README.md.j2 +38 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/_partials/fields-table.md.j2 +0 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/_partials/metadata.md.j2 +0 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/_partials/operation-summary.md.j2 +0 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/_partials/parameters-table.md.j2 +0 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/_partials/request-body.md.j2 +0 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/_partials/responses-table.md.j2 +0 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/_partials/schema-summary.md.j2 +0 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/paths.yaml +54 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{dto}/[dto.name.path].md.j2 +88 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{enum}/[enum.name.path].md.j2 +82 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{model}/[model.name.path].dependencies.md.j2 +23 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{model}/[model.name.path].fields.md.j2 +37 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{model}/[model.name.path].md.j2 +110 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{operation}/[operation.api.method]_[operation.name.path].md.j2 +45 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{resource}/index.md.j2 +57 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{resource}/operations.md.j2 +100 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/debug/{resource}/schemas.md.j2 +25 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/paths.yaml +112 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{dto}/[dto.name.path.o].ts.j2 +26 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{enum}/[enum.name.path.o].ts.j2 +38 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{model}/[model.name.path.o].ts.j2 +26 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{resource_dto}/index.ts.j2 +16 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{resource_enums}/index.ts.j2 +16 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{resource_models}/index.ts.j2 +16 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{resource_types}/index.ts.j2 +28 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{resource}/[resource.name.path.o].actions.ts.j2 +208 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{root}/[project.meta.api_version].ts.j2 +12 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{root}/actions/helpers.ts.j2 +176 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{root}/actions/index.ts.j2 +11 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{root}/api.ts.j2 +17 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{root}/index.ts.j2 +8 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{root}/next-actions.md +213 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{root}/routes.ts.j2 +49 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{root}/types/index.ts.j2 +10 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{ui_page}/page.tsx.j2 +127 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{ui_resource}/[resource.name.path.o]-columns.tsx.j2 +180 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{ui_resource}/[resource.name.path.o]-dialogs.tsx.j2 +382 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{ui_resource}/[resource.name.path.o]-form.tsx.j2 +270 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{ui_resource}/[resource.name.path.o]-table.tsx.j2 +87 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/next/{ui_resource}/index.ts.j2 +12 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/.gitignore +40 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/.prettierrc +5 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/README.md.j2 +21 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/package.json.j2 +16 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/paths.yaml +72 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/tsconfig.json.j2 +14 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/{dto}/dto.ts.j2 +9 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/{enum}/enum.ts.j2 +5 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/{model}/model.ts.j2 +9 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/{operation}/operation.ts.j2 +5 -0
- codepot_gen-0.1.0/src/codepot_gen/templates/typescript/{version}/index.ts.j2 +12 -0
- codepot_gen-0.1.0/src/codepot_gen.egg-info/PKG-INFO +106 -0
- codepot_gen-0.1.0/src/codepot_gen.egg-info/SOURCES.txt +267 -0
- codepot_gen-0.1.0/src/codepot_gen.egg-info/dependency_links.txt +1 -0
- codepot_gen-0.1.0/src/codepot_gen.egg-info/entry_points.txt +4 -0
- codepot_gen-0.1.0/src/codepot_gen.egg-info/requires.txt +8 -0
- codepot_gen-0.1.0/src/codepot_gen.egg-info/top_level.txt +11 -0
- codepot_gen-0.1.0/src/constants/__init__.py +7 -0
- codepot_gen-0.1.0/src/constants/app.py +6 -0
- codepot_gen-0.1.0/src/constants/codegen.py +39 -0
- codepot_gen-0.1.0/src/constants/emission.py +38 -0
- codepot_gen-0.1.0/src/constants/files.py +17 -0
- codepot_gen-0.1.0/src/constants/http.py +25 -0
- codepot_gen-0.1.0/src/constants/openapi.py +116 -0
- codepot_gen-0.1.0/src/contracts/__init__.py +124 -0
- codepot_gen-0.1.0/src/contracts/api.py +318 -0
- codepot_gen-0.1.0/src/contracts/emission.py +55 -0
- codepot_gen-0.1.0/src/contracts/events.py +33 -0
- codepot_gen-0.1.0/src/contracts/language.py +61 -0
- codepot_gen-0.1.0/src/contracts/names.py +15 -0
- codepot_gen-0.1.0/src/contracts/path_yaml.py +217 -0
- codepot_gen-0.1.0/src/contracts/paths.py +127 -0
- codepot_gen-0.1.0/src/contracts/template.py +601 -0
- codepot_gen-0.1.0/src/core/__init__.py +7 -0
- codepot_gen-0.1.0/src/core/config.py +47 -0
- codepot_gen-0.1.0/src/core/errors.py +21 -0
- codepot_gen-0.1.0/src/core/paths.py +79 -0
- codepot_gen-0.1.0/src/emission/__init__.py +5 -0
- codepot_gen-0.1.0/src/emission/dependencies/output_index.py +80 -0
- codepot_gen-0.1.0/src/emission/dependencies/resolver.py +70 -0
- codepot_gen-0.1.0/src/emission/engine.py +497 -0
- codepot_gen-0.1.0/src/emission/imports/base.py +29 -0
- codepot_gen-0.1.0/src/emission/imports/markdown.py +48 -0
- codepot_gen-0.1.0/src/emission/imports/paths.py +18 -0
- codepot_gen-0.1.0/src/emission/paths/__init__.py +5 -0
- codepot_gen-0.1.0/src/emission/paths/config_loader.py +23 -0
- codepot_gen-0.1.0/src/emission/paths/selection.py +59 -0
- codepot_gen-0.1.0/src/emission/templates/__init__.py +5 -0
- codepot_gen-0.1.0/src/emission/templates/descriptor.py +59 -0
- codepot_gen-0.1.0/src/emission/templates/path_expander.py +103 -0
- codepot_gen-0.1.0/src/emission/templates/path_safety.py +64 -0
- codepot_gen-0.1.0/src/emission/templates/path_tokens.py +143 -0
- codepot_gen-0.1.0/src/emission/templates/renderer.py +90 -0
- codepot_gen-0.1.0/src/emission/templates/resolver.py +67 -0
- codepot_gen-0.1.0/src/emission/templates/scanner.py +33 -0
- codepot_gen-0.1.0/src/emission/writer/__init__.py +0 -0
- codepot_gen-0.1.0/src/emission/writer/file_writer.py +100 -0
- codepot_gen-0.1.0/src/inference/__init__.py +10 -0
- codepot_gen-0.1.0/src/inference/classifiers.py +96 -0
- codepot_gen-0.1.0/src/inference/contract.py +448 -0
- codepot_gen-0.1.0/src/inference/engine.py +116 -0
- codepot_gen-0.1.0/src/inference/graph.py +51 -0
- codepot_gen-0.1.0/src/inference/metadata/__init__.py +5 -0
- codepot_gen-0.1.0/src/inference/metadata/parameters.py +71 -0
- codepot_gen-0.1.0/src/inference/metadata/query.py +43 -0
- codepot_gen-0.1.0/src/inference/metadata/targets.py +62 -0
- codepot_gen-0.1.0/src/inference/metadata/ui.py +61 -0
- codepot_gen-0.1.0/src/inference/models/__init__.py +35 -0
- codepot_gen-0.1.0/src/inference/models/base.py +13 -0
- codepot_gen-0.1.0/src/inference/models/dependencies.py +10 -0
- codepot_gen-0.1.0/src/inference/models/graph.py +24 -0
- codepot_gen-0.1.0/src/inference/models/operations.py +90 -0
- codepot_gen-0.1.0/src/inference/models/resources.py +11 -0
- codepot_gen-0.1.0/src/inference/models/schemas.py +87 -0
- codepot_gen-0.1.0/src/inference/operations/__init__.py +7 -0
- codepot_gen-0.1.0/src/inference/operations/dependencies.py +32 -0
- codepot_gen-0.1.0/src/inference/operations/engine.py +198 -0
- codepot_gen-0.1.0/src/inference/operations/parameter_targets.py +49 -0
- codepot_gen-0.1.0/src/inference/operations/parameters.py +59 -0
- codepot_gen-0.1.0/src/inference/operations/request_bodies.py +70 -0
- codepot_gen-0.1.0/src/inference/operations/resources.py +17 -0
- codepot_gen-0.1.0/src/inference/operations/responses.py +85 -0
- codepot_gen-0.1.0/src/inference/ref_metadata.py +81 -0
- codepot_gen-0.1.0/src/inference/resources.py +48 -0
- codepot_gen-0.1.0/src/inference/schemas/__init__.py +251 -0
- codepot_gen-0.1.0/src/inference/schemas/composition.py +193 -0
- codepot_gen-0.1.0/src/inference/schemas/enums.py +53 -0
- codepot_gen-0.1.0/src/inference/schemas/field_types.py +143 -0
- codepot_gen-0.1.0/src/inference/schemas/fields.py +166 -0
- codepot_gen-0.1.0/src/inference/schemas/primitives.py +52 -0
- codepot_gen-0.1.0/src/inference/schemas/resolution.py +115 -0
- codepot_gen-0.1.0/src/inference/serialization.py +10 -0
- codepot_gen-0.1.0/src/languages/__init__.py +5 -0
- codepot_gen-0.1.0/src/languages/dart/__init__.py +6 -0
- codepot_gen-0.1.0/src/languages/dart/adapter.py +185 -0
- codepot_gen-0.1.0/src/languages/dart/constants.py +16 -0
- codepot_gen-0.1.0/src/languages/dart/context.py +67 -0
- codepot_gen-0.1.0/src/languages/dart/dependencies.py +229 -0
- codepot_gen-0.1.0/src/languages/dart/fields.py +87 -0
- codepot_gen-0.1.0/src/languages/dart/imports.py +193 -0
- codepot_gen-0.1.0/src/languages/dart/names.py +218 -0
- codepot_gen-0.1.0/src/languages/dart/operations.py +500 -0
- codepot_gen-0.1.0/src/languages/dart/paths.py +39 -0
- codepot_gen-0.1.0/src/languages/dart/resources.py +108 -0
- codepot_gen-0.1.0/src/languages/dart/schemas.py +276 -0
- codepot_gen-0.1.0/src/languages/dart/types.py +275 -0
- codepot_gen-0.1.0/src/languages/dart/urls.py +32 -0
- codepot_gen-0.1.0/src/languages/debug/__init__.py +5 -0
- codepot_gen-0.1.0/src/languages/debug/adapter.py +896 -0
- codepot_gen-0.1.0/src/languages/debug/context/__init__.py +2 -0
- codepot_gen-0.1.0/src/languages/debug/context/path_values.py +23 -0
- codepot_gen-0.1.0/src/languages/decorators.py +88 -0
- codepot_gen-0.1.0/src/languages/discovery.py +51 -0
- codepot_gen-0.1.0/src/languages/typescript/__init__.py +6 -0
- codepot_gen-0.1.0/src/languages/typescript/adapter.py +178 -0
- codepot_gen-0.1.0/src/languages/typescript/constants.py +18 -0
- codepot_gen-0.1.0/src/languages/typescript/context.py +61 -0
- codepot_gen-0.1.0/src/languages/typescript/dependencies.py +228 -0
- codepot_gen-0.1.0/src/languages/typescript/fields.py +170 -0
- codepot_gen-0.1.0/src/languages/typescript/imports.py +210 -0
- codepot_gen-0.1.0/src/languages/typescript/names.py +259 -0
- codepot_gen-0.1.0/src/languages/typescript/operations.py +700 -0
- codepot_gen-0.1.0/src/languages/typescript/paths.py +39 -0
- codepot_gen-0.1.0/src/languages/typescript/resources.py +113 -0
- codepot_gen-0.1.0/src/languages/typescript/schemas.py +243 -0
- codepot_gen-0.1.0/src/languages/typescript/types.py +269 -0
- codepot_gen-0.1.0/src/languages/typescript/urls.py +20 -0
- codepot_gen-0.1.0/src/openapi/__init__.py +9 -0
- codepot_gen-0.1.0/src/openapi/document.py +88 -0
- codepot_gen-0.1.0/src/openapi/inspector.py +126 -0
- codepot_gen-0.1.0/src/openapi/loader.py +71 -0
- codepot_gen-0.1.0/src/openapi/ref_metadata.py +67 -0
- codepot_gen-0.1.0/src/openapi/refs.py +88 -0
- codepot_gen-0.1.0/src/openapi/resolver/__init__.py +28 -0
- codepot_gen-0.1.0/src/openapi/resolver/components.py +104 -0
- codepot_gen-0.1.0/src/openapi/resolver/content.py +81 -0
- codepot_gen-0.1.0/src/openapi/resolver/parameters.py +110 -0
- codepot_gen-0.1.0/src/openapi/resolver/pointers.py +69 -0
- codepot_gen-0.1.0/src/openapi/resolver/request_bodies.py +66 -0
- codepot_gen-0.1.0/src/openapi/resolver/responses.py +73 -0
- codepot_gen-0.1.0/src/utils/__init__.py +1 -0
- codepot_gen-0.1.0/src/utils/naming/__init__.py +17 -0
- codepot_gen-0.1.0/src/utils/naming/aliases.py +18 -0
- codepot_gen-0.1.0/src/utils/naming/cases.py +80 -0
- codepot_gen-0.1.0/src/utils/naming/number.py +25 -0
- codepot_gen-0.1.0/src/utils/naming/plurality.py +126 -0
- codepot_gen-0.1.0/src/utils/naming/provider.py +188 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: codepot-gen
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: General OpenAPI inference and multi-language code generation engine
|
|
5
|
+
Author: Codepot
|
|
6
|
+
Keywords: openapi,codegen,generator,typescript,dart
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Environment :: Console
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
14
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
Requires-Dist: typer>=0.12.5
|
|
18
|
+
Requires-Dist: rich>=13.9.0
|
|
19
|
+
Requires-Dist: questionary>=2.0.0
|
|
20
|
+
Requires-Dist: pydantic>=2.8.0
|
|
21
|
+
Requires-Dist: pydantic-settings>=2.4.0
|
|
22
|
+
Requires-Dist: PyYAML>=6.0.2
|
|
23
|
+
Requires-Dist: jinja2>=3.1.4
|
|
24
|
+
Requires-Dist: pluralizer>=2.0.0
|
|
25
|
+
|
|
26
|
+
Codepot Gen
|
|
27
|
+
===========
|
|
28
|
+
|
|
29
|
+
OpenAPI inference and template-driven code generation for TypeScript, Dart, and
|
|
30
|
+
debug output.
|
|
31
|
+
|
|
32
|
+
Installation
|
|
33
|
+
------------
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install codepot-gen
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
CLI Usage
|
|
40
|
+
---------
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
codepot-gen emit \
|
|
44
|
+
--input openapi.yaml \
|
|
45
|
+
--language typescript \
|
|
46
|
+
--output ./generated
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Short aliases are also installed:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
apigen --help
|
|
53
|
+
codepot --help
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Bundled templates are included in the package. You can still override them:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
codepot-gen emit \
|
|
60
|
+
--input openapi.yaml \
|
|
61
|
+
--language dart \
|
|
62
|
+
--output ./sdk \
|
|
63
|
+
--templates ./templates/dart
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Python Usage
|
|
67
|
+
------------
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from codepot_gen import GeneratorApp
|
|
71
|
+
|
|
72
|
+
app = GeneratorApp()
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Build And Publish
|
|
76
|
+
-----------------
|
|
77
|
+
|
|
78
|
+
Install build tools:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python -m pip install build twine
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Build locally:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
python -m build
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Check the package:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
python -m twine check dist/*
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Publish to TestPyPI first:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
python -m twine upload --repository testpypi dist/*
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Publish to PyPI:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
python -m twine upload dist/*
|
|
106
|
+
```
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Codepot Gen
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
OpenAPI inference and template-driven code generation for TypeScript, Dart, and
|
|
5
|
+
debug output.
|
|
6
|
+
|
|
7
|
+
Installation
|
|
8
|
+
------------
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pip install codepot-gen
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
CLI Usage
|
|
15
|
+
---------
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
codepot-gen emit \
|
|
19
|
+
--input openapi.yaml \
|
|
20
|
+
--language typescript \
|
|
21
|
+
--output ./generated
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Short aliases are also installed:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
apigen --help
|
|
28
|
+
codepot --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Bundled templates are included in the package. You can still override them:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
codepot-gen emit \
|
|
35
|
+
--input openapi.yaml \
|
|
36
|
+
--language dart \
|
|
37
|
+
--output ./sdk \
|
|
38
|
+
--templates ./templates/dart
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Python Usage
|
|
42
|
+
------------
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from codepot_gen import GeneratorApp
|
|
46
|
+
|
|
47
|
+
app = GeneratorApp()
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Build And Publish
|
|
51
|
+
-----------------
|
|
52
|
+
|
|
53
|
+
Install build tools:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
python -m pip install build twine
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Build locally:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
python -m build
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Check the package:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
python -m twine check dist/*
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Publish to TestPyPI first:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
python -m twine upload --repository testpypi dist/*
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Publish to PyPI:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
python -m twine upload dist/*
|
|
81
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""CLI import bootstrap.
|
|
2
|
+
|
|
3
|
+
This keeps `python -m cli.main` working during local development when the
|
|
4
|
+
engine packages live under src/ and the CLI package lives at repository root.
|
|
5
|
+
Installed console scripts do not depend on this being special.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import sys
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def ensure_src_on_path() -> None:
|
|
15
|
+
"""Add the src directory to sys.path when running the CLI from source."""
|
|
16
|
+
project_root = Path(__file__).resolve().parents[1]
|
|
17
|
+
src_path = project_root / "src"
|
|
18
|
+
|
|
19
|
+
if not src_path.exists():
|
|
20
|
+
return
|
|
21
|
+
|
|
22
|
+
src_text = str(src_path)
|
|
23
|
+
if src_text not in sys.path:
|
|
24
|
+
sys.path.insert(0, src_text)
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from cli.constants.constants import (
|
|
8
|
+
HELP_DEBUG,
|
|
9
|
+
HELP_DRY_RUN,
|
|
10
|
+
HELP_INPUT,
|
|
11
|
+
HELP_INTERACTIVE,
|
|
12
|
+
HELP_LANGUAGE,
|
|
13
|
+
HELP_OUTPUT,
|
|
14
|
+
HELP_QUIET,
|
|
15
|
+
HELP_TEMPLATES_PATH,
|
|
16
|
+
HELP_VERBOSE,
|
|
17
|
+
OPT_DEBUG,
|
|
18
|
+
OPT_DRY_RUN,
|
|
19
|
+
OPT_INPUT,
|
|
20
|
+
OPT_INTERACTIVE,
|
|
21
|
+
OPT_LANGUAGE,
|
|
22
|
+
OPT_OUTPUT,
|
|
23
|
+
OPT_QUIET,
|
|
24
|
+
OPT_TEMPLATES,
|
|
25
|
+
OPT_VERBOSE,
|
|
26
|
+
)
|
|
27
|
+
from cli.presentation.core.console import print_error, print_header
|
|
28
|
+
from cli.presentation.core.interactive import (
|
|
29
|
+
ask_dry_run,
|
|
30
|
+
ask_input_path,
|
|
31
|
+
ask_language,
|
|
32
|
+
ask_output_path,
|
|
33
|
+
ask_templates_path,
|
|
34
|
+
should_prompt,
|
|
35
|
+
)
|
|
36
|
+
from cli.paths import normalize_cli_path
|
|
37
|
+
from cli.presentation.emit.renderer import render_emit_result
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def emit_command(
|
|
41
|
+
ctx: typer.Context,
|
|
42
|
+
input_file: Path | None = typer.Option(
|
|
43
|
+
None,
|
|
44
|
+
f"--{OPT_INPUT}",
|
|
45
|
+
"-i",
|
|
46
|
+
help=HELP_INPUT,
|
|
47
|
+
exists=False,
|
|
48
|
+
file_okay=True,
|
|
49
|
+
dir_okay=False,
|
|
50
|
+
readable=True,
|
|
51
|
+
),
|
|
52
|
+
language: str | None = typer.Option(
|
|
53
|
+
None,
|
|
54
|
+
f"--{OPT_LANGUAGE}",
|
|
55
|
+
"-l",
|
|
56
|
+
help=HELP_LANGUAGE,
|
|
57
|
+
),
|
|
58
|
+
output: Path | None = typer.Option(
|
|
59
|
+
None,
|
|
60
|
+
f"--{OPT_OUTPUT}",
|
|
61
|
+
"-o",
|
|
62
|
+
help=HELP_OUTPUT,
|
|
63
|
+
),
|
|
64
|
+
templates_path: Path | None = typer.Option(
|
|
65
|
+
None,
|
|
66
|
+
f"--{OPT_TEMPLATES}",
|
|
67
|
+
"-t",
|
|
68
|
+
help=HELP_TEMPLATES_PATH,
|
|
69
|
+
),
|
|
70
|
+
dry_run: bool = typer.Option(False, f"--{OPT_DRY_RUN}", help=HELP_DRY_RUN),
|
|
71
|
+
interactive: bool = typer.Option(
|
|
72
|
+
False,
|
|
73
|
+
f"--{OPT_INTERACTIVE}",
|
|
74
|
+
"-I",
|
|
75
|
+
help=HELP_INTERACTIVE,
|
|
76
|
+
),
|
|
77
|
+
debug: bool = typer.Option(False, f"--{OPT_DEBUG}", help=HELP_DEBUG),
|
|
78
|
+
verbose: bool = typer.Option(False, f"--{OPT_VERBOSE}", "-v", help=HELP_VERBOSE),
|
|
79
|
+
quiet: bool = typer.Option(False, f"--{OPT_QUIET}", "-q", help=HELP_QUIET),
|
|
80
|
+
) -> None:
|
|
81
|
+
"""Emit output for a target language."""
|
|
82
|
+
try:
|
|
83
|
+
from cli.main import get_runtime
|
|
84
|
+
|
|
85
|
+
resolved_input = input_file
|
|
86
|
+
resolved_language = language
|
|
87
|
+
resolved_output = output
|
|
88
|
+
resolved_templates_path = templates_path
|
|
89
|
+
resolved_dry_run = dry_run
|
|
90
|
+
|
|
91
|
+
prompt = should_prompt(interactive)
|
|
92
|
+
|
|
93
|
+
if resolved_input is None and prompt:
|
|
94
|
+
resolved_input = ask_input_path()
|
|
95
|
+
|
|
96
|
+
if resolved_language is None and prompt:
|
|
97
|
+
resolved_language = ask_language()
|
|
98
|
+
|
|
99
|
+
if resolved_output is None and prompt:
|
|
100
|
+
resolved_output = ask_output_path()
|
|
101
|
+
|
|
102
|
+
if resolved_templates_path is None and interactive:
|
|
103
|
+
resolved_templates_path = ask_templates_path()
|
|
104
|
+
|
|
105
|
+
if not dry_run and interactive:
|
|
106
|
+
resolved_dry_run = ask_dry_run()
|
|
107
|
+
|
|
108
|
+
if resolved_input is None:
|
|
109
|
+
raise ValueError("missing required option: --input")
|
|
110
|
+
if resolved_language is None:
|
|
111
|
+
raise ValueError("missing required option: --language")
|
|
112
|
+
if resolved_output is None:
|
|
113
|
+
raise ValueError("missing required option: --output")
|
|
114
|
+
|
|
115
|
+
resolved_input = normalize_cli_path(resolved_input)
|
|
116
|
+
resolved_output = normalize_cli_path(resolved_output)
|
|
117
|
+
resolved_templates_path = normalize_cli_path(resolved_templates_path)
|
|
118
|
+
|
|
119
|
+
if not quiet:
|
|
120
|
+
print_header("Emit", f"{resolved_language} -> {resolved_output}")
|
|
121
|
+
|
|
122
|
+
runtime = get_runtime(ctx)
|
|
123
|
+
result = runtime.emit(
|
|
124
|
+
input_path=resolved_input,
|
|
125
|
+
language=resolved_language,
|
|
126
|
+
output_path=resolved_output,
|
|
127
|
+
dry_run=resolved_dry_run,
|
|
128
|
+
templates_path=resolved_templates_path,
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
if not quiet:
|
|
132
|
+
render_emit_result(result, verbose=verbose)
|
|
133
|
+
|
|
134
|
+
except Exception as exc:
|
|
135
|
+
print_error(str(exc))
|
|
136
|
+
if debug:
|
|
137
|
+
raise
|
|
138
|
+
raise typer.Exit(1) from exc
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from cli.constants.constants import (
|
|
8
|
+
HELP_DEBUG,
|
|
9
|
+
HELP_INPUT,
|
|
10
|
+
HELP_INTERACTIVE,
|
|
11
|
+
HELP_OUTPUT_INFERENCE,
|
|
12
|
+
HELP_QUIET,
|
|
13
|
+
HELP_VERBOSE,
|
|
14
|
+
OPT_DEBUG,
|
|
15
|
+
OPT_INPUT,
|
|
16
|
+
OPT_INTERACTIVE,
|
|
17
|
+
OPT_OUTPUT,
|
|
18
|
+
OPT_QUIET,
|
|
19
|
+
OPT_VERBOSE,
|
|
20
|
+
)
|
|
21
|
+
from cli.presentation.core.console import print_error, print_header
|
|
22
|
+
from cli.presentation.core.interactive import (
|
|
23
|
+
ask_input_path,
|
|
24
|
+
ask_optional_output_path,
|
|
25
|
+
should_prompt,
|
|
26
|
+
)
|
|
27
|
+
from cli.presentation.infer.renderer import render_infer_result
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def infer_command(
|
|
31
|
+
ctx: typer.Context,
|
|
32
|
+
input_file: Path | None = typer.Option(
|
|
33
|
+
None,
|
|
34
|
+
f"--{OPT_INPUT}",
|
|
35
|
+
"-i",
|
|
36
|
+
help=HELP_INPUT,
|
|
37
|
+
exists=False,
|
|
38
|
+
file_okay=True,
|
|
39
|
+
dir_okay=False,
|
|
40
|
+
readable=True,
|
|
41
|
+
),
|
|
42
|
+
output: Path | None = typer.Option(
|
|
43
|
+
None,
|
|
44
|
+
f"--{OPT_OUTPUT}",
|
|
45
|
+
"-o",
|
|
46
|
+
help=HELP_OUTPUT_INFERENCE,
|
|
47
|
+
),
|
|
48
|
+
interactive: bool = typer.Option(
|
|
49
|
+
False,
|
|
50
|
+
f"--{OPT_INTERACTIVE}",
|
|
51
|
+
"-I",
|
|
52
|
+
help=HELP_INTERACTIVE,
|
|
53
|
+
),
|
|
54
|
+
debug: bool = typer.Option(False, f"--{OPT_DEBUG}", help=HELP_DEBUG),
|
|
55
|
+
verbose: bool = typer.Option(False, f"--{OPT_VERBOSE}", "-v", help=HELP_VERBOSE),
|
|
56
|
+
quiet: bool = typer.Option(False, f"--{OPT_QUIET}", "-q", help=HELP_QUIET),
|
|
57
|
+
) -> None:
|
|
58
|
+
"""Run OpenAPI inference."""
|
|
59
|
+
try:
|
|
60
|
+
from cli.main import get_runtime
|
|
61
|
+
|
|
62
|
+
resolved_input = input_file
|
|
63
|
+
resolved_output = output
|
|
64
|
+
|
|
65
|
+
prompt = should_prompt(interactive)
|
|
66
|
+
|
|
67
|
+
if resolved_input is None and prompt:
|
|
68
|
+
resolved_input = ask_input_path()
|
|
69
|
+
|
|
70
|
+
if resolved_output is None and interactive:
|
|
71
|
+
resolved_output = ask_optional_output_path()
|
|
72
|
+
|
|
73
|
+
if resolved_input is None:
|
|
74
|
+
raise ValueError("missing required option: --input")
|
|
75
|
+
|
|
76
|
+
if not quiet:
|
|
77
|
+
print_header("Infer", str(resolved_input))
|
|
78
|
+
|
|
79
|
+
runtime = get_runtime(ctx)
|
|
80
|
+
result = runtime.infer(
|
|
81
|
+
input_path=resolved_input,
|
|
82
|
+
output_path=resolved_output,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
if not quiet:
|
|
86
|
+
render_infer_result(result, verbose=verbose)
|
|
87
|
+
|
|
88
|
+
except Exception as exc:
|
|
89
|
+
print_error(str(exc))
|
|
90
|
+
if debug:
|
|
91
|
+
raise
|
|
92
|
+
raise typer.Exit(1) from exc
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from cli.constants.constants import (
|
|
8
|
+
HELP_DEBUG,
|
|
9
|
+
HELP_INPUT,
|
|
10
|
+
HELP_INTERACTIVE,
|
|
11
|
+
HELP_QUIET,
|
|
12
|
+
HELP_VERBOSE,
|
|
13
|
+
OPT_DEBUG,
|
|
14
|
+
OPT_INPUT,
|
|
15
|
+
OPT_INTERACTIVE,
|
|
16
|
+
OPT_QUIET,
|
|
17
|
+
OPT_VERBOSE,
|
|
18
|
+
)
|
|
19
|
+
from cli.presentation.core.console import print_error, print_header
|
|
20
|
+
from cli.presentation.core.interactive import ask_input_path, should_prompt
|
|
21
|
+
from cli.presentation.inspect.renderer import render_inspect_result
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def inspect_command(
|
|
25
|
+
ctx: typer.Context,
|
|
26
|
+
input_file: Path | None = typer.Option(
|
|
27
|
+
None,
|
|
28
|
+
f"--{OPT_INPUT}",
|
|
29
|
+
"-i",
|
|
30
|
+
help=HELP_INPUT,
|
|
31
|
+
exists=False,
|
|
32
|
+
file_okay=True,
|
|
33
|
+
dir_okay=False,
|
|
34
|
+
readable=True,
|
|
35
|
+
),
|
|
36
|
+
interactive: bool = typer.Option(
|
|
37
|
+
False,
|
|
38
|
+
f"--{OPT_INTERACTIVE}",
|
|
39
|
+
"-I",
|
|
40
|
+
help=HELP_INTERACTIVE,
|
|
41
|
+
),
|
|
42
|
+
debug: bool = typer.Option(False, f"--{OPT_DEBUG}", help=HELP_DEBUG),
|
|
43
|
+
verbose: bool = typer.Option(False, f"--{OPT_VERBOSE}", "-v", help=HELP_VERBOSE),
|
|
44
|
+
quiet: bool = typer.Option(False, f"--{OPT_QUIET}", "-q", help=HELP_QUIET),
|
|
45
|
+
) -> None:
|
|
46
|
+
"""Inspect an OpenAPI document."""
|
|
47
|
+
try:
|
|
48
|
+
from cli.main import get_runtime
|
|
49
|
+
|
|
50
|
+
resolved_input = input_file
|
|
51
|
+
|
|
52
|
+
prompt = should_prompt(interactive)
|
|
53
|
+
|
|
54
|
+
if resolved_input is None and prompt:
|
|
55
|
+
resolved_input = ask_input_path()
|
|
56
|
+
|
|
57
|
+
if resolved_input is None:
|
|
58
|
+
raise ValueError("missing required option: --input")
|
|
59
|
+
|
|
60
|
+
if not quiet:
|
|
61
|
+
print_header("Inspect", str(resolved_input))
|
|
62
|
+
|
|
63
|
+
runtime = get_runtime(ctx)
|
|
64
|
+
result = runtime.inspect(input_path=resolved_input)
|
|
65
|
+
|
|
66
|
+
if not quiet:
|
|
67
|
+
render_inspect_result(result, verbose=verbose)
|
|
68
|
+
|
|
69
|
+
except Exception as exc:
|
|
70
|
+
print_error(str(exc))
|
|
71
|
+
if debug:
|
|
72
|
+
raise
|
|
73
|
+
raise typer.Exit(1) from exc
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
|
|
7
|
+
from cli.constants.constants import (
|
|
8
|
+
HELP_DEBUG,
|
|
9
|
+
HELP_INPUT,
|
|
10
|
+
HELP_INTERACTIVE,
|
|
11
|
+
HELP_QUIET,
|
|
12
|
+
HELP_VERBOSE,
|
|
13
|
+
OPT_DEBUG,
|
|
14
|
+
OPT_INPUT,
|
|
15
|
+
OPT_INTERACTIVE,
|
|
16
|
+
OPT_QUIET,
|
|
17
|
+
OPT_VERBOSE,
|
|
18
|
+
)
|
|
19
|
+
from cli.presentation.core.console import print_error, print_header
|
|
20
|
+
from cli.presentation.core.interactive import ask_input_path, should_prompt
|
|
21
|
+
from cli.presentation.validate.renderer import render_validate_result
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def validate_command(
|
|
25
|
+
ctx: typer.Context,
|
|
26
|
+
input_file: Path | None = typer.Option(
|
|
27
|
+
None,
|
|
28
|
+
f"--{OPT_INPUT}",
|
|
29
|
+
"-i",
|
|
30
|
+
help=HELP_INPUT,
|
|
31
|
+
exists=False,
|
|
32
|
+
file_okay=True,
|
|
33
|
+
dir_okay=False,
|
|
34
|
+
readable=True,
|
|
35
|
+
),
|
|
36
|
+
interactive: bool = typer.Option(
|
|
37
|
+
False,
|
|
38
|
+
f"--{OPT_INTERACTIVE}",
|
|
39
|
+
"-I",
|
|
40
|
+
help=HELP_INTERACTIVE,
|
|
41
|
+
),
|
|
42
|
+
debug: bool = typer.Option(False, f"--{OPT_DEBUG}", help=HELP_DEBUG),
|
|
43
|
+
verbose: bool = typer.Option(False, f"--{OPT_VERBOSE}", "-v", help=HELP_VERBOSE),
|
|
44
|
+
quiet: bool = typer.Option(False, f"--{OPT_QUIET}", "-q", help=HELP_QUIET),
|
|
45
|
+
) -> None:
|
|
46
|
+
"""Validate an OpenAPI document."""
|
|
47
|
+
try:
|
|
48
|
+
from cli.main import get_runtime
|
|
49
|
+
|
|
50
|
+
resolved_input = input_file
|
|
51
|
+
|
|
52
|
+
prompt = should_prompt(interactive)
|
|
53
|
+
|
|
54
|
+
if resolved_input is None and prompt:
|
|
55
|
+
resolved_input = ask_input_path()
|
|
56
|
+
|
|
57
|
+
if resolved_input is None:
|
|
58
|
+
raise ValueError("missing required option: --input")
|
|
59
|
+
|
|
60
|
+
if not quiet:
|
|
61
|
+
print_header("Validate", str(resolved_input))
|
|
62
|
+
|
|
63
|
+
runtime = get_runtime(ctx)
|
|
64
|
+
result = runtime.validate(input_path=resolved_input)
|
|
65
|
+
|
|
66
|
+
if not quiet:
|
|
67
|
+
render_validate_result(result, verbose=verbose)
|
|
68
|
+
|
|
69
|
+
except Exception as exc:
|
|
70
|
+
print_error(str(exc))
|
|
71
|
+
if debug:
|
|
72
|
+
raise
|
|
73
|
+
raise typer.Exit(1) from exc
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""CLI constants and help text.
|
|
2
|
+
|
|
3
|
+
This module is owned by the CLI adapter. Runtime and engine modules must not
|
|
4
|
+
import from it.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
APP_NAME = "codepot-gen"
|
|
8
|
+
APP_DESCRIPTION = "Template-driven OpenAPI generator."
|
|
9
|
+
APP_VERSION = "0.1.0"
|
|
10
|
+
|
|
11
|
+
CMD_EMIT = "emit"
|
|
12
|
+
CMD_INFER = "infer"
|
|
13
|
+
CMD_INSPECT = "inspect"
|
|
14
|
+
CMD_VALIDATE = "validate"
|
|
15
|
+
|
|
16
|
+
OPT_INPUT = "input"
|
|
17
|
+
OPT_OUTPUT = "output"
|
|
18
|
+
OPT_LANGUAGE = "language"
|
|
19
|
+
OPT_TEMPLATES = "templates"
|
|
20
|
+
OPT_DRY_RUN = "dry-run"
|
|
21
|
+
OPT_INTERACTIVE = "interactive"
|
|
22
|
+
OPT_DEBUG = "debug"
|
|
23
|
+
OPT_VERBOSE = "verbose"
|
|
24
|
+
OPT_QUIET = "quiet"
|
|
25
|
+
OPT_VERSION = "version"
|
|
26
|
+
|
|
27
|
+
HELP_INPUT = "Input OpenAPI document."
|
|
28
|
+
HELP_OUTPUT = "Output directory or file, depending on the command."
|
|
29
|
+
HELP_OUTPUT_INFERENCE = "Optional inference JSON output path."
|
|
30
|
+
HELP_LANGUAGE = "Target language, for example debug, dart, or typescript."
|
|
31
|
+
HELP_TEMPLATES_PATH = "Custom template root. Defaults to templates/{language}."
|
|
32
|
+
HELP_DRY_RUN = "Plan output without writing generated files."
|
|
33
|
+
HELP_INTERACTIVE = "Prompt for missing command options interactively."
|
|
34
|
+
HELP_DEBUG = "Show traceback when an error occurs."
|
|
35
|
+
HELP_VERBOSE = "Show detailed CLI output."
|
|
36
|
+
HELP_QUIET = "Suppress normal CLI output."
|
|
37
|
+
HELP_VERSION = "Show version and exit."
|
|
38
|
+
|
|
39
|
+
HELP_EMIT = "Emit output for a target language."
|
|
40
|
+
HELP_INFER = "Run inference and optionally write inference JSON."
|
|
41
|
+
HELP_INSPECT = "Inspect an OpenAPI document."
|
|
42
|
+
HELP_VALIDATE = "Validate an OpenAPI document."
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Presentation layer constants."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
# Language choices for interactive prompts
|
|
6
|
+
LANGUAGE_CHOICES = ["debug", "dart", "typescript"]
|
|
7
|
+
|
|
8
|
+
# Default file names
|
|
9
|
+
DEFAULT_INFERENCE_OUTPUT = "inference.json"
|
|
10
|
+
|
|
11
|
+
# Default boolean prompt values
|
|
12
|
+
DEFAULT_CONFIRM = False
|
|
13
|
+
DEFAULT_DRY_RUN = True
|
|
14
|
+
DEFAULT_USE_CUSTOM_TEMPLATES = False
|
|
15
|
+
DEFAULT_WRITE_OUTPUT = False
|
|
16
|
+
|
|
17
|
+
# Acronym replacements for table key formatting
|
|
18
|
+
ACRONYM_REPLACEMENTS = {
|
|
19
|
+
"Api": "API",
|
|
20
|
+
"Openapi": "OpenAPI",
|
|
21
|
+
"Http": "HTTP",
|
|
22
|
+
"Json": "JSON",
|
|
23
|
+
"Yaml": "YAML",
|
|
24
|
+
"Url": "URL",
|
|
25
|
+
"Uri": "URI",
|
|
26
|
+
"Id": "ID",
|
|
27
|
+
"Dto": "DTO",
|
|
28
|
+
"Sdk": "SDK",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
# Tokens that indicate a numeric column for table formatting
|
|
32
|
+
NUMERIC_COLUMN_TOKENS = (
|
|
33
|
+
"count",
|
|
34
|
+
"total",
|
|
35
|
+
"files",
|
|
36
|
+
"operations",
|
|
37
|
+
"schemas",
|
|
38
|
+
"paths",
|
|
39
|
+
"refs",
|
|
40
|
+
"value",
|
|
41
|
+
)
|