Skip to content

Wire RestAPI OBS3004 path validation and OBS3005 on R3#65

Merged
Skymly merged 1 commit into
mainfrom
feature/restapi/obs3004-parser
Jun 6, 2026
Merged

Wire RestAPI OBS3004 path validation and OBS3005 on R3#65
Skymly merged 1 commit into
mainfrom
feature/restapi/obs3004-parser

Conversation

@Skymly
Copy link
Copy Markdown
Owner

@Skymly Skymly commented Jun 6, 2026

Summary

  • Validate HTTP path {placeholder} names against method parameters (OBS3004)
  • R3 generator emits OBS3005 when interface uses IObservable<T>

Test plan

  • GetUser_path_parameter_mismatch_reports_OBS3004 generator test
  • CI build-test + pack

Closes #60


Note

Low Risk
Compile-time generator diagnostics only; no runtime API or auth changes.

Overview
The RestAPI source generator now validates HTTP route paths on attributed methods: {placeholder} segments must match the method’s parameters exactly (excluding CancellationToken), or it reports OBS3004.

For the R3 generator flavor, IObservable<T> on an interface now emits OBS3005 (SystemReactiveNotReferenced) instead of the generic unsupported-return diagnostic, steering users toward the Reactive package.

A generator test asserts OBS3004 when the path has {id} but the method has extra parameters.

Reviewed by Cursor Bugbot for commit c733b28. Configure here.

1、Report OBS3004 when path placeholders do not match method parameters

2、Report OBS3005 (not OBS3003) when R3 generator sees IObservable return types

3、Add generator test for OBS3004

Closes #60
@Skymly Skymly merged commit 7e58540 into main Jun 6, 2026
2 checks passed
@Skymly Skymly deleted the feature/restapi/obs3004-parser branch June 6, 2026 12:41
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit c733b28. Configure here.

DiagnosticDescriptors.PathParameterMismatch,
methodSymbol.Locations.FirstOrDefault(),
methodSymbol.Name));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Path validation rejects valid APIs

High Severity

ValidatePathTemplate treats path {placeholder} names and method parameters as sets that must match exactly via SetEquals, counting every parameter except CancellationToken by parameter.Name. The RestAPI runtime in RestMethodInfoInternal still binds extra parameters as query values, body/header/property parameters via attributes, and path tokens using AliasAs with case-insensitive names—so many interfaces that compile and run today will now fail with OBS3004.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c733b28. Configure here.

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.

Wire RestAPI OBS3004 path template validation and OBS3005 on R3

1 participant