Skip to content

feat!: add endpoint conventions and metadata for 2.0.0-preview.2 - #9

Merged
ling921 merged 3 commits into
masterfrom
codex/2.0.0-preview.1
Sep 30, 2026
Merged

ling921 merged 3 commits into
masterfrom
codex/2.0.0-preview.1

Conversation

@ling921

@ling921 ling921 commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • Add typed convention builders at registry, service, and individual operation scopes for endpoint filters and common ASP.NET Core endpoint conventions.
  • Add contract attributes for endpoint metadata, with optional HTTP method selectors, and emit the corresponding native Minimal API metadata from the source generator.
  • Inherit method declarations, metadata, policies, parameter binding, and XML documentation through service interface hierarchies; report conflicting inherited declarations and duplicate endpoint names at compile time.
  • Update the English and Chinese documentation and changelog for the corrected 2.0.0-preview.2 package version.

Breaking changes

This is the first usable 2.0.0 preview. RemoteMethodAttribute.SuccessStatusCode is now a non-nullable int because nullable types are not valid CLR attribute named-argument types; 0 retains the default success status behavior.

The earlier v2.0.0-preview.1 GitHub tag was accidentally created from master and has been marked withdrawn. Its workflow found only existing 1.0.0 packages and published no 2.0.0 packages.

Validation

  • Windows Release tests passed for the supported target frameworks.
  • Linux Release packaging passed, including Native AOT client/server roundtrip and all three NuGet packages.
  • Windows package build verified all three package manifests are versioned 2.0.0-preview.2.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 163dde1edb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +80 to +84
var httpMethodSelector = attribute.NamedArguments.FirstOrDefault(argument => argument.Key == "HttpMethod");
if (httpMethodSelector.Key is not null
&& (httpMethod is null || httpMethodSelector.Value.Value is not int selectedMethod || selectedMethod != httpMethod))
{
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject invalid policy HTTP-method selectors

When a policy attribute uses an out-of-range selector, such as [RemoteAuthorize("Admin", HttpMethod = (RemoteHttpMethod)99)], this branch silently skips it for every operation without reporting a contract diagnostic. In the authorization case that can leave the endpoint unprotected despite an explicit authorization declaration; validate the selector before filtering, as EndpointMetadataParser already does for non-policy metadata.

Useful? React with 👍 / 👎.

Comment on lines +303 to +304
if (verbAttribute.NamedArguments.Any(argument => argument.Key == "SuccessStatusCode")
&& successStatus is < 100 or > 299)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict successful endpoint statuses to 2xx

This validation accepts informational statuses from 100 through 199 as SuccessStatusCode. An attribute such as [Get(SuccessStatusCode = 100)] therefore generates an endpoint that attempts to use an informational response as its final result, while the generated client checks HttpResponseMessage.IsSuccessStatusCode and treats every non-2xx response as a failure. Reject values below 200 so server and client agree on what constitutes success.

Useful? React with 👍 / 👎.

@ling921 ling921 changed the title feat!: add endpoint conventions and metadata for 2.0.0-preview.1 feat!: add endpoint conventions and metadata for 2.0.0-preview.2 Sep 29, 2026
@ling921
ling921 merged commit f08ceb9 into master Sep 30, 2026
1 check passed
@ling921
ling921 deleted the codex/2.0.0-preview.1 branch September 30, 2026 03:03
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.

1 participant