Skip to content

Add request validation and tests for API input models#11

Open
dangerworm wants to merge 1 commit into
developmentfrom
codex/add-validation-to-api-route-handlers
Open

Add request validation and tests for API input models#11
dangerworm wants to merge 1 commit into
developmentfrom
codex/add-validation-to-api-route-handlers

Conversation

@dangerworm
Copy link
Copy Markdown
Owner

Summary

  • add FluentValidation integration with custom invalid model responses for API endpoints
  • add input validators and parameter checks across user, theme, and item history routes
  • introduce xUnit test project covering validation edge cases for input models

Testing

  • Not run (dotnet SDK not available in environment)

Codex Task

Copy link
Copy Markdown

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

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.

ℹ️ 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 +25 to +29
builder.Services.AddValidatorsFromAssemblyContaining<UserDetailsInputModelValidator>();
builder.Services.AddFluentValidationAutoValidation();
builder.Services.AddFluentValidationClientsideAdapters();

builder.Services.Configure<ApiBehaviorOptions>(options =>
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 Fix missing FluentValidation/MVC usings to compile

Program.cs now calls AddValidatorsFromAssemblyContaining, AddFluentValidationAutoValidation, and configures ApiBehaviorOptions, but the file has no using FluentValidation;, using FluentValidation.AspNetCore;, or using Microsoft.AspNetCore.Mvc;. These extension methods and types are not covered by the Web SDK implicit usings, so the project will not compile (IServiceCollection won’t have those methods and ApiBehaviorOptions/BadRequestObjectResult are unresolved). Add the required using directives or fully qualify the types to restore a successful build.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant