That error appears when the external service generator (Swagger / OpenAPI import) tries to create business objects for the operations and one of them clashes with an existing object - here NameValuePair, which already exists in the System Data toolkit and cannot be overwritten by a generated type of the same name.
Fixes, in order of effort:
- Rename the schema in the Swagger file before the import: search for "NameValuePair" in definitions (Swagger 2) / components.schemas (OpenAPI 3) and every $ref that points to it, rename to SvcNameValuePair. Same for any other name that exists in your app or toolkits (Record, Map, Document, Error...).
- Generate into a dedicated toolkit that has no dependency on the toolkit holding the clashing object - the generator only checks the current project and its dependencies.
- Use the existing type: if the schema really is a name/value pair, delete the definition from the Swagger file and map the response to the System Data NameValuePair manually in the service flow (the generator leaves unmapped parts as ANY).
// Swagger 2 snippet after the rename
"definitions": {
"SvcNameValuePair": { "type": "object", "properties": { "name": {"type": "string"}, "value": {"type": "string"} } },
"Item": { "type": "object", "properties": { "attributes": { "type": "array", "items": { "$ref": "#/definitions/SvcNameValuePair" } } } }
}Other generator rules worth knowing: property names must be valid JavaScript identifiers (no dashes - use x-ibm-name or rename), anonymous inline objects get generated names like Operation_200_response, and only application/json bodies are mapped.
References