Forum Discussion

jsmith141's avatar
jsmith141
New Contributor III
4 years ago

Invalid Swagger Spec Message When Publishing API Version

Good Morning,

I am attempting to to publish a simple test API that is built from a triggered task. When I go to publish version 1.0 in API Manager I get the following message, “Invalid Content. Upload a valid Swagger specification.”. There is a built-in specification editor that I am using just to the left of the “Choose File” button in the Publish Version pop up window and it does not show any errors in the swagger specification I am uploading.

At this point, I am at a loss as to what might be wrong/missing in the specification file to generate that message. Any guidance on this issue would be greatly appreciated.

Thanks,
James

7 Replies

  • Is it a valid Swagger 2.0 Specification? Currently, we support 2.0 specifications to be published and not 3.0. However, the editor will parse a swagger 3.0 with no errors.

    If that doesn’t fix the issue, can you share your swagger specification here?

      • cjhoward18's avatar
        cjhoward18
        Employee

        Okay, I have identified the issue with the specification provided.

        Let me explain in a few steps:

        one the validate call to validate your specification shows the error:

        From there you can see the type of your parameter putId is a string however it has a items field describing it as an array, and the default is not a string. So, this is mixing the type of a string with the definition of an array type.

        I modified your specification only to change the type of the mentioned parameter to an array instead of a string.

        If you would like it to be a string then the definition should not include the items description.

        here is the modified spec that is now validating successfully for me after changing the type:

        paramsTypeToArray.txt (3.5 KB)

  • Hi @jsmith141 ,

    Do you have, by any chance, in the schemes an empty array element ?

    If so, edit your file in the editor provided by SL and remove that line under schemes. For some reason, this happens when you generate a .yaml file for the project that you are creating the API and that exact error is triggered when trying to publish the API.

    • jsmith141's avatar
      jsmith141
      New Contributor III

      Hi @j.angelevski,

      I do not have any empty array elements in the schemes. In this case, I actually manually modified the demo specification file that SnapLogic provides. Thanks for pointing that out though. Could that be the issue? I need to auto generate the specification file from the project?

      • cjhoward18's avatar
        cjhoward18
        Employee

        FYI this is a string with default defined correctly that is working for me if that String is the true desired type:

          parameters:
          - description: Person ID to get. returns all if null
            default:
            - "empty"
            required: False
            name: putId
            in: query
            type: string
            collectionFormat: multi