Skip to content

domain-facts.json

One dossier per corpus type, with every fact the model holds about it pre-joined: annotations with their written arguments, fields joined to their declared types, operations with their invocations, accesses and throw sites. Written by domain-facts.

No dossier is emitted for a stub type. Field names are those of DomainFacts in packages/analyzer/src/domain-facts.ts.

Top level

FieldTypeMeaning
kindstringalways codegraph.domainFacts/1
generatedBystringalways @codegraph/analyzer
viewViewDescriptor{name, filters}
langsstring[]distinct lang values in the union, sorted
frameworkstringthe framework profile applied, when one was
modulesModuleFact[]sorted by id
typesTypeDossier[]sorted by id
diagnosticsobjecttypes, operations, invocations, accesses, throwSites, and wiring when a framework was applied

modules[] — ModuleFact

FieldTypeMeaning
idEntityId
namestring
typesEntityId[]the dossier types this module contains, sorted
importsModuleImportFact[]{to, name?, count, external} — count is the base import edges folded into this one

types[] — TypeDossier

FieldTypeMeaning
idEntityId
kindstring
namestring
moduleEntityIdthe containing module
anchor{file, span}
locnumbergross span length, derived from the anchor
stereotypestringthe framework’s own word for what the type is FOR, when a profile said so
annotationsAnnotationFact[]
supertypesSupertypeFact[]
metricsRecord<string, number>the extractor’s measures, unmodified; absent means “not measured”
fieldsFieldFact[]
operationsOperationFact[]
injectionPointsInjectionPoint[]where the container hands dependencies in, with the corpus candidates

AnnotationFact

FieldMeaning
annotationthe annotation type — normally a stub, its jar being absent
nameits simple name, when the model carries one
modulethe declaring module’s name — what a framework table matches on
argumentsNamedArgument[], the written values
anchor

SupertypeFact

{to, name?, relation, external, provenance} — relation is "inheritance" or "interfaceImplementation".

FieldFact

FieldMeaning
id, kind, name
declaredType, declaredTypeName
declaredTypeKindthe declared type’s profile kind (enum, class, …) — carried, not interpreted
declaredTypeExternal
annotations
valuethe declaration-site constant (Literal), when the model carries one
anchor

OperationFact

FieldMeaning
id, kind, name, signature, anchor
locgross span length
entryPointa framework entry-point annotation sits on it (nothing in the corpus calls it)
annotations
metricsthe extractor’s measures; absent means “not measured”
invocationsInvocationFact[] — includes facts from nested lambdas and blocks, anchored where they occurred
accessesAccessFact[]
throwsThrowFact[]

InvocationFact: {to, targetType?, targetTypeName?, targetStereotype?, external, provenance, anchor}. AccessFact: {to, field?, ownerType?, ownerTypeName?, isRead, isWrite, external, provenance, anchor}. ThrowFact: {to, name?, external, provenance, anchor}.

InjectionPoint

Present only with --framework. An inference, labelled as one.

FieldMeaning
idthe attribute or parameter the container fills
consumerthe stereotyped type it belongs to
declaredTypethe declared type asked for; absent when the model does not say
via"annotation" or "sole-constructor" — how the point was recognized
qualifier@Qualifier("x") / @Named("x"), when one narrows this point
candidatescorpus implementations the container could supply, sorted; possibly empty
notewhy the candidate set is empty or narrowed — stated, never silent

Excerpt

codegraph domain-facts fixtures/java/expected/model.jsonl — 19 type dossiers, 58 operations — trimmed:

{
  "kind": "codegraph.domainFacts/1",
  "generatedBy": "@codegraph/analyzer",
  "view": { "name": "all", "filters": [] },
  "langs": ["java"],
  "modules": [
    { "id": "java:com.acme.order", "name": "com.acme.order",
      "types": ["java:com.acme.order/AbstractOrder", "java:com.acme.order/Audited"],
      "imports": [
        { "to": "java:com.megacorp.ledger", "name": "com.megacorp.ledger", "count": 2, "external": true },
        { "to": "java:java.lang.annotation", "name": "java.lang.annotation", "count": 2, "external": true }
      ] }
  ],
  "types": [
    { "id": "java:com.acme.order.adapter/LedgerAdapter", "kind": "class", "name": "LedgerAdapter",
      "supertypes": [
        { "to": "java:com.megacorp.ledger/LedgerClient", "name": "LedgerClient",
          "relation": "inheritance", "external": true, "provenance": "declared" }
      ],
      "fields": [
        { "id": "java:com.acme.order/Order.MAX_LINES", "kind": "attribute", "name": "MAX_LINES",
          "annotations": [], "value": { "k": "number", "v": "100" },
          "anchor": { "file": "com/acme/order/Order.java", "span": [9, 9] } }
      ],
      "operations": [
        { "id": "java:com.acme.order.adapter/LedgerAdapter.post(java.lang.Object)",
          "kind": "method", "name": "post", "signature": "post(java.lang.Object)",
          "anchor": { "file": "com/acme/order/adapter/LedgerAdapter.java", "span": [11, 14] },
          "loc": 4, "entryPoint": false,
          "annotations": [
            { "annotation": "java:java.lang/Override", "name": "Override", "module": "java.lang",
              "arguments": [],
              "anchor": { "file": "com/acme/order/adapter/LedgerAdapter.java", "span": [10, 10] } }
          ],
          "metrics": { "cyclomatic": 1, "sloc": 4 },
          "invocations": [
            { "to": "java:com.acme.order.adapter/AuditTrail",
              "targetType": "java:com.acme.order.adapter/AuditTrail", "targetTypeName": "AuditTrail",
              "external": true, "provenance": "declared",
              "anchor": { "file": "com/acme/order/adapter/LedgerAdapter.java", "span": [12, 12] } }
          ],
          "accesses": [
            { "to": "java:com.acme.order.adapter/LedgerAdapter.trail", "field": "trail",
              "ownerType": "java:com.acme.order.adapter/LedgerAdapter", "ownerTypeName": "LedgerAdapter",
              "isRead": true, "isWrite": false, "external": false, "provenance": "declared",
              "anchor": { "file": "com/acme/order/adapter/LedgerAdapter.java", "span": [12, 12] } }
          ],
          "throws": [] }
      ],
      "injectionPoints": [] }
  ],
  "diagnostics": { "types": 19, "operations": 58, "invocations": 48, "accesses": 33, "throwSites": 2 }
}

An annotation with a written argument, from the same run:

{ "annotation": "java:java.lang.annotation/Retention", "name": "Retention",
  "module": "java.lang.annotation",
  "arguments": [
    { "name": "value",
      "value": { "k": "enum", "type": "java:java.lang.annotation/RetentionPolicy", "name": "RUNTIME" } }
  ],
  "anchor": { "file": "com/acme/order/Audited.java", "span": [7, 7] } }

Deterministic: two runs over one model are byte-identical.

Last updated on