Synchronize Specification File Changes With Generated Source Code

You can use this command to bring new changes from the specification file to the current source files (model and controller). This command works with both TypeScript and Go projects.

Note:
  • Code sync is unidirectional - you can bring changes from your specification file into your chaincode project, but not the other way around. Changes made in your chaincode project remain as-is after the synching process.
  • This command only works if the chaincode project has been scaffolded using a specification file. Ensure you do not delete, rename or move the specification file if you plan to sync any changes from the specification file to the source code in future.
  • If you have used a single specification file to generate more than one chaincode project, you can only synchronize one project at a time using this command.

Usage:

sync [options] [...args]
my-mac:TsProject myname@ ochain sync -h 
Usage: sync [options] [...args]
Synchronize Changes from spec file to the required chaincode. 
Arguments:
    [...args] (optional) Sync Arguments.
Options :
    -h, --help              output command usage information
    -D, --debug             enable debug logging
    -p, --project <path>    (optional) Path to Chaincode project to sync. If not specified, it defaults to current directory
    -c, --confirm <bool>    (optional) Parameter to ensure if you have resolved all the conflicts, and commit changes
Examples :
$> ochain sync
without chaincode initial arguments
This command has two optional arguments:
  • -p / --project

    This option takes the chaincode project directory where the sync needs to be performed. If not specified, it defaults to the current directory.

  • -c / --confirm

    This option takes boolean (true/false) values. If there are any conflicts during the merging process, you must resolve those conflicts manually and set this option to true in the next sync cycle. Don't use this option if you're not sure that the conflicts have been merged.