When working with Workato API resources (recipes, connections, API endpoints, etc.), three files must stay in sync. Automated tests enforce these contracts — see internal/api/types_coverage_test.go and internal/sync/pull_test.go.
- Define the struct in
internal/api/types.gowithjsontags for all known response fields. - Register expected fields in
TestStructFieldCoverage(internal/api/types_coverage_test.go). - Register table columns in
TestStructFieldCoverage_TableColumns— list the fields that should appear inwk <resource> listtext output. - Wire up the table in
internal/commands/<resource>.go— theFormatListcall must include all registered table columns.
- Add the field to the struct in
internal/api/types.go. - Add the json tag name to
expectedFieldsinTestStructFieldCoverage. - If the field should appear in table output:
- Add it to
requiredTableFieldsinTestStructFieldCoverage_TableColumns. - Add the column to the
FormatListcall in the corresponding command file.
- Add it to
- Update any mock responses in the resource's
*_test.gofile to include the new field and assert it parses correctly.
When wk pull encounters a file type it doesn't recognize, it writes type: "unknown" to the .meta.json sidecar in .wk/, which breaks lint and type-aware features.
- Add the extension to
knownExtensionsinTestInferAssetType_KnownWorkatoExtensions(internal/sync/pull_test.go). - Add a matching case to
inferAssetType()ininternal/sync/pull.go.
go build ./...
go test ./internal/api/... ./internal/sync/... ./internal/commands/...If any of the coverage tests fail, the error message tells you exactly what to fix and where.