Skip to content

fix(@angular/common): httpRequests and httpResources disabled by default since v0.90#3678

Merged
mrlubos merged 3 commits into
mainfrom
copilot/fix-angular-common-http-config
Apr 2, 2026
Merged

fix(@angular/common): httpRequests and httpResources disabled by default since v0.90#3678
mrlubos merged 3 commits into
mainfrom
copilot/fix-angular-common-http-config

Conversation

Copilot AI commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Closes #3550

Since v0.90, adding @angular/common to the plugin list generates nothing — both httpRequests and httpResources silently default to disabled. Additionally, explicitly setting httpResources: 'flat' crashes with Error: Symbol is not resolved to a node because the resource implementation references request symbols that don't exist when httpRequests is disabled.

Root cause

In resolveHttpRequests and resolveHttpResources, undefined input (user omitted the option) falls into the !input branch and resolves to { enabled: false }, overriding defaultValue.enabled: true:

// undefined → !input is true → { enabled: Boolean(undefined) } → { enabled: false }
} else if (typeof input === 'boolean' || !input) {
  input = { enabled: Boolean(input) };
}

Fix

Separate the undefined case so it passes an empty object and lets context.valueToObject apply all defaults:

} else if (typeof input === 'boolean') {
  input = { enabled: input };
} else if (!input) {
  input = {};  // undefined → use defaults → enabled: true, strategy: 'flat'
}

This also resolves the httpResources: 'flat' crash: when httpRequests is not specified it now defaults to enabled, providing the request symbols that httpResources depends on.

Changes

  • httpRequests/config.ts — fix undefined input treated as false
  • httpResources/config.ts — same fix
  • Test snapshots — add missing @angular/common.gen.ts output for the default scenario across all three OpenAPI versions (2.0.x, 3.0.x, 3.1.x)

@bolt-new-by-stackblitz

Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@vercel

vercel Bot commented Apr 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hey-api-docs Ready Ready Preview, Comment Apr 2, 2026 11:43pm

Request Review

@changeset-bot

changeset-bot Bot commented Apr 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7ad5a2c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copilot AI linked an issue Apr 2, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix @angular/common plugin issue in @hey-api/openapi-ts fix(@angular/common): httpRequests and httpResources disabled by default since v0.90 Apr 2, 2026
Copilot AI requested a review from mrlubos April 2, 2026 20:34
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 2, 2026
@mrlubos mrlubos force-pushed the copilot/fix-angular-common-http-config branch from de76132 to 7ad5a2c Compare April 2, 2026 23:43
@mrlubos mrlubos marked this pull request as ready for review April 2, 2026 23:43
@pullfrog

pullfrog Bot commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

Reviewed PR #3678 and approved. The fix correctly separates the undefined and false cases in both resolveHttpRequests and resolveHttpResources, letting valueToObject apply the intended enabled: true default. Verified no similar buggy patterns exist elsewhere in the codebase.

Task list (6/6 completed)
  • Read the diff for core config changes (httpRequests/config.ts, httpResources/config.ts)
  • Read the changeset
  • Review test snapshots for correctness
  • Verify fix logic against valueToObject/defaults pattern
  • Check for similar patterns elsewhere that may need the same fix
  • Submit review or report progress

Pullfrog  | View workflow run | Triggered by Pullfrog𝕏

@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. bug 🔥 Broken or incorrect behavior. labels Apr 2, 2026
@pkg-pr-new

pkg-pr-new Bot commented Apr 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

@hey-api/codegen-core

npm i https://pkg.pr.new/@hey-api/codegen-core@3678

@hey-api/json-schema-ref-parser

npm i https://pkg.pr.new/@hey-api/json-schema-ref-parser@3678

@hey-api/nuxt

npm i https://pkg.pr.new/@hey-api/nuxt@3678

@hey-api/openapi-ts

npm i https://pkg.pr.new/@hey-api/openapi-ts@3678

@hey-api/shared

npm i https://pkg.pr.new/@hey-api/shared@3678

@hey-api/spec-types

npm i https://pkg.pr.new/@hey-api/spec-types@3678

@hey-api/types

npm i https://pkg.pr.new/@hey-api/types@3678

@hey-api/vite-plugin

npm i https://pkg.pr.new/@hey-api/vite-plugin@3678

commit: 7ad5a2c

@codecov

codecov Bot commented Apr 2, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.39%. Comparing base (dfbd9a1) to head (7ad5a2c).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...src/plugins/@angular/common/httpRequests/config.ts 75.00% 1 Missing ⚠️
...rc/plugins/@angular/common/httpResources/config.ts 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3678      +/-   ##
==========================================
+ Coverage   38.31%   39.39%   +1.08%     
==========================================
  Files         520      520              
  Lines       19275    19279       +4     
  Branches     5712     5708       -4     
==========================================
+ Hits         7385     7595     +210     
+ Misses       9617     9445     -172     
+ Partials     2273     2239      -34     
Flag Coverage Δ
unittests 39.39% <75.00%> (+1.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrlubos mrlubos merged commit 549a42e into main Apr 2, 2026
12 checks passed
@mrlubos mrlubos deleted the copilot/fix-angular-common-http-config branch April 2, 2026 23:47

@pullfrog pullfrog 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.

Fix is correct and minimal. The old typeof input === 'boolean' || !input condition conflated false and undefined, causing Boolean(undefined) to silently disable both features. Splitting into separate branches lets undefined pass an empty object to valueToObject, which correctly applies defaultValue.enabled: true. Verified no similar buggy patterns exist elsewhere in the plugin configs. Snapshots are structurally sound across all three spec versions.

Pullfrog  | View workflow run𝕏

@hey-api hey-api Bot mentioned this pull request Apr 2, 2026
@hey-api hey-api Bot mentioned this pull request Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🔥 Broken or incorrect behavior. lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@angular/common broken since 0.90

2 participants