Skip to content

fix: fix required management - #9

Merged
cowan-macady merged 1 commit into
masterfrom
fix-required
Sep 7, 2026
Merged

fix: fix required management#9
cowan-macady merged 1 commit into
masterfrom
fix-required

Conversation

@cowan-macady

@cowan-macady cowan-macady commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

implement ENG-9690

Pull request

What this PR does

  • fix required management
  • change go version

Effect on annotations and output

How it was tested

  • make test passes
  • make lint passes
  • Tests added/updated for the new behavior (positive case + edge case)
  • make parity run (if output-affecting) — repo and result:

implement [ENG-9690]
Copilot AI lite review requested due to automatic review settings September 7, 2026 09:19
@cowan-macady
cowan-macady requested a review from a team as a code owner September 7, 2026 09:19
@deepsource-io

deepsource-io Bot commented Sep 7, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 48e3484...49f87e7 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Go Sep 7, 2026 9:21a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Copilot AI 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.

🟡 Changes recommended

It introduces a minimum Go version bump that appears out-of-scope for the stated “required management” fix and needs explicit justification or removal due to compatibility impact.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adjusts how required validation rules are interpreted when generating schema required fields, ensuring that required appearing after dive (and within keys/endkeys) constrains elements rather than making the field itself required.

Changes:

  • Add isRequiredRule to detect only top-level required (pre-dive) for required-field emission.
  • Update validation rule application so dive descends into map values (additionalProperties) and keys/endkeys rules don’t leak onto values.
  • Update testdata and unit tests to cover optional map semantics with dive,keys/endkeys, plus bump the minimum Go version in go.mod/CONTRIBUTING.md.
File summaries
File Description
testdata/sample.go Adds a map field exercising omitempty,dive,keys/endkeys required semantics.
go.mod Bumps the module’s Go version to 1.27.1.
gen/schema.go Switches required detection to isRequiredRule for validate/binding tags.
gen/internal_test.go Adds unit tests for map dive/keys behavior and isRequiredRule.
gen/gen_test.go Adds integration-style assertions that map constraints apply to values and the field remains optional.
gen/constrain.go Implements isRequiredRule, map-aware dive descent, and keys/endkeys skipping.
CONTRIBUTING.md Updates documented minimum Go version to 1.27+.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread go.mod
@cowan-macady
cowan-macady merged commit d1afeda into master Sep 7, 2026
9 checks passed
@cowan-macady
cowan-macady deleted the fix-required branch September 7, 2026 13:18
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.

3 participants