We are updating the SDK generation CLI command to make inputs for SDK and Portal generation CLI commands consistent. Now Portals and SDKs can be generated using the same input, simplifying CI/CD scripts.
What's Changed
- The
--specflag for theapimatic sdk generateCLI command has been renamed to--input. - Default input path changed from
./src/specto./. - The input path now points to the parent directory containing the
srcdirectory that contains all the configurations along with the API specification files. - Added optional
--api-versionflag to allow selecting the API version for multi-versioned builds.
The following example shows the directory structure required for --spec and --input flags.
- OLD: Spec Flag
- NEW: Input Flag
apimatic sdk generate --langauge=php --spec=./spec
spec
├─ APIMATIC-META.json # Defines customization for SDK generation
└─ openapi.json
apimatic sdk generate --langauge=php --input=./build
build
└─ src
├─ spec # Required; Contains all API definition files
| ├─ APIMATIC-META.json # Defines customization for SDK generation
| └─ openapi.json
├── APIMATIC-BUILD.json # Optional; Defines configurations for Portal generation
├── static # Optional; Contains all static files for the Portal
└── content # Optional; Contains custom documentation pages for the Portal
API Version Selection
When generating SDKs for multi-versioned builds, you can now specify which API version to use with the --api-version flag. If not provided, you will be prompted to select from all available versions.
Example:
apimatic sdk generate --language=csharp --input=./build --api-version=v2
This generates the SDK using the specification for v2. The specified version must exist within the versioned build.
Migration Guidance
If you are upgrading from a CLI version that only supports the --spec flag (for example, 1.1.0-beta.6) to a version that supports the newer --input flag:
- No change is required in CI workflows if you are not using the
--specflag. - Replace
--specwith--inputin scripts and CI workflows and point--inputto the project root (or other parent directory that containssrc).
Replace:
apimatic sdk generate --language=csharp --spec="/path/to/spec/dir"
With:
apimatic sdk generate --language=csharp --input="path/to/root/dir/of/src"