Skip to content

Comments

feat(angular): add angular httpResource support#2923

Draft
the-ult wants to merge 45 commits intoorval-labs:masterfrom
the-ult:feat/add-angular-http-resource
Draft

feat(angular): add angular httpResource support#2923
the-ult wants to merge 45 commits intoorval-labs:masterfrom
the-ult:feat/add-angular-http-resource

Conversation

@the-ult
Copy link
Contributor

@the-ult the-ult commented Feb 8, 2026

Summary

This PR introduces Angular httpResource service generation (signal-first APIs) and expands the Angular sample app to showcase both httpResource and httpResource + Zod flows alongside the existing HttpClient output.

Related issue

Primary focus — httpResource generation (packages/angular + core)

  • Adds a dedicated httpResource generator that emits signal-first resource functions for retrieval operations, while keeping HttpClient service methods for mutations.
  • Supports per-operation overrides via override.operations.<operationId>.angular.client to force httpResource, httpClient, or both.
  • Introduces route registry + shared return type registries to ensure correct resource generation and type aliases.
  • Generates ResourceState utilities (ResourceState<T> and toResourceState) for ergonomic status handling in signal-based flows.
  • Adds content-type-aware factories for resource outputs (httpResource, .text, .arrayBuffer, .blob).
  • Adds Zod runtime validation for httpResource JSON responses when schemas.type: 'zod' (with an opt-out via runtimeValidation: false).
  • Adds a both-mode extra file (*.resource.ts) to emit resources alongside HttpClient output.

Expanded Angular sample app (samples/angular-app)

  • Adds two new routes/pages:
    • /http-resource — demonstrates signal-first httpResource usage.
    • /http-resource-zod — demonstrates httpResource with Zod runtime validation.
  • Updates orval.config.ts to generate new http-resource and http-resource-zod outputs, including mock support.
  • Adds sample-generated client artifacts for the new outputs to make the demo self-contained.

Docs & guidance

  • Updates the Angular guide to document httpResource output, configuration, and Zod runtime validation behaviors.
  • Clarifies the experimental status of httpResource (Angular v19.2+).

Other improvements / related fixes

  • Normalizes Angular override defaults in config parsing (runtimeValidation, client, provideIn).
  • Extends Angular fixtures in tests to cover httpResource and Zod validation toggles.
  • Adds extensive generator tests for http-resource and http-client outputs.
  • Lint generated fixtures: Adds lint:generated (root script + Turbo task + tests workspace script) to validate generated outputs in generated, which are updated by this PR’s new Angular httpResource fixtures.

Angular Query compatibility fix

Aligns generated Angular Query mutation onSuccess callbacks with the current TanStack Query signature (adds context argument).
Required because this PR updates the Angular catalogs and sample outputs; without it, the Angular Query samples fail to typecheck.

Other unrelated changes

  • MSW mock generator refinements (response content-type handling for text/plain and header outputs).
  • Miscellaneous sample/config updates (Angular/Next sample package updates and lint config alignment).

Tests

  • Added/updated generator tests for packages/angular/src/http-resource.ts and packages/angular/src/http-client.ts.

The Ult added 6 commits February 8, 2026 01:42
Introduce a dedicated httpResource client generator with route tracking\nand resource return-type registries.

Add shared dependency/templates utilities, new tests, and expose the\nangular client mode (httpClient/httpResource/both) through config\nnormalization and generator selection.
Split generated API outputs into http-client and http-resource targets\nwith updated MSW mocks and sample pages.

Add routing and UI for the new httpResource screen plus the versioned\npath transformer used by both outputs.
Add lint:generated task wiring across root and tests, and update\nturbo pipeline + README guidance.

Introduce ESLint configs for Angular/Next samples and refresh Angular\ncatalog + dependencies to include Angular ESLint support.
- add url-only httpResource generation and zod parse options

- normalize angular runtimeValidation and update config/types/tests

- document httpResource output and add zod sample pages/output
- precompute delay expressions to handle function delays safely

- expand MSW tests and update angular sample mocks

- expose MSW_DELAY in turbo global env
- resolve schema path when schemas is an object

- avoid cleaning the wrong directory during generation
Copilot AI review requested due to automatic review settings February 8, 2026 13:58
@the-ult
Copy link
Contributor Author

the-ult commented Feb 8, 2026

Initial setup to add httpResource functionality.
Even thought httpResource is still experimental. It is already used in many production environments. (and it will probably be in Developer Preview (or even stable) in the next release (v22) in may.
And even when API's change, that will be easy to fix/adjust to.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-class Angular httpResource (signal-first) client generation to Orval, plus sample app and documentation updates to demonstrate HttpClient, httpResource, and httpResource + Zod flows.

Changes:

  • Implement Angular httpResource generator (including “both” mode extra *.resource.ts output) with route/return-type registries and ResourceState helpers.
  • Extend config normalization + core types to support override.angular.client and override.angular.runtimeValidation, and improve schema-cleaning for object-form schemas.
  • Update samples/docs/tooling (Angular sample routes, generated artifacts, MSW tweaks, ESLint/turbo scripts, dependency catalogs).

Reviewed changes

Copilot reviewed 60 out of 63 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
turbo.json Adds MSW_DELAY to global env and introduces lint:generated task.
tests/package.json Adds lint:generated script for generated fixtures.
tests/configs/angular.config.ts Adds Angular test outputs for httpResource + Zod (and validation-disabled) variants.
samples/next-app-with-fetch/package.json Switches lint to eslint and adds flat-config dependencies.
samples/next-app-with-fetch/eslint.config.mjs Adds ESLint flat config for Next sample.
samples/angular-query/package.json Adds Angular ESLint + ESLint v9 toolchain deps.
samples/angular-query/eslint.config.mjs Adds ESLint flat config for Angular Query sample.
samples/angular-query/angular.json Adds @angular-eslint lint builder target.
samples/angular-app/src/orval/transformer/add-version.js Adds OpenAPI transformer to prefix versioned routes.
samples/angular-app/src/orval/node.ts Aggregates multiple generated MSW mock bundles for node tests.
samples/angular-app/src/orval/browser.ts Aggregates multiple generated MSW mock bundles for browser worker.
samples/angular-app/src/app/http-resource.page.ts Adds sample page demonstrating httpResource usage.
samples/angular-app/src/app/http-resource-zod.page.ts Adds sample page demonstrating httpResource + Zod validation.
samples/angular-app/src/app/http-resource-zod.page.spec.ts Adds basic component tests for the Zod resource page.
samples/angular-app/src/app/http-client.page.ts Adds sample page demonstrating HttpClient output + content-type overloads.
samples/angular-app/src/app/app.ts Refactors root component to a router-based sample navigation.
samples/angular-app/src/app/app.spec.ts Updates root component test to account for router navigation links.
samples/angular-app/src/app/app.routes.ts Adds routes for HttpClient / httpResource / httpResource+Zod demo pages.
samples/angular-app/src/app/app.config.ts Adds router provider to standalone app config.
samples/angular-app/src/api/model-zod/searchPetsParams.zod.ts Adds generated Zod schema artifacts for sample.
samples/angular-app/src/api/model-zod/pets.zod.ts Adds generated Zod schema artifacts for sample.
samples/angular-app/src/api/model-zod/pet.zod.ts Adds generated Zod schema artifacts for sample.
samples/angular-app/src/api/model-zod/listPetsParams.zod.ts Adds generated Zod schema artifacts for sample.
samples/angular-app/src/api/model-zod/index.zod.ts Adds generated Zod barrel for sample.
samples/angular-app/src/api/model-zod/error.zod.ts Adds generated Zod schema artifacts for sample.
samples/angular-app/src/api/model-zod/createPetsBody.zod.ts Adds generated Zod schema artifacts for sample.
samples/angular-app/src/api/http-resource/pets/pets.service.ts Adds generated httpResource endpoints + mutation service + ResourceState utilities.
samples/angular-app/src/api/http-resource/pets/pets.msw.ts Adds generated MSW mocks for httpResource output.
samples/angular-app/src/api/http-resource/index.msw.ts Adds MSW index export for httpResource mocks.
samples/angular-app/src/api/http-resource-zod/pets/pets.service.ts Adds generated httpResource endpoints with Zod parsing + service/utilities.
samples/angular-app/src/api/http-resource-zod/pets/pets.msw.ts Adds generated MSW mocks for httpResource + zod output.
samples/angular-app/src/api/http-resource-zod/index.msw.ts Adds MSW index export for httpResource + zod mocks.
samples/angular-app/src/api/http-client/pets/pets.service.ts Updates generated HttpClient options typing (adds referrerPolicy).
samples/angular-app/src/api/http-client/pets/pets.msw.ts Adds generated MSW mocks for http-client output.
samples/angular-app/src/api/http-client/index.msw.ts Adds MSW index export for http-client mocks.
samples/angular-app/package.json Adds Zod + ESLint toolchain updates for the Angular sample.
samples/angular-app/orval.config.ts Adds multiple outputs (http-client, http-resource, http-resource-zod) + MSW mock config.
samples/angular-app/eslint.config.mjs Adds ESLint flat config for Angular sample.
samples/angular-app/angular.json Adds @angular-eslint lint builder target.
packages/orval/src/utils/options.ts Normalizes Angular defaults for client and runtimeValidation (global + per-operation).
packages/orval/src/generate-spec.ts Fixes cleaning when output.schemas is object form ({ type, path }).
packages/orval/src/client.ts Plumbs normalized Angular override options into @orval/angular builder and adjusts mock typing.
packages/mock/src/msw/index.ts Adjusts MSW delay expression emission (function delays now stringified + executed).
packages/mock/src/msw/index.test.ts Expands MSW generator tests and updates mock option typing usage.
packages/core/src/types.ts Adds Angular override types (client, runtimeValidation) and introduces NormalizedAngularOptions.
packages/angular/vitest.config.ts Adds vitest config scaffold for Angular package tests.
packages/angular/src/utils.ts Adds shared helpers (title generation, registries, retrieval/mutation heuristic, default content-type selection).
packages/angular/src/utils.test.ts Adds tests for Angular utility helpers.
packages/angular/src/types.ts Extracts reusable code templates for generated Angular client types.
packages/angular/src/types.test.ts Adds conformance tests ensuring generated HttpClientOptions stays aligned with Angular API.
packages/angular/src/index.ts Refactors Angular client entry to support httpClient, httpResource, and both builders.
packages/angular/src/index.test.ts Adds tests ensuring builder selection behaves as expected.
packages/angular/src/http-resource.ts Introduces httpResource generator with registries, parsing, factories, and extra-file support.
packages/angular/src/http-resource.test.ts Adds extensive tests for httpResource generation behavior.
packages/angular/src/http-client.ts Refactors HttpClient generator into its own module and shares utilities.
packages/angular/src/http-client.test.ts Adds extensive tests for HttpClient generation behavior.
packages/angular/src/constants.ts Centralizes Angular dependency definitions for HttpClient and httpResource modes.
packages/angular/README.md Updates Angular package README formatting/content.
package.json Adds root lint:generated turbo script.
docs/content/docs/guides/angular.mdx Documents httpResource output and Zod runtime validation options.
README.md Documents new lint scripts and updated dev workflow steps.
.yarnrc.yml Updates Angular catalog versions and adds zod to catalog.

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

@@ -57,10 +65,6 @@ const getGeneratorClient = (
? outputClient(GENERATOR_CLIENT)
: GENERATOR_CLIENT[outputClient];

Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

getGeneratorClient no longer throws when an unknown outputClient is provided, so generator can be undefined and cause less actionable runtime errors later (e.g., when destructuring header/footer/client). Reintroduce an explicit guard that throws a clear error when the client key is not found (including the provided value).

Suggested change
if (!generator) {
throw new Error(
`Unknown output client provided to getGeneratorClient: ${String(outputClient)}`,
);
}

Copilot uses AI. Check for mistakes.
Comment on lines 190 to 191
if (isResponseArrayBuffer(contentType)) return 'httpResource.arrayBuffer';
if (isResponseBlob(contentType, response.isBlob)) return 'httpResource.blob';
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

getHttpResourceFactory checks for application/octet-stream/PDF (arrayBuffer) before honoring response.isBlob. This can produce httpResource.arrayBuffer factories for endpoints that are modeled as Blob, leading to type/runtime mismatches in generated clients. Consider prioritizing response.isBlob (or the Blob return type) over the arrayBuffer heuristic, or otherwise ensure the factory choice and generated return type stay aligned.

Suggested change
if (isResponseArrayBuffer(contentType)) return 'httpResource.arrayBuffer';
if (isResponseBlob(contentType, response.isBlob)) return 'httpResource.blob';
if (isResponseBlob(contentType, response.isBlob)) return 'httpResource.blob';
if (isResponseArrayBuffer(contentType)) return 'httpResource.arrayBuffer';

Copilot uses AI. Check for mistakes.
Comment on lines 93 to 99
export function downloadFileResource(
petId: Signal<number>,
version?: Signal<number>,
): HttpResourceRef<Blob | undefined> {
return httpResource.arrayBuffer<Blob>(
() => `/v${version?.() ?? 1}/pet/${petId()}/downloadImage`,
);
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

downloadFileResource returns HttpResourceRef<Blob | undefined> but uses httpResource.arrayBuffer<Blob>(...). arrayBuffer resources yield ArrayBuffer data, so this is a type/runtime mismatch. Use the blob factory for Blob responses, or change the return type to ArrayBuffer (and let consumers convert to Blob if needed).

Copilot uses AI. Check for mistakes.
Comment on lines 99 to 105
export function downloadFileResource(
petId: Signal<number>,
version?: Signal<number>,
): HttpResourceRef<Blob | undefined> {
return httpResource.arrayBuffer<Blob>(
() => `/v${version?.() ?? 1}/pet/${petId()}/downloadImage`,
);
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

downloadFileResource returns HttpResourceRef<Blob | undefined> but uses httpResource.arrayBuffer<Blob>(...). arrayBuffer resources yield ArrayBuffer data, so this is a type/runtime mismatch. Use the blob factory for Blob responses, or change the return type to ArrayBuffer (and let consumers convert to Blob if needed).

Copilot uses AI. Check for mistakes.
Comment on lines +158 to +165
return new HttpResponse(
overrideResponse !== undefined
? typeof overrideResponse === 'function'
? await overrideResponse(info)
: overrideResponse
: getShowPetByIdResponseMock(),
{ status: 200, headers: { 'Content-Type': 'text/plain' } },
);
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

This handler sets Content-Type: text/plain but may return a Pet object (non-string) when overrideResponse is a Pet or when using the default mock. That produces an invalid/incorrect response body for a text response. Ensure the generated handler serializes non-string values appropriately (or only treats the response as text when the response body type is actually string).

Copilot uses AI. Check for mistakes.
Comment on lines +158 to +165
return new HttpResponse(
overrideResponse !== undefined
? typeof overrideResponse === 'function'
? await overrideResponse(info)
: overrideResponse
: getShowPetByIdResponseMock(),
{ status: 200, headers: { 'Content-Type': 'text/plain' } },
);
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

This handler sets Content-Type: text/plain but may return a Pet object (non-string) when overrideResponse is a Pet or when using the default mock. That produces an invalid/incorrect response body for a text response. Ensure the generated handler serializes non-string values appropriately (or only treats the response as text when the response body type is actually string).

Copilot uses AI. Check for mistakes.
Comment on lines +226 to +235
return new HttpResponse(
JSON.stringify(
overrideResponse !== undefined
? typeof overrideResponse === 'function'
? await overrideResponse(info)
: overrideResponse
: getDownloadFileResponseMock(),
),
{ status: 200, headers: { 'Content-Type': 'application/json' } },
);
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

This handler JSON-stringifies a Blob response and sets Content-Type: application/json, which breaks binary downloads and does not match the declared Blob return type. The generated handler should return the Blob body directly (or use MSW’s binary helpers) and set an appropriate binary content-type (e.g., octet-stream) based on the operation’s response content-type.

Copilot uses AI. Check for mistakes.
Comment on lines +226 to +235
return new HttpResponse(
JSON.stringify(
overrideResponse !== undefined
? typeof overrideResponse === 'function'
? await overrideResponse(info)
: overrideResponse
: getDownloadFileResponseMock(),
),
{ status: 200, headers: { 'Content-Type': 'application/json' } },
);
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

This handler JSON-stringifies a Blob response and sets Content-Type: application/json, which breaks binary downloads and does not match the declared Blob return type. The generated handler should return the Blob body directly (or use MSW’s binary helpers) and set an appropriate binary content-type (e.g., octet-stream) based on the operation’s response content-type.

Copilot uses AI. Check for mistakes.
Comment on lines 1 to 30
import {
type ClientBuilder,
type ClientDependenciesBuilder,
type ClientExtraFilesBuilder,
type ClientFooterBuilder,
type ClientHeaderBuilder,
type ContextSpec,
conventionName,
generateDependencyImports,
generateFormDataAndUrlEncodedFunction,
generateMutatorImports,
generateVerbImports,
type GeneratorDependency,
type GeneratorImport,
type GeneratorMutator,
type GeneratorOptions,
type GeneratorVerbOptions,
getFileInfo,
getFullRoute,
GetterPropType,
isObject,
isSyntheticDefaultImportsAllow,
jsDoc,
type NormalizedOutputOptions,
type OpenApiInfoObject,
pascal,
type ResReqTypesValue,
toObjectString,
upath,
} from '@orval/core';
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

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

Unused import generateVerbImports.

Copilot uses AI. Check for mistakes.
@ScriptType
Copy link
Contributor

First absolutely stunning pr 👍 .
@melloware I will look deeper into it.

@the-ult without me having a deeper knowledge at the moment it would be nice when you address the ai issues, (Even when you write a comment that the ai is stupid there would be fine )

@the-ult
Copy link
Contributor Author

the-ult commented Feb 8, 2026

Thanks :-)

I wil fix/handle the CoPilot comments in the next days.

@melloware melloware added the angular Related to Angular generation issues label Feb 8, 2026
The Ult added 8 commits February 8, 2026 09:51
Introduce a dedicated httpResource client generator with route tracking\nand resource return-type registries.

Add shared dependency/templates utilities, new tests, and expose the\nangular client mode (httpClient/httpResource/both) through config\nnormalization and generator selection.
Split generated API outputs into http-client and http-resource targets\nwith updated MSW mocks and sample pages.

Add routing and UI for the new httpResource screen plus the versioned\npath transformer used by both outputs.
Add lint:generated task wiring across root and tests, and update\nturbo pipeline + README guidance.

Introduce ESLint configs for Angular/Next samples and refresh Angular\ncatalog + dependencies to include Angular ESLint support.
- add url-only httpResource generation and zod parse options

- normalize angular runtimeValidation and update config/types/tests

- document httpResource output and add zod sample pages/output
- precompute delay expressions to handle function delays safely

- expand MSW tests and update angular sample mocks

- expose MSW_DELAY in turbo global env
- resolve schema path when schemas is an object

- avoid cleaning the wrong directory during generation
@melloware melloware force-pushed the feat/add-angular-http-resource branch from f7a34c9 to ef1c58c Compare February 8, 2026 14:51
@melloware
Copy link
Collaborator

I just rebased your branch and will run the tests

The Ult added 3 commits February 8, 2026 17:06
- Restore defensive guard in getGeneratorClient for custom OutputClientFunc
- Fix blob/arrayBuffer check ordering in httpResource factory
- Remove unused generateVerbImports import
- Remove unnecessary nullish coalescing on response.definition.success
- Use String.raw template literals for regex patterns
- Regenerate samples with corrected blob resource output
…tp-resource' into feat/add-angular-http-resource
@ScriptType
Copy link
Contributor

Hmm, i get the feeling this pr could be split up in to multiple pr´s. What are your thoughts @the-ult ?

The Ult added 8 commits February 8, 2026 20:51
Split generated API outputs into http-client and http-resource targets\nwith updated MSW mocks and sample pages.

Add routing and UI for the new httpResource screen plus the versioned\npath transformer used by both outputs.
- add url-only httpResource generation and zod parse options

- normalize angular runtimeValidation and update config/types/tests

- document httpResource output and add zod sample pages/output
- Restore defensive guard in getGeneratorClient for custom OutputClientFunc
- Fix blob/arrayBuffer check ordering in httpResource factory
- Remove unused generateVerbImports import
- Remove unnecessary nullish coalescing on response.definition.success
- Use String.raw template literals for regex patterns
- Regenerate samples with corrected blob resource output
@melloware melloware marked this pull request as draft February 9, 2026 12:50
Revert back to not using yarn catalogs.
But had to update some packages, due to yarn warnings.
The Ult added 10 commits February 9, 2026 17:25
Use next lint instead of eslint
revert scope creep, as much as possible
TanStack Query v5 mutation callbacks now require the extra context argument, which breaks generated Angular Query clients/tests after the catalog bump in this PR.

This change updates the generator and regenerated samples to pass the 4th argument and keeps CI green in the same PR because the dependency upgrade and sample refresh already happen here.
Will be done in separate PR
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 62 out of 65 changed files in this pull request and generated 9 comments.


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

Comment on lines 179 to 188
vi.mocked(findUp).mockImplementation((name) => {
if (name === 'pnpm-workspace.yaml') return;
if (name === '.yarnrc.yml') return;
vi.mocked(findUp).mockImplementation(async (name) => {
if (name === 'pnpm-workspace.yaml') return;
if (name === '.yarnrc.yml') return;
if (Array.isArray(name) && name.includes('package.json'))
return '/workspace/packages/app/package.json';
return;
return;
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

This block starts a mockImplementation and then immediately starts another nested mockImplementation without closing the first one, which makes the test file syntactically invalid. Consolidate to a single findUp mock implementation (sync or async) and ensure braces/parentheses are correctly closed.

Suggested change
vi.mocked(findUp).mockImplementation((name) => {
if (name === 'pnpm-workspace.yaml') return;
if (name === '.yarnrc.yml') return;
vi.mocked(findUp).mockImplementation(async (name) => {
if (name === 'pnpm-workspace.yaml') return;
if (name === '.yarnrc.yml') return;
if (Array.isArray(name) && name.includes('package.json'))
return '/workspace/packages/app/package.json';
return;
return;
vi.mocked(findUp).mockImplementation(async (name) => {
if (name === 'pnpm-workspace.yaml') return;
if (name === '.yarnrc.yml') return;
if (Array.isArray(name) && name.includes('package.json'))
return '/workspace/packages/app/package.json';
return;

Copilot uses AI. Check for mistakes.
<h1 align="center">
Visit <a href="https://orval.dev" target="_blank">orval.dev</a> for docs, guides, API and beer!
</h1>
![orval - Restfull Client Generator](./logo/orval-logo-horizontal.svg?raw=true)
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Typo in the image alt text: "Restfull" should be "Restful".

Suggested change
![orval - Restfull Client Generator](./logo/orval-logo-horizontal.svg?raw=true)
![orval - Restful Client Generator](./logo/orval-logo-horizontal.svg?raw=true)

Copilot uses AI. Check for mistakes.
Comment on lines 1 to 2
import { isString as isRemedaString } from 'remeda';
import { isString as isRemedaString } from 'remeda';
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Duplicate import of isString as isRemedaString will cause a TypeScript compile error (duplicate identifier). Remove the extra import so it is declared only once.

Copilot uses AI. Check for mistakes.
Comment on lines 37 to 39
import { dynamicImport, log } from '@orval/core';
import { dynamicImport, log } from '@orval/core';
import { findUp, findUpMultiple } from 'find-up';
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

Duplicate import of dynamicImport/log from @orval/core will cause a TypeScript compile error (duplicate identifier). Keep a single import statement.

Copilot uses AI. Check for mistakes.
Comment on lines 68 to 70
return;
});

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

This mocked findUp implementation contains unreachable duplicated return; statements. Remove the extra return to avoid dead code and keep the mock implementation clear.

Suggested change
return;
});
});

Copilot uses AI. Check for mistakes.
const mockPkg = {
devDependencies: {
jest: 'catalog:testing',
jest: 'catalog:ing',
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

jest is set to catalog:ing, but the test data expects a named catalog testing. As written, the resolver under test won't find a matching catalog and the assertion will fail; update the fixture to catalog:testing (or adjust the expected catalogs accordingly).

Suggested change
jest: 'catalog:ing',
jest: 'catalog:testing',

Copilot uses AI. Check for mistakes.
const mockPkg = {
devDependencies: {
vitest: 'catalog:testing',
vitest: 'catalog:ing',
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

vitest is set to catalog:ing, but the test data expects a named catalog testing. This will prevent the resolver from finding the catalog entry and will fail the assertion; use catalog:testing (or update the expected catalogs).

Suggested change
vitest: 'catalog:ing',
vitest: 'catalog:testing',

Copilot uses AI. Check for mistakes.
Comment on lines +158 to +165
return new HttpResponse(
overrideResponse !== undefined
? typeof overrideResponse === 'function'
? await overrideResponse(info)
: overrideResponse
: getShowPetByIdResponseMock(),
{ status: 200, headers: { 'Content-Type': 'text/plain' } },
);
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

getShowPetByIdMockHandler returns an object from getShowPetByIdResponseMock() but responds as text/plain without serialization. This is likely invalid for MSW HttpResponse; either return a string body for text/plain or serialize/use HttpResponse.json() with application/json.

Copilot uses AI. Check for mistakes.
Comment on lines +226 to +235
return new HttpResponse(
JSON.stringify(
overrideResponse !== undefined
? typeof overrideResponse === 'function'
? await overrideResponse(info)
: overrideResponse
: getDownloadFileResponseMock(),
),
{ status: 200, headers: { 'Content-Type': 'application/json' } },
);
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

getDownloadFileMockHandler JSON-stringifies a Blob and sets Content-Type: application/json, which won't mock a binary response correctly. Return the Blob directly and set a binary content type (or the actual file type).

Copilot uses AI. Check for mistakes.
@the-ult
Copy link
Contributor Author

the-ult commented Feb 12, 2026

#2938 938 made a lot of changes and fixes to the angular generator.

In this pr we split it into http-client.ts and other files.

@copilot create a plan what would be the best way to merge these improvements into this PR

@the-ult
Copy link
Contributor Author

the-ult commented Feb 19, 2026

Gonna be on holiday for a week. Gonna pick this up after :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

angular Related to Angular generation issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Angular httpResource API

4 participants