Skip to content

feat (fabric-x): Simplify the Fabric-X configuration schema - #874

Open
MaryamArif7 wants to merge 5 commits into
hyperledger-labs:mainfrom
MaryamArif7:feat_873
Open

MaryamArif7 wants to merge 5 commits into
hyperledger-labs:mainfrom
MaryamArif7:feat_873

Conversation

@MaryamArif7

@MaryamArif7 MaryamArif7 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

fixes #873
What changed

  • A Fabric-X config now needs only the provider, the orgs (name and domain), the channel name and the namespaces.
  • If a channel has no orgs, all orgs join it. Namespaces still default to all orgs on the channel.
  • The orderer is a single party by default. For four party BFT you only set fabricX.orderer.partyCount to 4. The old fabricX.orderer.parties list is removed.
  • Fablo builds the orderer party names itself, the same as before (Orderer for one party, OrdererOrg1 to OrdererOrg4 for four).
  • fablo init fabric-x writes the small config.
  • The schema no longer requires chaincodes, fabricVersion, tls, channel orgs and channel org peers. Fabric-X gets defaults for them.
  • validate still requires those fields for the fabric provider, so classic configs get a clear error if they are missing.
  • Sample, docs, e2e tests and the BFT test script use only the new format.

How the defaults work

A small function (applyFabricXDefaults) fills in the missing values for fabric-x right after the config is read. It is used by validate and by extendConfig. Because of this, the generators and templates did not need to change. The orderer templates still loop over the parties, but that list is now built from partyCount.

@mergify

mergify Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

@MaryamArif7
MaryamArif7 marked this pull request as draft November 18, 2026 19:13
@MaryamArif7

MaryamArif7 commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author
  • Compact config: orgs with only name and domain
  • Channel needs only a name
  • Channel orgs omitted: all top level orgs join the channel
  • Namespace orgs still default to all orgs on the channel
  • Default orderer stays single party
  • Four party BFT needs only fabricX.orderer.partyCount: 4
  • Old fabricX.orderer.parties format removed, no compatibility layer
  • Defaults for fabricVersion, tls, peerDevMode, mspName, ca, channel peers, chaincodes and hooks
  • fablo init fabric-x writes the compact config
  • Shared schema updated, no provider branching inside the schema
  • TypeScript types updated
  • Validation updated for partyCount and for orderer identity name clashes
  • Fabric provider still validated for the fields the schema no longer requires
  • Sample config updated
  • Docs updated (configuration, getting started, README)
  • E2E tests and BFT test script updated
  • Same generated output as before for the existing sample
  • Snapshots updated (run the update command)
  • Docker e2e tests run in CI

@MaryamArif7

Copy link
Copy Markdown
Contributor Author

1:./fablo.sh init fabric-x --set fabricX.orderer.partyCount=4
this generated config with four parties,if init is used without the flag,it creates the simple config

image
2.Tested all the commands ,up,down,reset.prune,start,namespace init ,namepsace init single namespace,namespace list,which are working

@MaryamArif7
MaryamArif7 marked this pull request as ready for review November 20, 2026 09:36
Comment thread docs/schema.json
"fabricVersion",
"tls"
],
"required": [],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsyk this makes these fields optional for classic Fabric too

I tested the schema after removing global.fabricVersion, global.tls, chaincodes and channels[0].orgs from a classic config, and it returned zero schema errors

The issue asks for provider-specific rules, so please keep the shared schema but use draft-07 if/then/else rules, compact requirements for provider: "fabric-x" and the existing requirements for classic Fabric.

cli only checks are not enough because editors and other tools consume schema.json directly


const configContent = fs.readFileSync(this.fabloConfigPath, "utf-8");
const networkConfig = parseFabloConfig(configContent);
const networkConfig = applyFabricXDefaults(parseFabloConfig(configContent));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please validate the config as written before applying defaults

Right now invalid values can be hidden by normalization, e.g "ca": null is replaced with the default ca and validation reports zero errors

removing orgs completely throws

TypeError: Cannot read properties of undefined (reading 'map')

before the schema can report the missing field, parse and validate the raw input first, stop semantic validation when its structure is invalid, and only then apply Fabric-X defaults

import defaults from "./defaults";


const applyFabricXDefaults = (json: FabloConfigJson | FabricXConfigJson): FabloConfigJson => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd appreciate some unit tests for this normalizer and the provider specific schema rules, cover ommitted fabric-x defaults, explicit values being preserved, malformed values rejected and classic config still requiring it's existing fields


let fabloConfigJson = flags.fabricX ? getDefaultFabricXConfig() : getDefaultFabloConfig();
// the compact Fabric-X config is completed with defaults when it is read, so it is kept as written
let fabloConfigJson = flags.fabricX ? (getDefaultFabricXConfig() as FabloConfigJson) : getDefaultFabloConfig();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cast defeats the new compact config type

please type this value and the helper functions as FabloConfigJson | FabricXConfigJson instead

FabricXConfigJson.global.provider should also be the required literal "fabric-x" so typescript can distinguish the two input formats

- `channels` does not hold exactly one channel
- `fabricX.orderer.partyCount` is not `1` or `4`

#### Compact Fabric-X config

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“Compact” only makes sense relative to the old unreleased format

Just update the documentation with the new schema instead of this new section, not sure why users need to understand the simplification history when fabric-x on fablo hasn't released yet

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat (fabric-x): Simplify the Fabric-X configuration schema

2 participants