Skip to content

refactor(catalog): split OpenAPI spec into per-plugin files with independent generation#2735

Merged
google-oss-prow[bot] merged 6 commits into
kubeflow:mainfrom
Al-Pragliola:al-pragliola-split-openapi-plugins
May 26, 2026
Merged

refactor(catalog): split OpenAPI spec into per-plugin files with independent generation#2735
google-oss-prow[bot] merged 6 commits into
kubeflow:mainfrom
Al-Pragliola:al-pragliola-split-openapi-plugins

Conversation

@Al-Pragliola
Copy link
Copy Markdown
Contributor

@Al-Pragliola Al-Pragliola commented May 25, 2026

Description

  • Split the monolithic catalog OpenAPI source into per-plugin specs (model.yaml, mcp.yaml) under api/openapi/src/plugins/, keeping only
    core endpoints (sources, labels, preview) in catalog.yaml
  • Add per-plugin server stub generation so each plugin's controller and interfaces are generated independently, while shared model types remain
    in catalog/pkg/openapi/
  • Add scripts/assemble_plugin_spec.sh to build standalone specs per plugin and scripts/merge_catalog_specs.sh to produce the unified
    catalog.yaml

Motivation

The monolithic catalog.yaml source made it difficult to reason about plugin boundaries — adding or modifying a plugin's API required editing
a single large file shared across all plugins. Splitting specs per-plugin:

  • Makes ownership clear: each plugin's paths and schemas live in one file
  • Enables independent server stub generation: changing the MCP spec doesn't regenerate model catalog stubs (and vice versa)
  • Simplifies adding new plugins: drop a <name>.yaml in api/openapi/src/plugins/ and add a generation script

Key changes

Area What changed
api/openapi/src/plugins/model.yaml Model catalog paths + schemas (extracted from catalog.yaml)
api/openapi/src/plugins/mcp.yaml MCP catalog paths + schemas (extracted from catalog.yaml)
api/openapi/src/catalog.yaml Slimmed to core: sources, labels, preview, shared params
scripts/merge_catalog_specs.sh New — merges core + plugins + libs → api/openapi/catalog.yaml
scripts/assemble_plugin_spec.sh New — builds standalone spec for a single plugin
catalog/plugins/*/scripts/ Per-plugin generation scripts replacing monolithic gen_openapi_server.sh
catalog/Makefile Per-plugin Make targets with correct dependencies

Verification

  • api/openapi/catalog.yaml is byte-identical before and after (verified via diff)
  • make api/openapi/catalog.yaml regenerates correctly
  • make -C catalog gen/openapi-server generates both plugin stubs successfully
  • go build ./... in catalog/ compiles cleanly

How Has This Been Tested?

  • Regenerated catalog.yaml matches previous output (no semantic changes)
  • Per-plugin server stub generation succeeds for both model and MCP plugins

Merge criteria:

  • All the commits have been signed-off (To pass the DCO check)
  • The commits have meaningful messages
  • Automated tests are provided as part of the PR for major new functionalities; testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work.
  • Code changes follow the kubeflow contribution guidelines.
  • For first time contributors: Please reach out to the Reviewers to ensure all tests are being run, ensuring the label ok-to-test has been added to the PR.

Al-Pragliola and others added 4 commits May 25, 2026 13:35
Restructure the monolithic catalog.yaml source into per-plugin specs
so each plugin can independently define its own API paths and schemas
while sharing common types from common.yaml.

- Slim api/openapi/src/catalog.yaml to core (sources, labels, preview)
- Add catalog/plugins/model/api/openapi/ (model paths + schemas)
- Add catalog/plugins/mcp/api/openapi/ (MCP paths + schemas)
- Add scripts/merge_catalog_specs.sh to combine core + plugins + lib
- Update Makefile to use merge_catalog_specs.sh for catalog.yaml

The merged output is semantically identical to the previous monolithic
spec — generated code, validation, and tests are unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Generate server stubs (controllers, interfaces) per-plugin instead of
from the unified spec, while keeping client models in catalog/pkg/openapi/.

- Add scripts/assemble_plugin_spec.sh to build standalone specs per plugin
- Add catalog/plugins/{model,mcp}/scripts/gen_openapi_server.sh for
  independent per-plugin code generation
- Add per-plugin .openapi-generator-ignore files
- Split api.go into api_model.go + api_mcp.go (same package, no breaking change)
- Refactor catalog/scripts/gen_openapi_server.sh into orchestrator
- Update catalog/Makefile with per-plugin targets and dependency isolation

Changing a plugin's spec only regenerates that plugin's controller.
Generated output is identical to the previous unified generation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Co-locate plugin specs with other OpenAPI sources under api/openapi/src/
instead of catalog/plugins/*/api/openapi/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Flatten per-plugin directory structure (openapi.yaml + components.yaml)
into single files (model.yaml, mcp.yaml) under api/openapi/src/plugins/.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Al-Pragliola and others added 2 commits May 25, 2026 14:04
Regenerate .gitattributes to reflect api.go → api_model.go/api_mcp.go
rename. Fix clean-internal-server-openapi to also delete per-plugin
output files so both plugins regenerate after a clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
Clean up README.md, api/openapi.yaml, and .openapi-generator-ignore
after each plugin generation run to prevent untracked files in CI.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
@Al-Pragliola Al-Pragliola requested a review from pboyd May 25, 2026 13:08
Copy link
Copy Markdown
Member

@pboyd pboyd left a comment

Choose a reason for hiding this comment

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

/lgtm

@Al-Pragliola
Copy link
Copy Markdown
Contributor Author

/approve

@google-oss-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Al-Pragliola

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot merged commit 86eb885 into kubeflow:main May 26, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants