Skip to content

feat(angular): DI-based runtime base-URL composition via override.angular.baseUrl - #3711

Draft
the-ult wants to merge 3 commits into
orval-labs:masterfrom
the-ult:feat/3702-angular-runtime-base-url
Draft

feat(angular): DI-based runtime base-URL composition via override.angular.baseUrl#3711
the-ult wants to merge 3 commits into
orval-labs:masterfrom
the-ult:feat/3702-angular-runtime-base-url

Conversation

@the-ult

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

Copy link
Copy Markdown
Contributor

Summary

Closes #3702.

Adds opt-in Angular dependency-injection-based base-URL composition: override.angular.baseUrl: { apiId } emits one <target>.base-url.ts file per output containing an API-specific InjectionToken, a per-output resolver token, provide helpers, and a URL-normalization helper — so gateway/proxy routing (app/environment config) composes cleanly with the contract's server URL, scales to many generated APIs, and is overridable per injector (TestBed, SSR, second app).

override: { angular: { baseUrl: { apiId: 'petstore' } } }

Generated (from the real sample output):

export const PETSTORE_BASE_URL = new InjectionToken<string>('PETSTORE_BASE_URL', {
  providedIn: 'root',
  factory: () =>
    normalizeBaseUrl(
      inject(PETSTORE_BASE_URL_RESOLVER)({ apiId: 'petstore', serverUrl: PETSTORE_SERVER_URL }),
    ),
});
export function providePetstoreBaseUrl(baseUrl: string): Provider { ... }
export function providePetstoreBaseUrlResolver(resolver: ...): Provider { ... }

Resolution precedence, purely through DI (no global mutable state): direct token provider → provided resolver → default resolver → embedded OpenAPI server URL. A monorepo consuming many generated APIs registers one shared resolver function with each output's provide<Api>BaseUrlResolver (gateway-route registry keyed by explicit apiId), and overrides a single API via its provide<Api>BaseUrl.

Design decisions

  • Everything is emitted code — no @orval/* runtime dependency is added; generated files keep importing only @angular/*/rxjs/zod.
  • Both surfaces read the same token: HttpClient services via an inject() class field; httpResource functions via options?.injector ? options.injector.get(TOKEN) : inject(TOKEN) (httpResource already requires an injection context, so this is valid in exactly the same call sites).
  • The prefix is applied after makeRouteSafe, so it's never URL-encoded, and custom mutators receive the composed URL. Zod runtimeValidation is orthogonal and unchanged.
  • apiId is required and explicit (validated /^[A-Za-z][A-Za-z0-9_-]*$/) — never derived from server URL/hostname/spec filename, per the issue.
  • Mutually exclusive with output.baseUrl (clear normalization error); warns and ignores for non-Angular clients and per-operation/per-tag placement.
  • Per-output resolver tokens (InjectionToken identity is referential — two generated files can't share one token object without a runtime package); sharing happens at the resolver-function level, shown in the docs.

Backwards compatibility

100% opt-in: without override.angular.baseUrl the emitted output is byte-identical — verified by full regeneration showing zero modified pre-existing snapshots or sample files; only new base-url-token* trees were added (4 new test configs: httpClient / httpResource / both+tags-split / zod+runtimeValidation, plus a CI-compiled sample-app target with 6 new TestBed specs proving injector overrides work).

Verification

  • Unit: core 2100 ✓, angular 251 ✓, orval 194 ✓ (1 pre-existing macOS-only /tmp-symlink flake, reproduced unmodified on master)
  • Snapshots: 5,384 ✓ (non-update re-run green); blast radius = new dirs only
  • vp lint --type-aware --type-check ✓ (caught and fixed a test-signature issue plain vitest missed); all 16 generated clients typecheck ✓
  • samples/angular-app: ng build / ng lint / ng test ✓ (22/22)

Docs

  • docs/content/docs/guides/angular.mdx: "Setting the Backend URL" restructured — interceptor stays the simple single-API path; new "DI-based base URL composition (multiple APIs / gateway routing)" section with generated artifacts, precedence, gateway-registry example, TestBed override, injection-context notes, and caveats (all code copied from real generated output).
  • docs/content/docs/reference/configuration/output.mdx: override.angular.baseUrl reference (apiId rules, index, variables, error/warning behavior) + pointer from the top-level baseUrl section.

Related issues

#2581 / #3071 (runtime baseUrl prior art — this is its Angular-DI form), #3265 (fetch function injection), sibling cluster #3700, #3704, #3705, #3706. Peer precedent: OpenAPI Generator's typescript-angular BASE_PATH token and ng-openapi-gen's rootUrl — a DI base-path surface is the norm for Angular OpenAPI generators.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added Angular runtime base URL resolution through dependency injection.
    • Supports custom resolvers, direct provider overrides, server selection, variables, and normalized URLs.
    • Works consistently with both HttpClient services and httpResource APIs.
    • Supports multiple generated APIs using stable API identifiers.
  • Documentation

    • Expanded Angular configuration guidance, setup examples, validation rules, testing, and provider precedence.
  • Bug Fixes

    • Preserved URL encoding, mutator behavior, and runtime validation when applying injected base URLs.
  • Tests

    • Added comprehensive coverage for configuration, generated clients, resources, and dependency-injection behavior.

…ular.baseUrl (orval-labs#3702)

Opt-in per-output base-URL InjectionToken with a factory default, a
per-output resolver token, provide<Api>BaseUrl/provide<Api>BaseUrlResolver
helpers, and a normalizeBaseUrl join helper — all emitted code, no runtime
package. Resolution precedence is pure DI: direct token provider >
provided resolver > default resolver > embedded OpenAPI server URL.
HttpClient services inject the token as a class field; httpResource
functions resolve it injector-aware (options.injector supported). The
prefix is applied after makeRouteSafe so it is never URL-encoded, apiId is
explicit and validated, and the option is mutually exclusive with
output.baseUrl. Output is byte-identical when the option is not set.

Fixes orval-labs#3702

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

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds configurable Angular DI-based runtime base URL composition with generated tokens, resolver/provider helpers, HttpClient and httpResource integration, validation, documentation, tests, and Petstore sample outputs.

Changes

Angular base URL composition

Layer / File(s) Summary
Core URL resolution and configuration contracts
packages/core/src/getters/route.ts, packages/core/src/types.ts
Adds server selection and variable substitution through resolveServerUrl, plus Angular base URL configuration types.
Configuration normalization and validation
packages/orval/src/utils/options.ts, packages/orval/src/utils/options.test.ts
Validates apiId, rejects conflicting output.baseUrl, warns for non-Angular or per-operation usage, and preserves supported options.
Generated Angular base-url module
packages/angular/src/base-url.ts, packages/angular/src/base-url.test.ts
Generates API-specific tokens, resolver types, provider helpers, normalized URLs, and embedded server fallbacks.
Generator wiring and shared templates
packages/angular/src/index.ts, packages/angular/src/constants.ts, packages/angular/src/utils.ts, packages/angular/src/index.test.ts
Registers base-url extra files, exports helpers, adds inject support, and updates generated service templates.
HttpClient integration
packages/angular/src/http-client.ts, packages/angular/src/http-client.test.ts
Injects the base URL token, prefixes generated routes, preserves parameter encoding, and passes composed routes to mutators.
httpResource integration
packages/angular/src/http-resource.ts, packages/angular/src/http-resource.test.ts
Resolves base URLs through Angular injection, prefixes resource routes, and wires dependencies for both-mode outputs and runtime validation.
Documentation
docs/content/docs/guides/angular.mdx, docs/content/docs/reference/configuration/output.mdx
Documents DI-based composition, generated artifacts, precedence, resolver sharing, testing, and configuration constraints.
Sample generation and end-to-end coverage
samples/angular-app/..., tests/configs/angular.config.ts
Adds Petstore generated models, services, resources, DI providers, sample configuration, and tests covering overrides and shared URL resolution.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related issues

Possibly related PRs

  • orval-labs/orval#3541 — Overlaps the Angular route-construction paths modified for base URL prefixing and parameter encoding.

Suggested labels: enhancement, angular

Suggested reviewers: melloware, snebjorn

Sequence Diagram(s)

sequenceDiagram
  participant GeneratedClient
  participant AngularToken as PETSTORE_BASE_URL
  participant Resolver as PETSTORE_BASE_URL_RESOLVER
  participant HttpTransport

  GeneratedClient->>AngularToken: Resolve injected base URL
  AngularToken->>Resolver: Resolve apiId and serverUrl context
  Resolver-->>AngularToken: Return selected runtime URL
  AngularToken-->>GeneratedClient: Return normalized base URL
  GeneratedClient->>HttpTransport: Send request with prefixed route
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main Angular feature and matches the new override.angular.baseUrl runtime base-URL composition.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 opt-in Angular DI-based runtime base-URL composition feature via override.angular.baseUrl, generating a per-output <target>.base-url.ts module that exports API-specific InjectionTokens, resolver/provider helpers, and a base-URL normalization helper, and wiring generated Angular HttpClient services and httpResource functions to consume the composed base URL.

Changes:

  • Introduces override.angular.baseUrl option normalization/validation (including warnings/errors) and new core types.
  • Adds Angular generator support to emit and consume a generated DI base-URL token file across httpClient, httpResource, and both modes.
  • Adds extensive tests, snapshots, sample Angular app coverage, and documentation for the new DI base-URL mechanism.

Reviewed changes

Copilot reviewed 130 out of 130 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/configs/angular.config.ts Adds new test configs for base-url token outputs across modes.
tests/snapshots/angular/base-url-token/endpoints.base-url.ts Snapshot of generated base-url DI token module (non-zod).
tests/snapshots/angular/base-url-token/model/cat.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/catType.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/createPetsBody.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/createPetsParams.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/createPetsSort.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/dachshund.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/dachshundBreed.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/dog.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/dogType.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/error.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/index.ts Snapshot barrel for base-url-token test output models.
tests/snapshots/angular/base-url-token/model/labradoodle.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/labradoodleBreed.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/listPetsParams.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/listPetsSort.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/pet.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/petCallingCode.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/petCountry.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/pets.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token/model/petWithTag.ts Snapshot fixture for new base-url-token test output models.
tests/snapshots/angular/base-url-token-zod/endpoints.base-url.ts Snapshot of generated base-url DI token module (zod mode).
tests/snapshots/angular/base-url-token-zod/model/cat.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/createPetsBody.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/createPetsHeaders.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/createPetsParams.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/dachshund.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/dog.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/error.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/index.ts Snapshot barrel for base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/labradoodle.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/listPetsHeaders.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/listPetsParams.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/pet.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/petWithTag.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-zod/model/pets.zod.ts Snapshot fixture for new base-url-token zod models.
tests/snapshots/angular/base-url-token-http-resource/endpoints.ts Snapshot of generated httpResource output consuming DI baseUrl token.
tests/snapshots/angular/base-url-token-http-resource/endpoints.base-url.ts Snapshot of generated base-url DI token module for httpResource output.
tests/snapshots/angular/base-url-token-http-resource/model/cat.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/catType.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/createPetsBody.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/createPetsParams.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/createPetsSort.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/dachshund.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/dachshundBreed.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/dog.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/dogType.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/error.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/index.ts Snapshot barrel for base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/labradoodle.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/labradoodleBreed.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/listPetsParams.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/listPetsSort.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/pet.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/petCallingCode.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/petCountry.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/pets.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-http-resource/model/petWithTag.ts Snapshot fixture for new base-url-token-http-resource models.
tests/snapshots/angular/base-url-token-both/endpoints.base-url.ts Snapshot of base-url DI token module for both mode.
tests/snapshots/angular/base-url-token-both/health/health.service.ts Snapshot of tag-split HttpClient service consuming DI baseUrl token.
tests/snapshots/angular/base-url-token-both/health/health.resource.ts Snapshot of tag-split httpResource functions consuming DI baseUrl token.
tests/snapshots/angular/base-url-token-both/pets/pets.service.ts Snapshot of tag-split HttpClient service consuming DI baseUrl token.
tests/snapshots/angular/base-url-token-both/pets/pets.resource.ts Snapshot of tag-split httpResource functions consuming DI baseUrl token.
tests/snapshots/angular/base-url-token-both/model/cat.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/catType.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/createPetsBody.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/createPetsParams.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/createPetsSort.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/dachshund.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/dachshundBreed.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/dog.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/dogType.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/error.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/index.ts Snapshot barrel for base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/labradoodle.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/labradoodleBreed.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/listPetsParams.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/listPetsSort.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/pet.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/petCallingCode.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/petCountry.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/pets.ts Snapshot fixture for new base-url-token-both models.
tests/snapshots/angular/base-url-token-both/model/petWithTag.ts Snapshot fixture for new base-url-token-both models.
samples/angular-app/orval.config.ts Adds a sample-app Orval target exercising the base-url DI option.
samples/angular-app/src/app/base-url-token.spec.ts Adds end-to-end TestBed coverage for base-url DI precedence and usage.
samples/angular-app/src/api/base-url-token/petstore.base-url.ts Sample generated base-url DI token module.
samples/angular-app/src/api/base-url-token/pets/pets.resource.ts Sample generated httpResource functions consuming DI baseUrl token.
samples/angular-app/src/api/base-url-token/model/createPetsBody.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/src/api/base-url-token/model/createPetsBodyStatus.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/src/api/base-url-token/model/error.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/src/api/base-url-token/model/index.ts Sample generated model barrel for base-url token sample.
samples/angular-app/src/api/base-url-token/model/listPetsParams.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/src/api/base-url-token/model/pet.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/src/api/base-url-token/model/petStatus.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/src/api/base-url-token/model/pets.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/src/api/base-url-token/model/searchPetsParams.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/src/api/base-url-token/model/searchPetsStatus.ts Sample generated model fixtures for base-url token sample.
samples/angular-app/snapshots/api/base-url-token/petstore.base-url.ts Snapshot coverage for sample generated base-url DI token module.
samples/angular-app/snapshots/api/base-url-token/pets/pets.resource.ts Snapshot coverage for sample generated httpResource code with DI baseUrl.
samples/angular-app/snapshots/api/base-url-token/model/createPetsBody.ts Snapshot coverage for sample generated models.
samples/angular-app/snapshots/api/base-url-token/model/createPetsBodyStatus.ts Snapshot coverage for sample generated models.
samples/angular-app/snapshots/api/base-url-token/model/error.ts Snapshot coverage for sample generated models.
samples/angular-app/snapshots/api/base-url-token/model/index.ts Snapshot coverage for sample generated model barrel.
samples/angular-app/snapshots/api/base-url-token/model/listPetsParams.ts Snapshot coverage for sample generated models.
samples/angular-app/snapshots/api/base-url-token/model/pet.ts Snapshot coverage for sample generated models.
samples/angular-app/snapshots/api/base-url-token/model/petStatus.ts Snapshot coverage for sample generated models.
samples/angular-app/snapshots/api/base-url-token/model/pets.ts Snapshot coverage for sample generated models.
samples/angular-app/snapshots/api/base-url-token/model/searchPetsParams.ts Snapshot coverage for sample generated models.
samples/angular-app/snapshots/api/base-url-token/model/searchPetsStatus.ts Snapshot coverage for sample generated models.
packages/core/src/types.ts Adds AngularBaseUrlOptions and wires it into Angular override option types.
packages/core/src/getters/route.ts Extracts servers URL resolution into reusable resolveServerUrl.
packages/orval/src/utils/options.ts Adds config normalization/validation for override.angular.baseUrl.
packages/orval/src/utils/options.test.ts Adds unit tests for override.angular.baseUrl normalization behavior.
packages/angular/src/base-url.ts Implements base-url DI token extra-file generation and naming helpers.
packages/angular/src/base-url.test.ts Adds unit tests for base-url extra file content, naming, and server resolution.
packages/angular/src/http-client.ts Prefixes generated routes with injected baseUrl token when configured.
packages/angular/src/http-client.test.ts Adds tests for base-url token integration in HttpClient generator path.
packages/angular/src/http-resource.ts Prefixes generated routes with injected baseUrl token when configured.
packages/angular/src/http-resource.test.ts Adds tests for base-url token integration in httpResource generator path.
packages/angular/src/utils.ts Supports optional injected baseUrl class field in generated service shells.
packages/angular/src/constants.ts Ensures required Angular core imports support new injection usage patterns.
packages/angular/src/index.ts Wires base-url extra files into Angular generator builders and exports helpers.
packages/angular/src/index.test.ts Updates builder expectations (extraFiles always present, no-op when unset).
docs/content/docs/reference/configuration/output.mdx Documents override.angular.baseUrl option and its constraints.
docs/content/docs/guides/angular.mdx Adds Angular guide section explaining DI-based base URL composition and usage.

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

Comment thread packages/orval/src/utils/options.ts Outdated
Comment on lines +294 to +301
if (outputBaseUrl) {
throw new Error(
styleText(
'red',
"`override.angular.baseUrl` cannot be combined with the top-level `output.baseUrl`. Remove `output.baseUrl` — the base-URL token's server-URL fallback is resolved from the specification's `servers` field, or provide a custom resolver via the generated `provide<Api>BaseUrlResolver` helper.",
),
);
}
Copilot review: the mutual-exclusivity guard against output.baseUrl was
truthiness-based, so an explicitly configured empty-string baseUrl slipped
through. The check is now '!== undefined', with a regression test.

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

the-ult commented Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

Copilot review triage:

  • Truthiness-based output.baseUrl exclusivity check: valid — fixed in 8469818 (!== undefined + regression test for baseUrl: '').
  • TestBed.tick() 'not part of Angular's testing API': false positive — TestBed.tick() is @publicApi 20.0 (it replaced the deprecated flushEffects()); the sample app runs Angular 22.0.2 where it's declared in @angular/core/types/testing.d.ts:511, and the suite compiles and passes (ng build / ng lint / ng test: 22/22, including the 6 new base-url-token specs).

@pkg-pr-new

pkg-pr-new Bot commented Jul 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@orval/angular

bun add https://pkg.pr.new/@orval/angular@3720122

@orval/axios

bun add https://pkg.pr.new/@orval/axios@3720122

@orval/core

bun add https://pkg.pr.new/@orval/core@3720122

@orval/effect

bun add https://pkg.pr.new/@orval/effect@3720122

@orval/fetch

bun add https://pkg.pr.new/@orval/fetch@3720122

@orval/hono

bun add https://pkg.pr.new/@orval/hono@3720122

@orval/mcp

bun add https://pkg.pr.new/@orval/mcp@3720122

@orval/mock

bun add https://pkg.pr.new/@orval/mock@3720122

orval

bun add https://pkg.pr.new/orval@3720122

@orval/query

bun add https://pkg.pr.new/@orval/query@3720122

@orval/solid-start

bun add https://pkg.pr.new/@orval/solid-start@3720122

@orval/swr

bun add https://pkg.pr.new/@orval/swr@3720122

@orval/zod

bun add https://pkg.pr.new/@orval/zod@3720122

commit: 3720122

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/angular/src/http-client.ts (1)

27-30: 📐 Maintainability & Code Quality | 🔵 Trivial

Duplicate class-open template instead of reusing buildServiceClassOpen.

generateAngularHeader hand-rolls the @Injectable ... export class { private readonly http = inject(HttpClient); ... } shell inline, duplicating the logic that buildServiceClassOpen (in utils.ts) already encapsulates — including, now, the new baseUrl field injection. http-resource.ts's generateHttpResourceHeader calls buildServiceClassOpen with a baseUrlFieldInitializer; this file re-implements the same feature by hand instead. Two independent implementations of the same feature increase drift risk (a future change to one is easy to forget in the other).

♻️ Suggested direction

Consider extending buildServiceClassOpen to also emit the HTTP_CLIENT_OPTIONS_TEMPLATE/observe-options/accept-helpers preamble (or extracting just the class-open fragment) so generateAngularHeader can call it instead of duplicating the @Injectable/class-open block.

Also applies to: 225-270

🤖 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/angular/src/http-client.ts` around lines 27 - 30, Refactor
generateAngularHeader to reuse buildServiceClassOpen for the
Injectable/class-open shell instead of assembling it inline. Extend or adapt
buildServiceClassOpen to emit the required HTTP client options and helper
preamble while preserving the baseUrlFieldInitializer behavior used by
generateHttpResourceHeader, then remove the duplicated class-opening logic from
generateAngularHeader.
🤖 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/getters/route.ts`:
- Line 94: Update the variable lookup condition in the route getter to check
whether variables[variableKey] is not undefined rather than relying on
truthiness. Preserve explicitly provided empty-string values and only fall back
to variable.default when the value is absent.

In `@samples/angular-app/src/api/base-url-token/pets/pets.resource.ts`:
- Around line 178-182: Update listPetsResource and showPetByIdResource so
request construction and all reads of params, petId, and version occur inside
the reactive callback passed to httpResource. Match the existing pattern in
searchPetsResource, showPetTextResource, and downloadFileResource, ensuring
later signal changes recompute the URL and query parameters.
- Around line 139-145: Update the filterParams call in the pets resource to pass
true as its third argument, preserving explicit null values for the required
nullable fields in SearchPetsParams while keeping the existing parameter object
and required-field set unchanged.

---

Nitpick comments:
In `@packages/angular/src/http-client.ts`:
- Around line 27-30: Refactor generateAngularHeader to reuse
buildServiceClassOpen for the Injectable/class-open shell instead of assembling
it inline. Extend or adapt buildServiceClassOpen to emit the required HTTP
client options and helper preamble while preserving the baseUrlFieldInitializer
behavior used by generateHttpResourceHeader, then remove the duplicated
class-opening logic from generateAngularHeader.
🪄 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: 473c868d-1e73-4eb6-98da-2244864ef5c7

📥 Commits

Reviewing files that changed from the base of the PR and between c082bb4 and 3720122.

⛔ Files ignored due to path filters (98)
  • samples/angular-app/__snapshots__/api/base-url-token/model/createPetsBody.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/createPetsBodyStatus.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/error.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/index.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/listPetsParams.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/pet.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/petStatus.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/pets.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/searchPetsParams.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/model/searchPetsStatus.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/pets/pets.resource.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/pets/pets.service.ts is excluded by !**/__snapshots__/**
  • samples/angular-app/__snapshots__/api/base-url-token/petstore.base-url.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/endpoints.base-url.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/health/health.resource.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/health/health.service.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/cat.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/catType.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/createPetsBody.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/createPetsParams.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/createPetsSort.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/dachshund.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/dachshundBreed.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/dog.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/dogType.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/error.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/index.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/labradoodle.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/labradoodleBreed.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/listPetsParams.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/listPetsSort.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/pet.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/petCallingCode.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/petCountry.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/petWithTag.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/model/pets.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/pets/pets.resource.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-both/pets/pets.service.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/endpoints.base-url.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/endpoints.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/cat.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/catType.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/createPetsBody.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/createPetsParams.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/createPetsSort.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/dachshund.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/dachshundBreed.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/dog.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/dogType.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/error.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/index.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/labradoodle.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/labradoodleBreed.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/listPetsParams.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/listPetsSort.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/pet.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/petCallingCode.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/petCountry.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/petWithTag.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-http-resource/model/pets.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/endpoints.base-url.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/endpoints.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/cat.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/createPetsBody.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/createPetsHeaders.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/createPetsParams.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/dachshund.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/dog.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/error.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/index.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/labradoodle.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/listPetsHeaders.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/listPetsParams.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/pet.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/petWithTag.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token-zod/model/pets.zod.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/endpoints.base-url.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/endpoints.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/cat.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/catType.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/createPetsBody.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/createPetsParams.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/createPetsSort.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/dachshund.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/dachshundBreed.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/dog.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/dogType.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/error.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/index.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/labradoodle.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/labradoodleBreed.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/listPetsParams.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/listPetsSort.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/pet.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/petCallingCode.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/petCountry.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/petWithTag.ts is excluded by !**/__snapshots__/**
  • tests/__snapshots__/angular/base-url-token/model/pets.ts is excluded by !**/__snapshots__/**
📒 Files selected for processing (32)
  • docs/content/docs/guides/angular.mdx
  • docs/content/docs/reference/configuration/output.mdx
  • packages/angular/src/base-url.test.ts
  • packages/angular/src/base-url.ts
  • packages/angular/src/constants.ts
  • packages/angular/src/http-client.test.ts
  • packages/angular/src/http-client.ts
  • packages/angular/src/http-resource.test.ts
  • packages/angular/src/http-resource.ts
  • packages/angular/src/index.test.ts
  • packages/angular/src/index.ts
  • packages/angular/src/utils.ts
  • packages/core/src/getters/route.ts
  • packages/core/src/types.ts
  • packages/orval/src/utils/options.test.ts
  • packages/orval/src/utils/options.ts
  • samples/angular-app/orval.config.ts
  • samples/angular-app/src/api/base-url-token/model/createPetsBody.ts
  • samples/angular-app/src/api/base-url-token/model/createPetsBodyStatus.ts
  • samples/angular-app/src/api/base-url-token/model/error.ts
  • samples/angular-app/src/api/base-url-token/model/index.ts
  • samples/angular-app/src/api/base-url-token/model/listPetsParams.ts
  • samples/angular-app/src/api/base-url-token/model/pet.ts
  • samples/angular-app/src/api/base-url-token/model/petStatus.ts
  • samples/angular-app/src/api/base-url-token/model/pets.ts
  • samples/angular-app/src/api/base-url-token/model/searchPetsParams.ts
  • samples/angular-app/src/api/base-url-token/model/searchPetsStatus.ts
  • samples/angular-app/src/api/base-url-token/pets/pets.resource.ts
  • samples/angular-app/src/api/base-url-token/pets/pets.service.ts
  • samples/angular-app/src/api/base-url-token/petstore.base-url.ts
  • samples/angular-app/src/app/base-url-token.spec.ts
  • tests/configs/angular.config.ts

const variables = options.variables;
for (const variableKey of Object.keys(server.variables)) {
const variable = server.variables[variableKey];
if (variables?.[variableKey]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Empty-string variable values silently fall back to defaults.

if (variables?.[variableKey]) treats an explicitly provided empty string ('') as falsy, causing it to fall through to variable.default on line 105. A user who intentionally sets variables: { basePath: '' } (e.g., to remove a path prefix) would have their value ignored. Use !== undefined instead of truthiness:

-    if (variables?.[variableKey]) {
+    if (variables?.[variableKey] !== undefined) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (variables?.[variableKey]) {
if (variables?.[variableKey] !== undefined) {
🤖 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/getters/route.ts` at line 94, Update the variable lookup
condition in the route getter to check whether variables[variableKey] is not
undefined rather than relying on truthiness. Preserve explicitly provided
empty-string values and only fall back to variable.default when the value is
absent.

Comment on lines +139 to +145
params: filterParams(
params?.() ?? {},
new Set<string>([
'requirednullableString',
'requirednullableStringTwo',
]),
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve required nullable query parameters.

SearchPetsParams declares required nullable fields, but this call omits the preserveRequiredNullables argument. As a result, explicit null values are filtered out despite the fields being required. Pass true as the third argument so the generated request preserves them.

Proposed fix
       params: filterParams(
         params?.() ?? {},
         new Set<string>([
           'requirednullableString',
           'requirednullableStringTwo',
         ]),
+        true,
       ),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
params: filterParams(
params?.() ?? {},
new Set<string>([
'requirednullableString',
'requirednullableStringTwo',
]),
),
params: filterParams(
params?.() ?? {},
new Set<string>([
'requirednullableString',
'requirednullableStringTwo',
]),
true,
),
🤖 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 `@samples/angular-app/src/api/base-url-token/pets/pets.resource.ts` around
lines 139 - 145, Update the filterParams call in the pets resource to pass true
as its third argument, preserving explicit null values for the required nullable
fields in SearchPetsParams while keeping the existing parameter object and
required-field set unchanged.

Comment on lines +178 to +182
const request = {
url: `${baseUrl}/v${version?.() ?? 1}/pets`,
params: filterParams(params?.() ?? {}, new Set<string>([])),
};
const normalizedRequest: HttpResourceRequest = request;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Keep signal reads inside the httpResource factory.

listPetsResource captures params/version, and showPetByIdResource captures petId/version, before httpResource receives its reactive callback. Later signal changes therefore do not update the request URL or query parameters. Move request construction into the callback, as already done in searchPetsResource, showPetTextResource, and downloadFileResource.

Also applies to: 250-251

🤖 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 `@samples/angular-app/src/api/base-url-token/pets/pets.resource.ts` around
lines 178 - 182, Update listPetsResource and showPetByIdResource so request
construction and all reads of params, petId, and version occur inside the
reactive callback passed to httpResource. Match the existing pattern in
searchPetsResource, showPetTextResource, and downloadFileResource, ensuring
later signal changes recompute the URL and query parameters.

@melloware melloware added the angular Related to Angular generation issues label Jul 12, 2026
@melloware

Copy link
Copy Markdown
Collaborator

@the-ult looks like merge conflicts

@melloware
melloware marked this pull request as draft August 8, 2026 12:45
@melloware

Copy link
Copy Markdown
Collaborator

converted to draft until the merge conflicts are resolved.

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.

feat(angular): resolve the base URL through Angular DI instead of baking it into the route

3 participants