Swagger has anything like union types?

17 views
Skip to first unread message

Diego Bernardes

unread,
Jul 21, 2017, 11:32:58 AM7/21/17
to Swagger
Does Swagger has anything like union types? I want to declare a definition of object to use on my endpoints. But a given field on a object can have multiple definitions. Like this:

Subscription:
  type: object
  properties:
    notification:
      type: ?
    notificationType:
      type: string
      enum: [endpoint, webservice]

NotificationEndpoint:
  type: object
  properties:
    ...

NotificationWebsocket:
  type: object
  properties:
    ...

tony tam

unread,
Jul 21, 2017, 12:51:33 PM7/21/17
to swagger-sw...@googlegroups.com
Yes, there is the “allOf” construct

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages