fix(mock): strict faker schema mock types for enums, nested spreads, and binary - #3591
fix(mock): strict faker schema mock types for enums, nested spreads, and binary#3591Hypenate wants to merge 9 commits into
Conversation
…and binary
Classify strict {Schema}Mock aliases by schema shape.
Cast nested factory spreads to base mock types.
Add petstore regression spec for #3590.
Co-authored-by: Cursor <cursoragent@cursor.com>
📝 WalkthroughWalkthroughAdds StrictMockSchemaKind classification, threads per-type kind maps through mock generators and writers, emits kind-aware strict mock type declarations and conditional casts in faker output, introduces import-recovery/merge utilities, and expands tests and fixtures for issue-3590 scenarios. ChangesStrict Mock Schema Kinds: Classification, Propagation, and Type Emission
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
packages/core/src/writers/target.ts (1)
83-87: ⚡ Quick winRemove the redundant fallback in the
strictMockSchemaKindsmerge helper paths.The same
...(x ?? {})pattern appears inpackages/core/src/writers/target.tsandpackages/core/src/writers/target-tags.ts, and both sites are hittingunicorn/no-useless-fallback-in-spreadin CI. A straight spread of the optional map is enough in each file.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/writers/target.ts` around lines 83 - 87, The merge uses a redundant fallback spread like ...(acc.strictMockSchemaKinds ?? {}) which triggers unicorn/no-useless-fallback-in-spread; update the helper merges (e.g., where acc.strictMockSchemaKinds and opMock.strictMockSchemaKinds are combined in the target.ts and the analogous site in target-tags.ts) to simply spread the optional maps without the ?? {} fallback (e.g., ...(acc.strictMockSchemaKinds) and ...(opMock.strictMockSchemaKinds) or only spread opMock.strictMockSchemaKinds into acc), removing the unnecessary nullish-coalescing wrapper.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/mock/src/faker/index.test.ts`:
- Around line 15-19: Remove the unused imports to fix TypeScript/ESLint errors:
in the import that currently lists classifyStrictMockSchemaType,
collectStrictMockSchemaTypeNamesFromImplementation, and
dedupeStrictMockTypeDeclarations, delete the unused symbols
classifyStrictMockSchemaType and
collectStrictMockSchemaTypeNamesFromImplementation and only keep
dedupeStrictMockTypeDeclarations so the test file imports just the symbol it
actually uses.
In `@packages/mock/src/mock-types.test.ts`:
- Around line 357-366: The test currently force-casts the fixture to
ResReqTypesValue[] causing TS2352; change the cast to go through an unknown
intermediate (e.g., cast the literal to unknown and then to ResReqTypesValue[])
or replace the fixture with a fully typed object matching ResReqTypesValue so
the compiler accepts the shape; update the responses declaration (variable name:
responses) to use the safer "as unknown as ResReqTypesValue[]" pattern or
construct values that satisfy the ResReqTypesValue interface instead.
In `@packages/mock/src/msw/index.ts`:
- Around line 502-504: The object spread for strictMockSchemaKinds uses a
redundant nullish fallback; remove the "?? {}" so the spread only references
baseDefinition.strictMockSchemaKinds to satisfy
unicorn/no-useless-fallback-in-spread; update the const strictMockSchemaKinds
declaration to spread baseDefinition.strictMockSchemaKinds directly.
---
Nitpick comments:
In `@packages/core/src/writers/target.ts`:
- Around line 83-87: The merge uses a redundant fallback spread like
...(acc.strictMockSchemaKinds ?? {}) which triggers
unicorn/no-useless-fallback-in-spread; update the helper merges (e.g., where
acc.strictMockSchemaKinds and opMock.strictMockSchemaKinds are combined in the
target.ts and the analogous site in target-tags.ts) to simply spread the
optional maps without the ?? {} fallback (e.g., ...(acc.strictMockSchemaKinds)
and ...(opMock.strictMockSchemaKinds) or only spread
opMock.strictMockSchemaKinds into acc), removing the unnecessary
nullish-coalescing wrapper.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 21e08a84-5e98-4cce-90da-228625678410
⛔ Files ignored due to path filters (36)
tests/__snapshots__/mock/issue-3525-multi/endpoints.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3525/model/index.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split-fetch/pets/index.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split-fetch/pets/index.msw.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split-fetch/pets/pets/pets.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split-fetch/pets/pets/pets.msw.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split-fetch/pets/pets/pets.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split-fetch/schemas/index.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split-fetch/schemas/index.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split-fetch/schemas/pet.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split/pets/index.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split/pets/index.msw.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split/pets/pets/pets.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split/pets/pets/pets.msw.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split/pets/pets/pets.service.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split/schemas/index.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3572-strict-mock-tags-split/schemas/pet.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3574-strict-mock-tags-split-fetch/pets/pets/pets.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3574-strict-mock-tags-split-fetch/pets/pets/pets.msw.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3574-strict-mock-tags-split-multi-fetch/store/store/store.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3574-strict-mock-tags-split-multi-fetch/store/store/store.msw.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3574-strict-mock-tags-split/pets/pets/pets.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3574-strict-mock-tags-split/pets/pets/pets.msw.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/endpoints.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/index.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/index.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/pet.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/petCategory.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/petDetail.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/petDetailSettingsItem.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/petList.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/petProfile.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/petSetting.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/photoUpload.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/score.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590/model/status.tsis excluded by!**/__snapshots__/**
📒 Files selected for processing (16)
packages/core/src/types.tspackages/core/src/writers/finalize-mock-implementation.tspackages/core/src/writers/target-tags.tspackages/core/src/writers/target.tspackages/mock/src/faker/getters/array-item-factory.tspackages/mock/src/faker/index.test.tspackages/mock/src/faker/index.tspackages/mock/src/faker/resolvers/value.tspackages/mock/src/mock-types.test.tspackages/mock/src/mock-types.tspackages/mock/src/msw/index.tspackages/orval/src/client.tspackages/orval/src/write-specs.tstests/api-generation.spec.tstests/configs/mock.config.tstests/specifications/issue-3590.yaml
Co-authored-by: Cursor <cursoragent@cursor.com>
|
@wadakatu We still have some issues wit the latest version of Orval. |
Import {Schema}Mock from index.faker when operation fakers spread schema
factories with strict casts. Skip imports that duplicate local response mocks.
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/core/src/writers/split-tags-mode.ts`:
- Around line 259-277: The import pruning is happening unconditionally by
calling filterLocalStrictMockTypeImports(...) before checking
builder.finalizeMockImplementation, which removes strict schema type imports
even when the builder will not emit local `{Schema}Mock` aliases; change the
code so you only call filterLocalStrictMockTypeImports and pass its result into
generateImportsForBuilder when builder.finalizeMockImplementation is truthy
(i.e., move the filter/filtered-imports logic behind the same
builder.finalizeMockImplementation check), using the same
getFinalizeMockImplementationOptions(...) /
finalizeMockOptions.strictSchemaTypeNames and mockOutput.imports symbols to
compute the filtered set only when finalizeMockImplementation will run.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 74b6468c-c206-4599-8aeb-d46d94b33c1d
📒 Files selected for processing (5)
packages/core/src/writers/finalize-mock-implementation.tspackages/core/src/writers/split-tags-mode.tspackages/core/src/writers/tags-mode.tspackages/mock/src/faker/index.tspackages/mock/src/faker/resolvers/value.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/core/src/writers/finalize-mock-implementation.ts
- packages/mock/src/faker/resolvers/value.ts
- packages/mock/src/faker/index.ts
| const finalizeMockOptions = getFinalizeMockImplementationOptions( | ||
| output, | ||
| mockOutput, | ||
| ); | ||
|
|
||
| const importsMockForBuilder = generateImportsForBuilder( | ||
| output, | ||
| mockOutput.imports, | ||
| filterLocalStrictMockTypeImports( | ||
| mockOutput.imports, | ||
| finalizeMockOptions.strictSchemaTypeNames, | ||
| ), | ||
| mockRelativeSchemasPath, | ||
| ); | ||
|
|
||
| const finalizedMockImplementation = builder.finalizeMockImplementation | ||
| ? builder.finalizeMockImplementation( | ||
| mockOutput.implementation, | ||
| getFinalizeMockImplementationOptions(output, mockOutput), | ||
| finalizeMockOptions, | ||
| ) |
There was a problem hiding this comment.
Only remove external strict mock type imports when local aliases will actually be emitted.
packages/core/src/writers/split-tags-mode.ts and packages/core/src/writers/tags-mode.ts now call filterLocalStrictMockTypeImports(...) before checking whether builder.finalizeMockImplementation exists. That couples import pruning to strictSchemaTypeNames, but not to the step that turns those names into local {Schema}Mock declarations. For builders that do not implement finalizeMockImplementation, the generated mock file keeps the strict casts but loses the imported type, producing an unresolved identifier. Gate the filtering behind the same builder.finalizeMockImplementation check in both files.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/core/src/writers/split-tags-mode.ts` around lines 259 - 277, The
import pruning is happening unconditionally by calling
filterLocalStrictMockTypeImports(...) before checking
builder.finalizeMockImplementation, which removes strict schema type imports
even when the builder will not emit local `{Schema}Mock` aliases; change the
code so you only call filterLocalStrictMockTypeImports and pass its result into
generateImportsForBuilder when builder.finalizeMockImplementation is truthy
(i.e., move the filter/filtered-imports logic behind the same
builder.finalizeMockImplementation check), using the same
getFinalizeMockImplementationOptions(...) /
finalizeMockOptions.strictSchemaTypeNames and mockOutput.imports symbols to
compute the filtered set only when finalizeMockImplementation will run.
|
I'm going for a full AI approach here... I'll let it make a local build of Orval and check again against all our yaml files. I'm not sure how we'll do the review process here... |
…ports (#3590) Use appendImportsDelta to avoid stack overflows with schemas: true. Recover missing get*Mock imports in tags-split faker files. Guard MSW generation when response.imports is undefined. Add pet-themed regression specs and tests for each failure mode. Co-authored-by: Cursor <cursoragent@cursor.com>
Use OpenApiSchemaObject and createTestContextSpec override options. Cast undefined response imports via unknown for the runtime guard test. Co-authored-by: Cursor <cursoragent@cursor.com>
Merge getMockScalar result imports in generateFakerForSchemas. Collect nested oneOf split helper types and filter local strict mock imports in single mode. Co-authored-by: Cursor <cursoragent@cursor.com>
PetDetailSettingsItem is referenced by strict mock factories and must be imported in index.faker.ts. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/core/src/writers/split-tags-mode.ts (1)
289-299:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winOnly filter local strict mock type imports when local aliases will be emitted.
The call to
filterLocalStrictMockTypeImportsat line 291 is unconditional, but local{Schema}Mocktype declarations are only emitted whenbuilder.finalizeMockImplementationexists (lines 268-273). For builders without finalization support, this removes strict schema type imports while the generated mock file keeps strict casts that reference those types, producing unresolved identifier errors.Gate the filtering behind the same
builder.finalizeMockImplementationcheck:🔒 Proposed fix to conditionally filter imports
- const importsMockForBuilder = generateImportsForBuilder( - output, - filterLocalStrictMockTypeImports( - mergeGeneratorImports( - mockOutput.imports, - recoveredSchemaFactoryImports, - ), - finalizeMockOptions.strictSchemaTypeNames, - ), - mockRelativeSchemasPath, - ); + const mergedImports = mergeGeneratorImports( + mockOutput.imports, + recoveredSchemaFactoryImports, + ); + const filteredImports = builder.finalizeMockImplementation + ? filterLocalStrictMockTypeImports( + mergedImports, + finalizeMockOptions.strictSchemaTypeNames, + ) + : mergedImports; + const importsMockForBuilder = generateImportsForBuilder( + output, + filteredImports, + mockRelativeSchemasPath, + );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/core/src/writers/split-tags-mode.ts` around lines 289 - 299, The call to filterLocalStrictMockTypeImports is unconditional and removes strict schema type imports even when local {Schema}Mock type aliases are not emitted; update the generateImportsForBuilder invocation so that filterLocalStrictMockTypeImports is only applied when builder.finalizeMockImplementation is truthy: use mergeGeneratorImports(mockOutput.imports, recoveredSchemaFactoryImports) directly for the imports argument when builder.finalizeMockImplementation is falsy, and wrap/filter with filterLocalStrictMockTypeImports(..., finalizeMockOptions.strictSchemaTypeNames) only when builder.finalizeMockImplementation exists (referencing generateImportsForBuilder, filterLocalStrictMockTypeImports, mergeGeneratorImports, mockOutput.imports, recoveredSchemaFactoryImports, finalizeMockOptions.strictSchemaTypeNames, and builder.finalizeMockImplementation).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@packages/core/src/writers/split-tags-mode.ts`:
- Around line 289-299: The call to filterLocalStrictMockTypeImports is
unconditional and removes strict schema type imports even when local
{Schema}Mock type aliases are not emitted; update the generateImportsForBuilder
invocation so that filterLocalStrictMockTypeImports is only applied when
builder.finalizeMockImplementation is truthy: use
mergeGeneratorImports(mockOutput.imports, recoveredSchemaFactoryImports)
directly for the imports argument when builder.finalizeMockImplementation is
falsy, and wrap/filter with filterLocalStrictMockTypeImports(...,
finalizeMockOptions.strictSchemaTypeNames) only when
builder.finalizeMockImplementation exists (referencing
generateImportsForBuilder, filterLocalStrictMockTypeImports,
mergeGeneratorImports, mockOutput.imports, recoveredSchemaFactoryImports,
finalizeMockOptions.strictSchemaTypeNames, and
builder.finalizeMockImplementation).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 398f0e31-c200-4f06-819a-c5fb203cf807
⛔ Files ignored due to path filters (45)
tests/__snapshots__/mock/issue-3590-binary-response-imports/endpoints.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-binary-response-imports/model/index.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/pets/pets/pets.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/pets/pets/pets.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/schemas/healthStatus.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/schemas/index.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/schemas/index.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/schemas/pet.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/schemas/petDetailResponse.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/schemas/petOwner.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-tags-split-schema-imports/schemas/responseBase.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/endpoints.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child0.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child1.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child10.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child11.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child12.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child13.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child14.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child15.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child16.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child17.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child18.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child19.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child2.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child20.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child21.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child22.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child23.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child24.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child25.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child26.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child27.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child28.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child29.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child3.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child4.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child5.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child6.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child7.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child8.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/child9.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/index.faker.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/index.tsis excluded by!**/__snapshots__/**tests/__snapshots__/mock/issue-3590-wide-schema-imports/model/wideParent.tsis excluded by!**/__snapshots__/**
📒 Files selected for processing (21)
packages/core/src/writers/mock-imports.test.tspackages/core/src/writers/mock-imports.tspackages/core/src/writers/single-mode.tspackages/core/src/writers/split-mode.tspackages/core/src/writers/split-tags-mode.tspackages/core/src/writers/tags-mode.tspackages/mock/src/faker/getters/combine.tspackages/mock/src/faker/getters/object.test.tspackages/mock/src/faker/getters/object.tspackages/mock/src/faker/imports.test.tspackages/mock/src/faker/imports.tspackages/mock/src/faker/index.test.tspackages/mock/src/faker/index.tspackages/mock/src/faker/resolvers/value.tspackages/mock/src/msw/mocks.test.tspackages/mock/src/msw/mocks.tstests/api-generation.spec.tstests/configs/mock.config.tstests/specifications/issue-3590-binary-response-imports.yamltests/specifications/issue-3590-tags-split-schema-imports.yamltests/specifications/issue-3590-wide-schema-imports.yaml
✅ Files skipped from review due to trivial changes (2)
- packages/core/src/writers/mock-imports.test.ts
- packages/mock/src/msw/mocks.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/core/src/writers/tags-mode.ts
- packages/mock/src/faker/resolvers/value.ts
- packages/mock/src/faker/index.ts
|
The build is green, but we have almost 100 changed files... Do we go yolo mode or do I split this up? |
Summary
{Schema}Mockaliases: mapped types for objects, type aliases for enums/scalars/arrays, andArrayBufferfor binary faker schema mocksget*Mock()spreads to base mock types soMockWithNullableOverridesparent casts typecheckschemas/index.faker.tstests/specifications/issue-3590.yaml(followsissue-3525.yamlstyle)Fixes #3590
Test plan
packages/mockunit tests (247 pass)tests/generated/mocktypecheck passes (node tests/scripts/typecheck-generated.mjs)mock issue-3590 strict faker schema mocks typecheck and emit correct aliasesSummary by CodeRabbit
New Features
Bug Fixes
Tests