schemantic 0.3.0 → 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/CHANGELOG.md +196 -174
- package/LICENSE +21 -21
- package/README.md +88 -830
- package/dist/cli/index.d.ts +4 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +185 -61
- package/dist/cli/index.js.map +1 -1
- package/dist/core/configuration.d.ts +6 -0
- package/dist/core/configuration.d.ts.map +1 -0
- package/dist/core/configuration.js +64 -0
- package/dist/core/configuration.js.map +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/output-writer.d.ts +7 -0
- package/dist/core/output-writer.d.ts.map +1 -0
- package/dist/core/output-writer.js +255 -0
- package/dist/core/output-writer.js.map +1 -0
- package/dist/core/schemantic.d.ts +8 -2
- package/dist/core/schemantic.d.ts.map +1 -1
- package/dist/core/schemantic.js +196 -71
- package/dist/core/schemantic.js.map +1 -1
- package/dist/generators/api-client-generator.d.ts +9 -20
- package/dist/generators/api-client-generator.d.ts.map +1 -1
- package/dist/generators/api-client-generator.js +364 -424
- package/dist/generators/api-client-generator.js.map +1 -1
- package/dist/generators/base.d.ts.map +1 -1
- package/dist/generators/base.js +7 -25
- package/dist/generators/base.js.map +1 -1
- package/dist/generators/enum-generator.d.ts.map +1 -1
- package/dist/generators/enum-generator.js +30 -3
- package/dist/generators/enum-generator.js.map +1 -1
- package/dist/generators/hook-generator.d.ts +3 -17
- package/dist/generators/hook-generator.d.ts.map +1 -1
- package/dist/generators/hook-generator.js +51 -445
- package/dist/generators/hook-generator.js.map +1 -1
- package/dist/generators/naming.d.ts +10 -0
- package/dist/generators/naming.d.ts.map +1 -0
- package/dist/generators/naming.js +331 -0
- package/dist/generators/naming.js.map +1 -0
- package/dist/generators/object-generator.d.ts +0 -4
- package/dist/generators/object-generator.d.ts.map +1 -1
- package/dist/generators/object-generator.js +13 -101
- package/dist/generators/object-generator.js.map +1 -1
- package/dist/generators/primitive-generator.d.ts +1 -13
- package/dist/generators/primitive-generator.d.ts.map +1 -1
- package/dist/generators/primitive-generator.js +11 -76
- package/dist/generators/primitive-generator.js.map +1 -1
- package/dist/generators/projections.d.ts +10 -0
- package/dist/generators/projections.d.ts.map +1 -0
- package/dist/generators/projections.js +65 -0
- package/dist/generators/projections.js.map +1 -0
- package/dist/generators/schema-type.d.ts +23 -0
- package/dist/generators/schema-type.d.ts.map +1 -0
- package/dist/generators/schema-type.js +233 -0
- package/dist/generators/schema-type.js.map +1 -0
- package/dist/parsers/base.d.ts +2 -0
- package/dist/parsers/base.d.ts.map +1 -1
- package/dist/parsers/base.js +12 -2
- package/dist/parsers/base.js.map +1 -1
- package/dist/parsers/factory.d.ts.map +1 -1
- package/dist/parsers/factory.js +2 -1
- package/dist/parsers/factory.js.map +1 -1
- package/dist/parsers/openapi.d.ts +4 -0
- package/dist/parsers/openapi.d.ts.map +1 -1
- package/dist/parsers/openapi.js +107 -20
- package/dist/parsers/openapi.js.map +1 -1
- package/dist/plugins/branded-types.d.ts.map +1 -1
- package/dist/plugins/branded-types.js +231 -365
- package/dist/plugins/branded-types.js.map +1 -1
- package/dist/plugins/builtin.d.ts.map +1 -1
- package/dist/plugins/builtin.js +6 -141
- package/dist/plugins/builtin.js.map +1 -1
- package/dist/plugins/index.d.ts +4 -0
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +17 -0
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/loader.d.ts +5 -1
- package/dist/plugins/loader.d.ts.map +1 -1
- package/dist/plugins/loader.js +42 -5
- package/dist/plugins/loader.js.map +1 -1
- package/dist/plugins/manager.d.ts.map +1 -1
- package/dist/plugins/manager.js +7 -7
- package/dist/plugins/manager.js.map +1 -1
- package/dist/plugins/performance-monitoring.d.ts +31 -1
- package/dist/plugins/performance-monitoring.d.ts.map +1 -1
- package/dist/plugins/performance-monitoring.js +146 -207
- package/dist/plugins/performance-monitoring.js.map +1 -1
- package/dist/plugins/request-deduplication.d.ts.map +1 -1
- package/dist/plugins/request-deduplication.js +151 -586
- package/dist/plugins/request-deduplication.js.map +1 -1
- package/dist/plugins/zod-validation.d.ts +23 -15
- package/dist/plugins/zod-validation.d.ts.map +1 -1
- package/dist/plugins/zod-validation.js +390 -268
- package/dist/plugins/zod-validation.js.map +1 -1
- package/dist/types/core.d.ts +20 -3
- package/dist/types/core.d.ts.map +1 -1
- package/dist/types/core.js +2 -0
- package/dist/types/core.js.map +1 -1
- package/dist/types/openapi.d.ts +14 -1
- package/dist/types/openapi.d.ts.map +1 -1
- package/docs/ADVANCED_PLUGINS_IMPLEMENTATION.md +24 -355
- package/docs/ADVANCED_PLUGIN_DEVELOPMENT.md +33 -309
- package/docs/API.md +80 -601
- package/docs/AUDIT.md +49 -0
- package/docs/CONFIGURATION.md +81 -715
- package/docs/FASTAPI_TUTORIAL.md +109 -1497
- package/docs/NAMING_MIGRATION.md +59 -0
- package/docs/PLUGINS.md +49 -687
- package/docs/PLUGIN_DEVELOPMENT.md +53 -720
- package/docs/REAUDIT.md +399 -0
- package/docs/RELEASING.md +88 -0
- package/docs/REMEDIATION.md +58 -0
- package/docs/superpowers/plans/2026-10-10-audit-remediation.md +113 -0
- package/package.json +114 -95
- package/dist/__tests__/setup.d.ts +0 -6
- package/dist/__tests__/setup.d.ts.map +0 -1
- package/dist/__tests__/setup.js +0 -30
- package/dist/__tests__/setup.js.map +0 -1
- package/dist/__tests__/test-config.d.ts +0 -36
- package/dist/__tests__/test-config.d.ts.map +0 -1
- package/dist/__tests__/test-config.js +0 -562
- package/dist/__tests__/test-config.js.map +0 -1
package/docs/AUDIT.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Project audit and verification
|
|
2
|
+
|
|
3
|
+
Audit date: 2026-10-10. Scope: generator orchestration, OpenAPI schema handling, generated TypeScript, fetch clients, first-party hooks, configured plugins, CLI behavior and release packaging. Validation ran on Windows with Node 25.3.0; CI configuration now targets Node 20, 22 and 24. Those CI versions were not run locally.
|
|
4
|
+
|
|
5
|
+
The original build, lint and tests passed, but several tests examined old generated files or only searched generated strings. New tests compile freshly generated output and exercise local HTTP and validation behavior. Helper files are no longer discovered as test suites or shipped in `dist`.
|
|
6
|
+
|
|
7
|
+
## Fixed and verified
|
|
8
|
+
|
|
9
|
+
| Area | Defects corrected | Evidence |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Type output | Composition/union precedence, array aliases, dictionaries, nullability, literal enums, invalid identifiers/property keys, duplicate enum keys and missing runtime exports | Fresh generated files and consuming code compiled with strict TypeScript, `exactOptionalPropertyTypes` and `noUncheckedIndexedAccess` |
|
|
12
|
+
| References and filtering | Component and nested JSON Pointer resolution, inherited parameters, incomplete dependency selection, unresolved refs silently generating bad output | Focused compile probes, dependency-filter tests and invalid-generation tests |
|
|
13
|
+
| Generation lifecycle | Stale state across repeated calls, input mutation, ignored configured plugins/custom generators, duplicate export/file collisions | Repeated-generation, plugin activation, custom generator and collision tests |
|
|
14
|
+
| Request transport | Unescaped paths, query arrays including named aliases, omitted headers/cookies, `Headers` merging, invalid positional optional parameters, URL-encoded object bodies | Fresh compilation and generated clients talking to local HTTP servers |
|
|
15
|
+
| Responses and retries | Unconditional JSON parsing, binary/text/empty response handling, repeated failed mutations/client errors, zero-delay retries | Local HTTP tests covering text, Blob, 204, transient reads, 400 and failed POST |
|
|
16
|
+
| Hooks | Incorrect type prefixes/client filenames, inconsistent inherited parameter arguments, repeat requests for equivalent inline input/options, stale query results | Generated hook compile tests and a deterministic React hook-state/dependency harness |
|
|
17
|
+
| Validation | Invalid interface decorators, lost wire/camelCase properties, numeric enum validation, nullable/unions/dictionaries, eager forward/recursive schema refs, cache naming isolation | Runtime execution of freshly generated Zod modules and strict compilation |
|
|
18
|
+
| Optional plugin output | Missing helper declarations/exports, invalid generic/phantom casts, always-true auth metadata guard, ignored disabled coalescing, cached mutations, unreachable stale-cache behavior | Plugin compile tests plus runtime auth transition, coalescing, mutation and stale-cache tests |
|
|
19
|
+
| CLI | Success exit codes on failure, config defaults overriding explicit settings, source precedence, ignored output selection, nonfunctional local watch, ignored `--fix`, misleading version | Spawned CLI tests including file-change regeneration and nonzero status checks |
|
|
20
|
+
| Packaging | Stale builds, Unix-only clean command, shipped test helpers, Node requirement mismatch | Clean build, pack contents inspection, package/lockfile and CI configuration alignment |
|
|
21
|
+
|
|
22
|
+
Focused regression tests are in [output-contract.test.ts](../src/__tests__/integration/output-contract.test.ts), [cli-contract.test.ts](../src/__tests__/integration/cli-contract.test.ts), [generated-shape.test.ts](../src/__tests__/generated-shape.test.ts) and [hook-runtime.test.ts](../src/__tests__/generators/hook-runtime.test.ts).
|
|
23
|
+
|
|
24
|
+
All six repository fixtures were freshly generated and strictly compiled in plain and Zod modes: `allof-inher-union`, `auth-file-uploads`, `edge-case`, `image-conversion-schema-openapi`, `nested-dictmap-datetime` and `pag-nested`.
|
|
25
|
+
|
|
26
|
+
Final checks: `npm test -- --runInBand` passed 14 suites and 184 tests; `npm run lint` completed without warnings; clean TypeScript build passed. `npm pack --dry-run --json --cache ./test-output/audit-npm-cache` included the CLI, declarations and documentation in 129 files, with no test/helper files. A workspace cache was used because the default user npm cache was inaccessible in the sandbox. No package was published.
|
|
27
|
+
|
|
28
|
+
## Current contracts and compatibility
|
|
29
|
+
|
|
30
|
+
- JSON keys retain their wire spelling. Types/classes use PascalCase; methods/locals follow `namingConvention`. The [naming migration](NAMING_MIGRATION.md) specifies the future camelCase default with runtime conversion and preservation configuration.
|
|
31
|
+
- First-party hooks use `generateHooks`/`--hooks` and require clients. The legacy `react-hooks` plugin remains outside the built-in list.
|
|
32
|
+
- The `validation` plugin is an alias for Zod validation. Install Zod 4 in the consuming project; interface output cannot accept class-validator decorators. Do not enable both validation aliases or combine plugins that produce duplicate public exports.
|
|
33
|
+
- Client-only generation expects a compatible `types.ts` from a previous/types-only generation when endpoints reference named schemas. Use `--client --types` for a complete fresh output directory.
|
|
34
|
+
- `--watch` requires a local file. Snapshot a remote schema first. CLI configs support JSON and CommonJS JavaScript (`.js`/`.cjs`); TypeScript config execution is not implemented.
|
|
35
|
+
- Invalid references/collisions fail explicitly. External references are unsupported. `--fix` now reports that automatic schema repair is unimplemented.
|
|
36
|
+
- Custom type mappings change static types; they do not deserialize dates or perform arbitrary value conversion.
|
|
37
|
+
- Node 20+ is required by the installed Commander major version.
|
|
38
|
+
|
|
39
|
+
## Verification boundaries and follow-up work
|
|
40
|
+
|
|
41
|
+
Passing these tests establishes the covered contracts, not complete OpenAPI/JSON Schema conformance. The parser performs structural validation, not every dialect constraint. Advanced parameter encodings (`deepObject`, matrix/label styles and per-property form encoding), remote references and many OpenAPI 3.1 schema keywords need dedicated support and contract tests.
|
|
42
|
+
|
|
43
|
+
The hook harness tests dependency and stale-query behavior; a real mounted React application, StrictMode behavior, concurrent mutations/reset/unmount behavior and browser cancellation were not tested. Browser-managed cookies require normal credential handling; browsers may disallow manually setting Cookie headers.
|
|
44
|
+
|
|
45
|
+
Advanced plugins provide opt-in helpers. Deduplication, monitoring, branded validation and Zod client validation are not automatically connected to every generated endpoint. They need explicit consumer integration. Cache regex invalidation/custom key generation and some cache statistics remain incomplete; several other advanced plugin options describe prospective behavior rather than implemented behavior. Treat these helpers as experimental pending a separate runtime integration audit. Branded auth metadata is type-state metadata, not server authorization.
|
|
46
|
+
|
|
47
|
+
`generateQueries` has no generator, and legacy optional-chaining/nullish-coalescing configuration flags are not consistently applied to generated clients/hooks. These should receive explicit unsupported-option diagnostics or be implemented/deprecated in the next configuration cleanup. Plugin hook exceptions are currently logged by the plugin manager and may leave partial enhancements; strict error propagation and atomic output replacement need separate lifecycle changes.
|
|
48
|
+
|
|
49
|
+
No live external FastAPI service, browser app, release publication or CI run was exercised. This audit preserves unrelated pre-existing workspace changes and does not publish or commit the work.
|