Skip to content

fix: Update the validator criteria to allow wifi config is empty when DHCP is false#799

Open
choonkeat1986 wants to merge 1 commit intomainfrom
jira796
Open

fix: Update the validator criteria to allow wifi config is empty when DHCP is false#799
choonkeat1986 wants to merge 1 commit intomainfrom
jira796

Conversation

@choonkeat1986
Copy link

Describe the issue
When create a profile with a network configuration for wired connection as static. There will be error promp when try to save the profile. The error promp as such "Invalid input: Key: 'Profile.WiFiConfigs' Error:Field validation for 'WiFiConfigs' failed on the 'excluded_if' tag"

What are you changing?
Update the profile validator to allow the wificonfig is empty when DHCP is false.

Tested:

  • Added profile with DHCP is false and save the profile without error.

@choonkeat1986 choonkeat1986 force-pushed the jira796 branch 3 times, most recently from cbe777a to 5fbc08f Compare February 12, 2026 07:51
@choonkeat1986 choonkeat1986 requested review from Copilot and removed request for shaoboon February 12, 2026 08:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates profile validation to allow empty wifiConfigs when dhcpEnabled is false, preventing erroneous validation failures when saving static wired profiles.

Changes:

  • Replaced excluded_if validation on WiFiConfigs with a custom wifidhcp validator.
  • Registered the new validator in profile routes and added parallelized validation-focused HTTP tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
internal/entity/dto/v1/profile.go Adds ValidateWiFiDHCP and switches WiFiConfigs to use the new wifidhcp binding tag.
internal/controller/httpapi/v1/profiles.go Registers the new wifidhcp validator with Gin’s validator engine.
internal/controller/httpapi/v1/profiles_test.go Adds validation tests and introduces a shared custom validator with locking to support parallel tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@choonkeat1986 choonkeat1986 force-pushed the jira796 branch 6 times, most recently from 3b42838 to 05be8a9 Compare February 19, 2026 06:06
@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 39.66%. Comparing base (5b7221f) to head (1951c2f).

Files with missing lines Patch % Lines
internal/controller/httpapi/v1/profiles.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #799      +/-   ##
==========================================
+ Coverage   39.63%   39.66%   +0.02%     
==========================================
  Files         113      113              
  Lines       10754    10761       +7     
==========================================
+ Hits         4262     4268       +6     
- Misses       6093     6094       +1     
  Partials      399      399              

☔ 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.

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

Comments