Skip to content

Copilot review mirror: output.artifacts (#3704 / upstream PR 3707) - #3

Closed
the-ult wants to merge 3 commits into
masterfrom
feat/3704-angular-artifact-groups
Closed

Copilot review mirror: output.artifacts (#3704 / upstream PR 3707)#3
the-ult wants to merge 3 commits into
masterfrom
feat/3704-angular-artifact-groups

Conversation

@the-ult

@the-ult the-ult commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Fork-local mirror PR to run Copilot review for upstream orval-labs#3707. Do not merge.

…rval-labs#3704)

Adds output.artifacts, an opt-in tags-split option that routes schemas,
mock (msw/faker), and client files into separate directories with their
own barrels, so consumers can import a client bundle without pulling in
msw/faker (and vice versa). Angular's httpResource generator duplicates
identical helper boilerplate (OrvalHttpResourceOptions, ResourceState,
toResourceState) into every .resource.ts file, so the new client barrel
re-exports those names explicitly from one canonical file before its
wildcard exports, avoiding a TS2308 ambiguous-export error whenever
'both' retrieval mode multi-tag output is combined with the new barrel.

100% backward compatible: artifacts is undefined by default, and all
existing snapshots are unchanged.

Fixes orval-labs#3704

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 11, 2026 08:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an output.artifacts configuration option to generate runtime-safe, independently importable output groups (schemas/client/msw/faker) in tags-split mode, plus supporting barrel generation and validation so Node consumers of MSW/Faker don’t transitively import Angular client modules.

Changes:

  • Implement output.artifacts normalization + validation and route mock outputs (MSW/Faker) into dedicated group directories.
  • Add a client-group barrel writer that re-exports generated per-tag client files and mitigates TS2308 collisions for duplicated Angular *.resource.ts boilerplate exports.
  • Extend tests, snapshots, sample Angular app output, and documentation to cover artifact-group generation and runtime-safety import graph expectations.

Reviewed changes

Copilot reviewed 113 out of 113 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/configs/mock.config.ts Adds a tags-split fetch config using artifacts groups for schemas/msw/faker.
tests/configs/angular.config.ts Adds Angular artifact-group configs (including zod schemas) for tags-split outputs.
tests/api-generation.spec.ts Adds import-graph walker tests ensuring artifact groups don’t cross-import runtime-specific modules.
tests/snapshots/mock/artifact-groups-fetch/schemas/petWithTag.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/pets.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/petCountry.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/petCallingCode.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/pet.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/listPetsSort.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/listPetsParams.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/labradoodleBreed.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/labradoodle.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/index.ts New snapshot barrel for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/error.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/dogType.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/dog.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/dachshundBreed.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/dachshund.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/createPetsSort.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/createPetsParams.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/createPetsBody.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/catType.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/schemas/cat.ts New snapshot for mock fetch schemas artifact group.
tests/snapshots/mock/artifact-groups-fetch/msw/pets/pets.msw.ts New snapshot for mock fetch MSW artifact group.
tests/snapshots/mock/artifact-groups-fetch/msw/index.msw.ts New snapshot barrel for mock fetch MSW artifact group.
tests/snapshots/mock/artifact-groups-fetch/msw/health/health.msw.ts New snapshot for mock fetch MSW artifact group.
tests/snapshots/mock/artifact-groups-fetch/faker/pets/pets.faker.ts New snapshot for mock fetch Faker artifact group.
tests/snapshots/mock/artifact-groups-fetch/faker/index.faker.ts New snapshot barrel for mock fetch Faker artifact group.
tests/snapshots/mock/artifact-groups-fetch/faker/health/health.faker.ts New snapshot for mock fetch Faker artifact group.
tests/snapshots/mock/artifact-groups-fetch/client/pets/pets.ts New snapshot for mock fetch client artifact group.
tests/snapshots/mock/artifact-groups-fetch/client/index.ts New snapshot barrel for mock fetch client artifact group.
tests/snapshots/mock/artifact-groups-fetch/client/health/health.ts New snapshot for mock fetch client artifact group.
tests/snapshots/mock/artifact-groups-fetch/client/common-types.ts New snapshot for mock fetch client common-types.
tests/snapshots/angular/artifact-groups/schemas/searchPetsBodyStatus.ts New snapshot for Angular schemas artifact group.
tests/snapshots/angular/artifact-groups/schemas/searchPetsBody.ts New snapshot for Angular schemas artifact group.
tests/snapshots/angular/artifact-groups/schemas/pets.ts New snapshot for Angular schemas artifact group.
tests/snapshots/angular/artifact-groups/schemas/pet.ts New snapshot for Angular schemas artifact group.
tests/snapshots/angular/artifact-groups/schemas/index.ts New snapshot barrel for Angular schemas artifact group.
tests/snapshots/angular/artifact-groups/schemas/error.ts New snapshot for Angular schemas artifact group.
tests/snapshots/angular/artifact-groups/schemas/createPetsBody.ts New snapshot for Angular schemas artifact group.
tests/snapshots/angular/artifact-groups/msw/pets/pets.msw.ts New snapshot for Angular MSW artifact group.
tests/snapshots/angular/artifact-groups/msw/index.msw.ts New snapshot barrel for Angular MSW artifact group.
tests/snapshots/angular/artifact-groups/msw/health/health.msw.ts New snapshot for Angular MSW artifact group.
tests/snapshots/angular/artifact-groups/faker/pets/pets.faker.ts New snapshot for Angular Faker artifact group.
tests/snapshots/angular/artifact-groups/faker/index.faker.ts New snapshot barrel for Angular Faker artifact group.
tests/snapshots/angular/artifact-groups/faker/health/health.faker.ts New snapshot for Angular Faker artifact group.
tests/snapshots/angular/artifact-groups/client/pets/pets.service.ts New snapshot for Angular client artifact group (service).
tests/snapshots/angular/artifact-groups/client/pets/pets.resource.ts New snapshot for Angular client artifact group (resource).
tests/snapshots/angular/artifact-groups/client/index.ts New snapshot client barrel handling service/resource exports.
tests/snapshots/angular/artifact-groups/client/health/health.service.ts New snapshot for Angular client artifact group (service).
tests/snapshots/angular/artifact-groups/client/health/health.resource.ts New snapshot for Angular client artifact group (resource).
tests/snapshots/angular/artifact-groups-zod/schemas/petWithTag.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/pets.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/pet.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/listPetsParams.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/listPetsHeaders.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/labradoodle.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/index.ts New snapshot barrel for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/error.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/dog.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/dachshund.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/createPetsParams.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/createPetsHeaders.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/createPetsBody.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/schemas/cat.zod.ts New snapshot for Angular zod schemas artifact group.
tests/snapshots/angular/artifact-groups-zod/msw/pets/pets.msw.ts New snapshot for Angular zod MSW artifact group.
tests/snapshots/angular/artifact-groups-zod/msw/index.msw.ts New snapshot barrel for Angular zod MSW artifact group.
tests/snapshots/angular/artifact-groups-zod/msw/health/health.msw.ts New snapshot for Angular zod MSW artifact group.
tests/snapshots/angular/artifact-groups-zod/faker/pets/pets.faker.ts New snapshot for Angular zod Faker artifact group.
tests/snapshots/angular/artifact-groups-zod/faker/index.faker.ts New snapshot barrel for Angular zod Faker artifact group.
tests/snapshots/angular/artifact-groups-zod/faker/health/health.faker.ts New snapshot for Angular zod Faker artifact group.
tests/snapshots/angular/artifact-groups-zod/client/pets/pets.service.ts New snapshot for Angular zod client artifact group.
tests/snapshots/angular/artifact-groups-zod/client/index.ts New snapshot client barrel for Angular zod artifact group.
tests/snapshots/angular/artifact-groups-zod/client/health/health.service.ts New snapshot for Angular zod client artifact group.
samples/angular-app/src/api/artifact-groups/schemas/searchPetsStatus.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/schemas/searchPetsParams.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/schemas/petStatus.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/schemas/pets.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/schemas/pet.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/schemas/listPetsParams.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/schemas/index.ts New generated schemas barrel in sample output.
samples/angular-app/src/api/artifact-groups/schemas/error.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/schemas/createPetsBodyStatus.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/schemas/createPetsBody.ts New generated sample output for schemas artifact group.
samples/angular-app/src/api/artifact-groups/msw/pets/pets.msw.ts New generated sample output for MSW artifact group.
samples/angular-app/src/api/artifact-groups/msw/index.msw.ts New generated MSW barrel in sample output.
samples/angular-app/src/api/artifact-groups/client/pets/pets.resource.ts New generated sample output for Angular client artifact group (resource).
samples/angular-app/src/api/artifact-groups/client/index.ts New generated client barrel in sample output.
samples/angular-app/orval.config.ts Adds sample config using output.artifacts and related overrides.
samples/angular-app/snapshots/api/artifact-groups/schemas/searchPetsStatus.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/schemas/searchPetsParams.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/schemas/petStatus.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/schemas/pets.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/schemas/pet.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/schemas/listPetsParams.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/schemas/index.ts Snapshot for sample schemas barrel output.
samples/angular-app/snapshots/api/artifact-groups/schemas/error.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/schemas/createPetsBodyStatus.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/schemas/createPetsBody.ts Snapshot for sample artifact-group schemas output.
samples/angular-app/snapshots/api/artifact-groups/msw/index.msw.ts Snapshot for sample MSW barrel output.
samples/angular-app/snapshots/api/artifact-groups/client/pets/pets.resource.ts Snapshot for sample Angular client resource output.
samples/angular-app/snapshots/api/artifact-groups/client/index.ts Snapshot for sample client barrel output.
packages/orval/src/write-specs.ts Adds reusable barrel appender + new client-group barrel writer integrated into write flow.
packages/orval/src/write-specs.test.ts Adds tests for barrel append/create and client-group barrel generation behavior.
packages/orval/src/utils/options.ts Adds output.artifacts normalization/validation and mock routing behavior.
packages/orval/src/utils/options.test.ts Adds normalization tests for output.artifacts rules and interactions.
packages/orval/src/generate-spec.ts Extends clean behavior to remove files in artifacts MSW/Faker group directories.
packages/core/src/types.ts Adds public types for OutputArtifactsOptions and NormalizedArtifactsOptions.
docs/content/docs/reference/configuration/output.mdx Documents the new output.artifacts option and its interaction rules.
docs/content/docs/guides/angular.mdx Adds an Angular guide section explaining runtime-safe artifact groups and usage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/orval/src/write-specs.ts Outdated
Comment on lines +163 to +177
if (await fs.pathExists(indexFile)) {
const data = await fs.readFile(indexFile, 'utf8');
const reExportsNotDeclared = namedReExports.filter(
(line) => !data.includes(line),
);
const importsNotDeclared = imports.filter(
(imp) => !data.includes(`export * from '${imp}'`),
);
await fs.appendFile(
indexFile,
reExportsNotDeclared.map((line) => `${line}\n`).join('') +
unique(importsNotDeclared)
.map((imp) => `export * from '${imp}';\n`)
.join(''),
);
Comment thread packages/orval/src/write-specs.test.ts Outdated
await rm(workspace, { recursive: true, force: true });
});

it('creates a new barrel file with sorted export lines', async () => {
Addresses Copilot review on the artifacts barrel helper: appending to an
existing index now inserts a separating newline when the file lacks a
trailing one and dedupes named re-exports; the misleading 'sorted' test
name is corrected (the caller sorts, the helper preserves order) and the
new edge cases are covered by tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@the-ult

the-ult commented Jul 11, 2026

Copy link
Copy Markdown
Owner Author

Both findings addressed in 894a52f: append path now inserts a separating newline when the existing barrel lacks a trailing one and dedupes named re-exports (with new unit tests for both edge cases); the 'sorted' test name was corrected — sorting happens in writeClientGroupBarrel (.toSorted(localeCompare)), the helper intentionally preserves caller order.

…ts mocks

CodeRabbit review: the type-matching findIndex skipped function-form
generators, making the conflict guard dead code — a generators array with
only a function-form entry silently gained an appended default generator.
The guard is now hoisted before matching and rejects any function-form
entry, since its type/path cannot be inspected or redirected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@the-ult

the-ult commented Jul 11, 2026

Copy link
Copy Markdown
Owner Author

Copilot review complete; findings addressed on the branch (reflected in the upstream PR). Closing this do-not-merge mirror.

@the-ult the-ult closed this Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants