Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.