Legacy Dev Forum Posts

 View Only

Sign Up

Swagger spec does not validate

  • 1.  Swagger spec does not validate

    Posted 06-05-2025 18:14

    slawo | 2019-04-04 14:12:40 UTC | #1

    Hello, I have an issue, I was looking for the swagger specs and found this: https://api.mypurecloud.com/api/v2/docs/swagger and https://s3.dualstack.us-east-1.amazonaws.com/inin-prod-api/us-east-1/public-api-v2/swagger-schema/publicapi-v2-latest.json

    unfortunately this does not validate when using go-swagger:

    The swagger spec at "https://s3.dualstack.us-east-1.amazonaws.com/inin-prod-api/us-east-1/public-api-v2/swagger-schema/publicapi-v2-latest.json" is invalid against swagger specification 2.0. see errors :

    • "paths./api/v2/users/{userId}/station/associatedstation/{stationId}.put.responses.424" must validate one and only one schema (oneOf). Found none valid
    • paths./api/v2/users/{userId}/station/associatedstation/{stationId}.put.responses.424.description in body is required
    • "paths./api/v2/voicemail/policy.put.responses.424" must validate one and only one schema (oneOf). Found none valid
    • paths./api/v2/voicemail/policy.put.responses.424.description in body is required
    • tags.externalDocs.url in body must be of type uri: ""

    Is this an issue on my end only or is there another place with stable specs?

    Kind regards


    tim.smith | 2019-04-04 14:43:51 UTC | #2

    Yes, that is the official swagger definition we use to generate all of the API docs and SDKs. It might be worth looking into a project that's more tolerant of pedantic errors. We use a forked version of the swagger-codegen project to generate the official SDKs. The main project has support for Go.


    slawo | 2019-04-11 17:23:43 UTC | #3

    The issue I currently have is that there is no clear path forward to use the PureCloud modified swagger file.

    I'm looking at a way to generate the api from scratch for go but neither platform-client-sdk-common nor purecloudapisdk_common have a clear documentation as to how to get the code gen to work for a different language.

    Where can I start?


    tim.smith | 2019-04-11 17:40:21 UTC | #4

    platform-client-sdk-common is a full-service automation project for building and publishing the official SDKs and their documentation. Swagger-codegen is just one tool used by that project. For your own SDK, you'll probably want to use the swagger-codegen project I linked above directly.

    If our automation project provides value for you, check out the Building Locally guide in the repo's wiki. That will get you set up to build the existing SDKs locally. To make a new SDK, take a look at the files and config for purecloudjava and create something similar for golang. You may need to modify swagger-codegen's language files to get the module to generate/compile correctly. Nearly all of the edits we've made in our fork have been to fix issues in the generator itself or with how it provides the data to the templates.

    I suggested using the main swagger-codegen repo because that's probably the easiest path to generating a SDK; the process I've outlined here would probably take around a week's worth of effort to create a validate a new automated SDK build if you already more or less know what you're doing. I don't mean to scare you off from using it, but for your use case, the swagger-codegen project should be largely plug-n-play and will probably be less effort and overhead.


    system | 2019-05-12 17:40:26 UTC | #5

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


    This post was migrated from the old Developer Forum.

    ref: 4920