Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-72870

Generating source code from Confluence's Open API spec produces invalid source code

    XMLWordPrintable

Details

    Description

      Issue Summary

      Using Confluence's Open API (aka "swagger") spec to generate a client (e.g. in Java) as explained in the blog post Generating a Java REST Client for Confluence Cloud does not produce working code. There seem to be various errors and missing types in the spec.

      Note: there are a couple of bugs in swagger-codegen 3.0.27 that interact badly with Confluence. Using a newer version overcomes these errors.

      Steps to Reproduce

      1. Download a copy of Confluence open API spec:  https://developer.atlassian.com/cloud/confluence/swagger.v3.json
      2. Use a tool like swagger-codegen to generate the Java client (e.g. "swagger-codegen -i swagger.v3.json -l java -o .")

      Expected Results

      The generated code works 

      Actual Results

      The generated code doesn't work due to various errors and missing types in the spec including (but not limited to):

      • ContentBody is missing the type ContentBodyExpandable
      • Content is missing the type Map
      • ContentBody.getValue() is missing
      • GenericLinks type in the spec is missing all the fields (For example, the links for next when doing a paged query, etc)
        etc.

      There are also issues with `additionalProperties: true`, but these might be due to bugs in swagger-codegen: https://github.com/swagger-api/swagger-codegen/issues/5187

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

      Attachments

        Issue Links

          Activity

            People

              d5517f80e6e9 Tyler Brown
              bkelley@atlassian.com Ben Kelley
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: