Skip to content

Fix struct duplication between internal/model and tools/publisher #240

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

domdomegg
Copy link
Member

I sincerely apologize for the disruption. This PR was accidentally closed due to an unintended git history rewrite operation that broke the connection between branches. The operation has been reverted and I'm now recreating the affected PRs.\n\nOriginal PR: #217

@domdomegg domdomegg added the question Further information is requested label Aug 8, 2025
@domdomegg domdomegg marked this pull request as draft August 8, 2025 14:16
@rdimitrov
Copy link
Contributor

@domdomegg - It's alright, no worries 🍻 I'll make sure to address your feedback and rebase it 👍

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
@rdimitrov
Copy link
Contributor

@domdomegg - hey, I don't have the rights to mark the PR out of draft and edit the PR description so I'll place it as a comment here -

Motivation and Context

• Remove duplicated structs in tools/publisher and ensure the CLI uses the same schema as the registry.
• Reduce maintenance burden and keep publisher output aligned with the public API.

What’s changed

• Switched publisher to import github.com/modelcontextprotocol/registry/pkg/model (no internal/... dependency).
• Removed local struct definitions in tools/publisher/main.go.
createServerStructure(...) now returns model.ServerDetail; only necessary fields are populated.
• Output is minimal due to omitempty tags in pkg/model. Note: repository.id currently lacks omitempty, so it appears as an empty string.

Example output

{
  "name": "io.github.example/simple-server",
  "description": "A simple MCP server",
  "status": "active",
  "repository": {
    "url": "https://github.com/example/simple-server",
    "source": "github",
    "id": ""
  },
  "version_detail": {
    "version": "1.0.0"
  },
  "packages": [
    {
      "registry_name": "npm",
      "name": "io.github.example/simple-server",
      "version": "1.0.0",
      "runtime_hint": "npx"
    }
  ]
}

How Has This Been Tested?

• Built the publisher and generated a sample server.json; verified unset fields are omitted where omitempty is present.

Breaking Changes

• None.

Types of changes

• Refactor / code hygiene.

Related

• Add omitempty to repository.id or introduce a minimal DTO for publisher output to prevent accidental inclusion of registry-managed fields (already addressed via #285)
• Continues the work from the closed PR #217

@rdimitrov
Copy link
Contributor

Regarding this #217 (review) comment - I assume now that we have the omitempty tags set and they work as intended it shouldn't be needed to do the split you suggested, right?

@domdomegg
Copy link
Member Author

Yep I think this is correct! I think also because of the extensions spec that we've agreed on the model can be exactly the same between publisher and registry :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants