Class CsdlMerger

java.lang.Object
io.skipcheck.tm1.csdl.CsdlMerger

public final class CsdlMerger extends Object
Unions multiple CSDL documents (for example, TM1 11.8.35 and TM1 12.6.0) into one combined model, and resolves local edmx:Reference schemas.

Documents are merged oldest-first: where multiple versions define the same type, property, enum member, operation, or container element, the newest version's descriptions, annotations, and revisions win, while elements present only in older versions (such as v11's Reserve/Release or encryption at rest) are kept. An operation parameter that exists in only a subset of the versions defining the operation, or that carries Core.OptionalParameter, becomes nullable (optional).

  • Method Details

    • merge

      public static CsdlDocument merge(List<CsdlDocument> documents)
      Merges CSDL documents ordered oldest-first, newest-last.
      Parameters:
      documents - the documents to merge (at least one)
      Returns:
      the merged document, carrying the newest document's OData version and Core.SchemaVersion
      Throws:
      IllegalArgumentException - if documents is empty
    • resolveReferences

      public static CsdlDocument resolveReferences(CsdlDocument document, Function<String, Optional<CsdlDocument>> resolver)
      Resolves local (non-HTTP) edmx:Reference elements in document using resolver, appending type-only schemas for the referenced namespaces not already present in document.

      When a referenced schema defines its own EntityContainer (a separate OData service such as ibm.tm1s.api.v1), only the transitive closure of entity, complex, and enum types referenced by document is included — avoiding name collisions (such as tm1s.Session vs tm1.Session) and keeping another service's operations and container out of this service's model. When a referenced schema has no EntityContainer (an extension schema such as ibm.odata.mpu.v1), all of its types and enums are included, without its operations.

      Parameters:
      document - the document whose references to resolve
      resolver - resolves a reference URI (e.g. ibm.tm1s.api.v1.xml) to a parsed document, or empty if unavailable
      Returns:
      a document with the resolved type-only schemas appended