Skip to content

openapi: split load.go by concern #1058

Closed

Description

@OmarAlJarrah

Problem

The rest of compilers/openapi/internal/load keeps one concern per file (later.go, required.go, references.go). load.go (1,150 lines) still holds four concerns beside the load itself:

  • the source budgets;
  • YAML stream decoding;
  • the parser's validation findings;
  • overlay application.

Direction

  • budgets.go: exceeds, budgetRefusal, OverByteBudget, nodeCount (it pairs with the existing budgets_internal_test.go).
  • decode.go: the YAML stream decoding and Parsed.
  • overlays.go: patch, applyOverlay, overlayRefusals.
  • The parser's validation findings join validate.go, beside the rule-table validation feat(compilers/openapi)!: validate against an OpenAPI rule table #1046 adds under that name. If that file turns out to hold something else, the findings take a name that does not collide, and the PR says why.
  • load.go keeps Load, its options, the resolution setup and the supported versions. The package comment moves to doc.go.
  • Tests in load_internal_test.go follow what they call; the package's other test files stay as they are.

Blocked by

#1046 rewrites load.go, load_internal_test.go and most of the package, and adds validate.go.

Done when

  • Every top-level declaration of the package, with its doc comment and any comment between declarations, is byte-identical before and after the move (compared with a throwaway go/ast script), and no golden changes.
  • Comments that name a file name the file the code now lives in, changed in a commit of their own.
  • go test ./compilers/openapi/... passes without -update.

Priority: P4, rule 1 (housekeeping: moves code between files and changes no lowering, validation, IR or emit-contract behaviour). wc -l compilers/openapi/internal/load/load.go → 1150 (morphic @a1f15b29).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:P4Refactors, tests, CI, hostile-input hardening, cosmetic diagnostics, other formatstype:choreRefactor or cleanup, no behavior change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions