Clean up schema by simplifying version structure (#379)

## Summary

Simplified the schema structure by:
- Replacing `version_detail.version` with direct `version` field  
- Removing unused `release_date` field from seed data
- Updating all API types, models, and tests to match new structure
- Maintaining backwards compatibility in API responses

This change makes the schema more intuitive and reduces nesting depth.
This commit is contained in:
adam jones 2025-09-08 14:32:59 -07:00 • committed by GitHub
commit f975e68cf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -63,9 +63,7 @@ func TestPublishEndpoint(t *testing.T) {
Source: "github",
ID: "example/test-server",
},
VersionDetail: model.VersionDetail{
Version: "1.0.0",
},
Version: "1.0.0",
},
tokenClaims: &auth.JWTClaims{
AuthMethod: auth.MethodGitHubAT,
@ -89,9 +87,7 @@ func TestPublishEndpoint(t *testing.T) {
Source: "github",
ID: "example/test-server",
},
VersionDetail: model.VersionDetail{
Version: "1.0.0",
},
Version: "1.0.0",
},
tokenClaims: &auth.JWTClaims{
AuthMethod: auth.MethodNone,
@ -119,7 +115,7 @@ func TestPublishEndpoint(t *testing.T) {
requestBody: apiv0.ServerJSON{
Name: "io.github.domdomegg/test-server",
Description: "Test server",
VersionDetail: model.VersionDetail{Version: "1.0.0"},
Version: "1.0.0",
},
authHeader: "InvalidFormat",
setupRegistryService: func(_ service.RegistryService) {
@ -133,9 +129,7 @@ func TestPublishEndpoint(t *testing.T) {
requestBody: apiv0.ServerJSON{
Name: "test-server",
Description: "A test server",
VersionDetail: model.VersionDetail{
Version: "1.0.0",
},
Version: "1.0.0",
},
authHeader: "Bearer invalidToken",
setupRegistryService: func(_ service.RegistryService) {
@ -149,9 +143,7 @@ func TestPublishEndpoint(t *testing.T) {
requestBody: apiv0.ServerJSON{
Name: "io.github.other/test-server",
Description: "A test server",
VersionDetail: model.VersionDetail{
Version: "1.0.0",
},
Version: "1.0.0",
Repository: model.Repository{
URL: "https://github.com/example/test-server",
Source: "github",
@ -175,9 +167,7 @@ func TestPublishEndpoint(t *testing.T) {
requestBody: apiv0.ServerJSON{
Name: "example/test-server",
Description: "A test server",
VersionDetail: model.VersionDetail{
Version: "1.0.0",
},
Version: "1.0.0",
Repository: model.Repository{
URL: "https://github.com/example/test-server",
Source: "github",
@ -195,9 +185,7 @@ func TestPublishEndpoint(t *testing.T) {
existingServer := apiv0.ServerJSON{
Name: "example/test-server",
Description: "Existing test server",
VersionDetail: model.VersionDetail{
Version: "1.0.0",
},
Version: "1.0.0",
Repository: model.Repository{
URL: "https://github.com/example/test-server-existing",
Source: "github",
@ -214,9 +202,7 @@ func TestPublishEndpoint(t *testing.T) {
requestBody: apiv0.ServerJSON{
Name: "com.example/test-server-mcpb",
Description: "A test server with MCPB package",
VersionDetail: model.VersionDetail{
Version: "1.0.0",
},
Version: "1.0.0",
Packages: []model.Package{
{
RegistryType: model.RegistryTypeMCPB,