Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

APIs

Definitions with multiple data types in Open Api 3

I'm working on building documentation for an API I recently built but I've run into some trouble with using the Swagger Editor.

I have a parameter that accepts multiple types but I can't seem to find a good way to reflect that in the documentation. Example of what I want:

Request:
    type: "object"
    properties:
      query:
        type: "string"
      sourceService:
        type: "string"
        type: "string[]"
      imageType:
        type: "string"
        type: "string[]"

I've tried using oneOf and additionalProperies but I keep getting errors of 'duplicated map key' or my properties will start to disappear from the preview pane - indicating my code is problematic.

Does anyone have any ideas? I've searched forums & stack overflow but can't seem to find a solution that actually works for me.