Skip to content

Support IPv4 and IPv6 in net.IP schemas - #199

Open
LPX-E5BD8 wants to merge 3 commits into
invopop:mainfrom
LPX-E5BD8:fix-net-ip-ipv6
Open

LPX-E5BD8 wants to merge 3 commits into
invopop:mainfrom
LPX-E5BD8:fix-net-ip-ipv6

Conversation

@LPX-E5BD8

Copy link
Copy Markdown

fixes #198

net.IP uses ParseIP so ipv6 is valid.
schema was ipv4 only.

emit anyOf ipv4/ipv6. test + fixtures.

Copilot AI lite review requested due to automatic review settings August 14, 2026 07:12

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.

Pull request overview

Updates JSON Schema generation to correctly model net.IP values as accepting both IPv4 and IPv6, aligning the emitted schema with net.IP.UnmarshalText / net.ParseIP.

Changes:

  • Emit anyOf with "format": "ipv4" and "format": "ipv6" for net.IP.
  • Add a regression test covering net.IP schema generation.
  • Update schema fixtures to match the new net.IP output.

Reviewed changes

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

Show a summary per file
File Description
reflect.go Switch net.IP schema from IPv4-only to anyOf (IPv4/IPv6).
reflect_test.go Add regression test for net.IP schema output.
fixtures/test_user.json Update network_address to anyOf IPv4/IPv6 (plus fixture reformat/reordering).
fixtures/test_user_assign_anchor.json Update network_address to anyOf IPv4/IPv6 (plus fixture reformat/reordering).
fixtures/required_from_jsontags.json Update network_address to anyOf IPv4/IPv6 (plus fixture reformat/reordering).
fixtures/no_reference.json Update network_address to anyOf IPv4/IPv6 (plus fixture reformat/reordering).
fixtures/no_reference_anchor.json Update network_address to anyOf IPv4/IPv6 (plus fixture reformat/reordering).
fixtures/ignore_type.json Update network_address to anyOf IPv4/IPv6 (plus fixture reformat/reordering).
fixtures/defaults_expanded_toplevel.json Update network_address to anyOf IPv4/IPv6 (plus fixture reformat/reordering).
fixtures/custom_additional.json Update ip_addr to anyOf IPv4/IPv6.
fixtures/allow_additional_props.json Update network_address to anyOf IPv4/IPv6 (plus fixture reformat/reordering).

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

Comment thread reflect.go Resolved
Comment thread reflect_test.go Resolved
@LPX-E5BD8 LPX-E5BD8 changed the title fix net.IP schema to accept ipv6 Support IPv4 and IPv6 in net.IP schemas Aug 15, 2026
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.

net.IP schema should accept ipv6 and ipv4

2 participants