Class TypeMetadataService

java.lang.Object
ai.pipestream.registration.metadata.TypeMetadataService

@ApplicationScoped public class TypeMetadataService extends Object
The type metadata catalog: layered field annotations over message types.

Layer precedence, lowest to highest: BAKED (proto doc-comments from the descriptor snapshot) < GLOBAL (the promoted Apicurio overlay) < GLOBAL_DRAFT (DB) < PIPELINE (DB, graph-scoped, participates only when a graph is named). Merging is whole-entry per field path — a higher layer's entry replaces the lower layer's entry for that path outright.

Saves are full-replace per scope and validated: the type must exist in the descriptor snapshot and every field path must resolve against it (annotations are metadata additions only; they can never reference fields that do not exist). Promotion (phase 1) writes the global draft to the Apicurio system of record — immediately visible to every merged read — and queues a pending-bake record for the phase-2 git automation.

  • Constructor Details

    • TypeMetadataService

      public TypeMetadataService()
  • Method Details

    • getMerged

      public ai.pipestream.platform.registration.v1.GetTypeMetadataResponse getMerged(String messageFullName, String graphId)
      Builds one type's merged view with per-layer provenance.
      Parameters:
      messageFullName - the type
      graphId - when non-blank, this graph's PIPELINE overlay participates
      Returns:
      the merged response
      Throws:
      NoSuchElementException - when the type is not in the snapshot
    • save

      public TypeMetadataService.SaveResult save(ai.pipestream.platform.registration.v1.MetadataScope scope, String graphId, String messageFullName, Map<String, ai.pipestream.platform.registration.v1.FieldMetadataEntry> fields)
      Fully replaces one scope's annotations for a type. An empty map deletes.
      Parameters:
      scope - PIPELINE (requires graphId) or GLOBAL_DRAFT (graphId must be blank)
      graphId - the graph for PIPELINE scope
      messageFullName - the annotated type
      fields - field path → entry
      Returns:
      the persisted state
      Throws:
      IllegalArgumentException - on bad scope/graph combination or unknown field path
      NoSuchElementException - when the type is not in the snapshot
    • promote

      public TypeMetadataService.PromoteResult promote(String messageFullName)
      Promotes a type's global draft to the Apicurio system of record and queues the phase-2 bake record. The draft is consumed (deleted) — its content now serves from the GLOBAL layer.
      Parameters:
      messageFullName - the type whose draft to promote
      Returns:
      the Apicurio version + pending-bake id
      Throws:
      NoSuchElementException - when the type has no global draft