Skip to content

Make NetworkPolicy a first-class public Pydantic codec #88

@scotttrinh

Description

@scotttrinh

Summary

NetworkPolicy is exposed publicly as a union of public models, but the actual codec to and from the API shape still lives in the internal ApiNetworkPolicy type. That makes parsing arbitrary payloads and serializing back to JSON awkward for callers, and it leaves the real contract split across public and internal types.

Current State

There are already strong tests around the conversion contract:

Desired Direction

  • Use a first-class Pydantic pattern for NetworkPolicy so it has a proper public codec to and from the API shape.
  • Make it easy to:
    • parse API JSON into the public NetworkPolicy representation
    • serialize the public NetworkPolicy representation back to API JSON
  • Eliminate ApiNetworkPolicy as a distinct internal/public conceptual type if possible.

Scope

  • Replace the split between NetworkPolicy and ApiNetworkPolicy with one public-facing codec story.
  • Keep the current conversion behavior and test coverage, including header-name redaction handling.
  • Ensure sandbox create/get/update flows can use the new codec without callers importing internals.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions