Forum Discussion

xsited's avatar
xsited
New Contributor
8 years ago
Solved

Assistance Request with Java Codegen

 

I have had success with codegen for languages like python, ruby, and go for example, but for some reason java does not like something about my spec file. I have read about some of the other resent issues, but I am not sure if it is applicable.  I was wondering if I can get some assistance with this spec file.

 

https://swaggerhub.com/api/TemperedNet/SimpleConnect-API/1.1

 

Thanks for this great product.

 

-t

  • Howdy!  Sorry you're having hassles.  The error message that you're getting isn't super helpful, something that will be addressed in the next version.

     

    It looks like you have arrays with unspecified types.  For example, device_ids, device_groups:

     

      device_group:
        title: device_group
        type: object
        properties:
          name: {}
          description: {}
          device_ids:
            description: An Array of UUID strings
            type: array
            items: {}

    The "items" should have a type associated with it.  In addition, the "name" and "description" should be "string" values, not objects. So in general, if you switch to this:

     

      device_group:
        title: device_group
        type: object
        properties:
          name: "the name"
          description: "the description"
          device_ids:
            description: An Array of UUID strings
            type: array
            items:
              type: string
              format: uuid
        required:
          - name
          - device_ids

    You should be golden.  Note there are several instances of this in your file.

2 Replies

  • Howdy!  Sorry you're having hassles.  The error message that you're getting isn't super helpful, something that will be addressed in the next version.

     

    It looks like you have arrays with unspecified types.  For example, device_ids, device_groups:

     

      device_group:
        title: device_group
        type: object
        properties:
          name: {}
          description: {}
          device_ids:
            description: An Array of UUID strings
            type: array
            items: {}

    The "items" should have a type associated with it.  In addition, the "name" and "description" should be "string" values, not objects. So in general, if you switch to this:

     

      device_group:
        title: device_group
        type: object
        properties:
          name: "the name"
          description: "the description"
          device_ids:
            description: An Array of UUID strings
            type: array
            items:
              type: string
              format: uuid
        required:
          - name
          - device_ids

    You should be golden.  Note there are several instances of this in your file.