@@ -319,3 +319,106 @@ func (svc *Service) ListMetadefResourceTypes(c *gin.Context) {
319319
320320 c .JSON (http .StatusOK , gin.H {"resource_types" : resourceTypes })
321321}
322+
323+ // --- Metadefs schema documents (GET /v2/schemas/metadefs/*) ---
324+ //
325+ // Upstream Glance serves these static JSON schemas; Horizon's Angular "Create Image"
326+ // modal loads /v2/schemas/metadefs/namespace before it renders. Without the route it
327+ // 404s, the modal's response handler reads `.data` off undefined (TypeError), and the
328+ // create fails with "Unable to retrieve namespace / project / create image". These are
329+ // fixed documents, so they need no database and no auth-specific state.
330+
331+ // GetMetadefNamespaceSchema handles GET /v2/schemas/metadefs/namespace.
332+ func (svc * Service ) GetMetadefNamespaceSchema (c * gin.Context ) {
333+ c .JSON (http .StatusOK , gin.H {
334+ "name" : "namespace" ,
335+ "additionalProperties" : false ,
336+ "properties" : gin.H {
337+ "namespace" : gin.H {"type" : "string" , "description" : "The unique namespace text." },
338+ "display_name" : gin.H {"type" : "string" , "description" : "The user friendly name for the namespace." },
339+ "description" : gin.H {"type" : "string" , "description" : "Provides a user friendly description of the namespace." },
340+ "visibility" : gin.H {"type" : "string" , "enum" : []string {"public" , "private" }, "description" : "Scope of namespace accessibility." },
341+ "protected" : gin.H {"type" : "boolean" , "description" : "If true, namespace will not be deletable." },
342+ "owner" : gin.H {"type" : "string" , "description" : "Owner of the namespace." },
343+ "created_at" : gin.H {"type" : "string" , "format" : "date-time" },
344+ "updated_at" : gin.H {"type" : "string" , "format" : "date-time" },
345+ "self" : gin.H {"type" : "string" },
346+ "schema" : gin.H {"type" : "string" },
347+ "resource_type_associations" : gin.H {"type" : "array" },
348+ "properties" : gin.H {"type" : "object" },
349+ "objects" : gin.H {"type" : "array" },
350+ "tags" : gin.H {"type" : "array" },
351+ },
352+ })
353+ }
354+
355+ // GetMetadefNamespacesSchema handles GET /v2/schemas/metadefs/namespaces.
356+ func (svc * Service ) GetMetadefNamespacesSchema (c * gin.Context ) {
357+ c .JSON (http .StatusOK , gin.H {
358+ "name" : "namespaces" ,
359+ "properties" : gin.H {
360+ "namespaces" : gin.H {"type" : "array" , "items" : gin.H {"type" : "object" , "name" : "namespace" }},
361+ "first" : gin.H {"type" : "string" },
362+ "next" : gin.H {"type" : "string" },
363+ "schema" : gin.H {"type" : "string" },
364+ },
365+ })
366+ }
367+
368+ // GetMetadefResourceTypeSchema handles GET /v2/schemas/metadefs/resource_type[s].
369+ func (svc * Service ) GetMetadefResourceTypeSchema (c * gin.Context ) {
370+ c .JSON (http .StatusOK , gin.H {
371+ "name" : "resource_type_association" ,
372+ "properties" : gin.H {
373+ "name" : gin.H {"type" : "string" },
374+ "prefix" : gin.H {"type" : "string" },
375+ "properties_target" : gin.H {"type" : "string" },
376+ "created_at" : gin.H {"type" : "string" , "format" : "date-time" },
377+ "updated_at" : gin.H {"type" : "string" , "format" : "date-time" },
378+ },
379+ })
380+ }
381+
382+ // GetMetadefObjectSchema handles GET /v2/schemas/metadefs/object[s].
383+ func (svc * Service ) GetMetadefObjectSchema (c * gin.Context ) {
384+ c .JSON (http .StatusOK , gin.H {
385+ "name" : "object" ,
386+ "properties" : gin.H {
387+ "name" : gin.H {"type" : "string" },
388+ "description" : gin.H {"type" : "string" },
389+ "required" : gin.H {"type" : "array" },
390+ "properties" : gin.H {"type" : "object" },
391+ "schema" : gin.H {"type" : "string" },
392+ "self" : gin.H {"type" : "string" },
393+ "created_at" : gin.H {"type" : "string" , "format" : "date-time" },
394+ "updated_at" : gin.H {"type" : "string" , "format" : "date-time" },
395+ },
396+ })
397+ }
398+
399+ // GetMetadefPropertySchema handles GET /v2/schemas/metadefs/property|properties.
400+ func (svc * Service ) GetMetadefPropertySchema (c * gin.Context ) {
401+ c .JSON (http .StatusOK , gin.H {
402+ "name" : "property" ,
403+ "properties" : gin.H {
404+ "name" : gin.H {"type" : "string" },
405+ "title" : gin.H {"type" : "string" },
406+ "type" : gin.H {"type" : "string" },
407+ "description" : gin.H {"type" : "string" },
408+ "default" : gin.H {"type" : "string" },
409+ "enum" : gin.H {"type" : "array" },
410+ },
411+ })
412+ }
413+
414+ // GetMetadefTagSchema handles GET /v2/schemas/metadefs/tag[s].
415+ func (svc * Service ) GetMetadefTagSchema (c * gin.Context ) {
416+ c .JSON (http .StatusOK , gin.H {
417+ "name" : "tag" ,
418+ "properties" : gin.H {
419+ "name" : gin.H {"type" : "string" },
420+ "created_at" : gin.H {"type" : "string" , "format" : "date-time" },
421+ "updated_at" : gin.H {"type" : "string" , "format" : "date-time" },
422+ },
423+ })
424+ }
0 commit comments