Skip to main content

Subcomponents Reference

Catalog Representation​

Subcomponents are defined in the parent component's catalog-info.yaml as an object array at spec.components[]. Each entry contains the metadata defining the subcomponent, and in the Builder it is treated as part of the parent component entity defintion, not as a separate catalog entity.

For lifecycle context, see Subcomponents. Marketplace and access attributes are described in Shoppable and Consumable attributes.

Fields​

The minimum set of fields needed for each subcomponent are as follows:

FieldTypeAuthor inputDescriptor behavior
namestringRequiredSubcomponent name, unique within the parent component; appended to the parent component URN to generate the subcomponent id.
kindstringRequiredSubcomponent resource type identifier used in the descriptor.
infrastructureTemplateIdstringRequiredIdentifies the Tech Adapter for the subcomponent.
consumablebooleanRequiredConsumable attribute of the subcomponent.
shoppablebooleanOptionalShoppable attribute, when supplied.

The id of each component is automatically generated by Witboost as <parent component id>:<subcomponent name>, overwriting any supplied value.

Parent Catalog Example​

The following is example of a complete component catalog-info.

apiVersion: witboost.com/v1
kind: Component
metadata:
name: finance:invoice:0:invoice-storage
description: Storage for invoice data
spec:
type: storage
lifecycle: experimental
owner: group:default/finance
system: system:default/finance:invoice:0
mesh:
name: Invoice storage
version: "0.0.0"
useCaseTemplateId: urn:dmb:utm:invoice-storage-template:0.0.0
infrastructureTemplateId: urn:dmb:itm:storage-adapter:1
consumable: false
shoppable: true
technology: object-storage
region: eu-west-1
components:
- name: invoices
kind: outputport
infrastructureTemplateId: urn:dmb:itm:invoice-table-adapter:1
consumable: true
shoppable: true
region: eu-central-1
tableName: invoices

Another example of using subcomponents to define a complex component like a data contract can be seen here.

Descriptor Mapping​

The parent catalog entity's spec.components[] becomes components[] at the root of its component descriptor. This is distinct from the project descriptor's list of top-level component descriptors; see Descriptors.

With inheritance enabled, the example above produces the following subcomponent entry in the parent component descriptor's components field:

components:
- id: urn:dmb:cmp:finance:invoice:0:invoice-storage:invoices
name: invoices
kind: outputport
infrastructureTemplateId: urn:dmb:itm:invoice-table-adapter:1
consumable: true
shoppable: true
version: "0.0.0"
useCaseTemplateId: urn:dmb:utm:invoice-storage-template:0.0.0
technology: object-storage
region: eu-central-1
tableName: invoices

The child region overrides the parent's value. The version, useCaseTemplateId, and technology fields come from the parent's spec.mesh. The generated ID uses the parent component URN urn:dmb:cmp:finance:invoice:0:invoice-storage and the child name invoices.

Inheritance Configuration​

Field inheritance is configured via ui.appConfig.mesh.builder.editAndTest.subcomponents.inheritFromParent, to inherit the parent spec.mesh properties into each subcomponent descriptor.

ui:
appConfig:
mesh:
builder:
editAndTest:
subcomponents:
inheritFromParent: true

When true, eligible properties from the parent's spec.mesh are copied first, then the subcomponent's direct fields override matching properties. The generated id is applied last regardless of this setting. When false, no parent properties are inherited; the subcomponent's direct fields and generated id still populate its descriptor.

The following parent properties are excluded from inheritance:

  • id
  • components
  • consumable
  • shoppable
  • name
  • infrastructureTemplateId
  • kind
  • dependsOn
  • __dataContractEnabled
  • __dataContractGuardianSpec
  • readsFrom

These exclusions affect only inheritance from the parent. They do not remove fields explicitly supplied on a subcomponent.