Repository navigation
feat!: add endpoint conventions and metadata for 2.0.0-preview.2 - #9
Conversation
There was a problem hiding this comment.
💡 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".
| 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; |
There was a problem hiding this comment.
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 👍 / 👎.
| if (verbAttribute.NamedArguments.Any(argument => argument.Key == "SuccessStatusCode") | ||
| && successStatus is < 100 or > 299) |
There was a problem hiding this comment.
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 👍 / 👎.
What changed
2.0.0-preview.2package version.Breaking changes
This is the first usable 2.0.0 preview.
RemoteMethodAttribute.SuccessStatusCodeis now a non-nullableintbecause nullable types are not valid CLR attribute named-argument types;0retains the default success status behavior.The earlier
v2.0.0-preview.1GitHub tag was accidentally created frommasterand has been marked withdrawn. Its workflow found only existing 1.0.0 packages and published no 2.0.0 packages.Validation
2.0.0-preview.2.