Swagger not validating

Hello, I am using the Genesys swagger.json to generate c# classes however the default tool for this (NSwag), generated invalid code often generating class with tail else statements that did not contain any code this code will cause the project to not builds correctly.

I can see this being an issue before in https://developer.genesys.cloud/forum/t/swagger-spec-does-not-validate/4920 and can see that at the time there was 4 errors. This has changed to 44 errors when using an online swagger validator https://validator.swagger.io/, which might be why Nswag is not generating valid code, the errors are listed below

  • "attribute paths.'/api/v2/users/{userId}/callforwarding'(get).responses.424.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/contacts/add'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/contacts/remove'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/contacts/update'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/notes/add'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/notes/remove'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/notes/update'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/organizations/add'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/organizations/remove'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/organizations/update'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/relationships/add'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/relationships/remove'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/bulk/relationships/update'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/{contactId}/notes/{noteId}'(put).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/{contactId}/notes'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/{contactId}'(put).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/{contactId}/identifiers'(patch).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/schemas/{schemaId}'(put).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/schemas/{schemaId}/versions/{versionId}'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/schemas/{schemaId}/versions'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/schemas'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts/schemas'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/contacts'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/merge/contacts'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/scan/contacts'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations/{externalOrganizationId}/notes/{noteId}'(put).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations/{externalOrganizationId}/notes'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations/{externalOrganizationId}'(put).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations/schemas/{schemaId}'(put).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations/schemas/{schemaId}/versions'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations/schemas'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations/schemas'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations/{externalOrganizationId}/trustor/{trustorId}'(put).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/organizations'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/scan/organizations'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/scan/notes'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/relationships/{relationshipId}'(put).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/relationships'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/externalcontacts/scan/relationships'(get).responses.422.description is missing",
  • "attribute paths.'/api/v2/knowledge/knowledgebases/{knowledgeBaseId}'(delete).responses.424.description is missing",
  • "attribute paths.'/api/v2/speechandtextanalytics/sentimentfeedback'(post).responses.422.description is missing",
  • "attribute paths.'/api/v2/users/{userId}/station/associatedstation/{stationId}'(put).responses.424.description is missing",
  • "attribute paths.'/api/v2/users/{userId}/station'(get).responses.424.description is missing",
  • "attribute paths.'/api/v2/voicemail/policy'(put).responses.424.description is missing"

Is Genesys' stance on this the same as it was in the mentioned forum where this is an issue that is labeled "Will not fix"

Kind regards

Hi Nexon, if you have a problem with swagger definitions, please open a case with care. Additionally, check out the .net sdk where we generate C# classes.

Also might be fair to ask why you're generating your own classes rather than just using the already extant .NET SDK? https://developer.genesys.cloud/devapps/sdk/dotnet

Reinventing the wheel is seldom productive.

The reason why I would like to use the swagger is that it should be platform agnostic and the dependences for building the API can be maintained by us if there are security issues by updating the dependences.

For example the .NET SDK provided relies on Newtonsoft.Json (11.0.2) and RestSharp (106.3.1) which both contain high level vulnerabilities listed on nuget which our security might not allow. Updating to the newer versions leads to a compile error as the newer version of RestSharp (107 and 108) had breaking changes, which is the reason why I assume the SDK is still using the older versions.

The other issue is that we are planning to run an application that relies on this SDK on aws lambda and from what I can tell the SDK generates errors when running on lambda. This is due to the fact the SDK tries to read a configuration file at "$HOME/.genesysclouddotnet/config" $HOME is not a environment variable in the lambda. looking at the github repo this means the SDK is trying to equivalent call the code below.

ConfigFilePath = Path.Combine(null, ".genesysclouddotnet", "config");
src\PureCloudPlatform.Client.V2\Client\Configuration.cs (line 90)

setting a path for Configuration.Default.ConfigFilePath still does not appear to work as it generates a call to the static constructor which will join the path on a null variable.

Ultimately I was hoping that the swagger could be used generated to the classes to access the REST endpoint without the issues highlighted above.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.