examples property for parameters object not documented?

23 views
Skip to first unread message

Tom Johnson

unread,
Jun 16, 2017, 4:50:02 PM6/16/17
to Swagger
Does the parameters object allow an example property, like this?

      parameters:
        - name: lat
          in: query
          description: latitude
          type: string
          required: true
          example: 1.2.3
        - name: lng
          in: query
          description: longitude
          type: string
          required: true
          example: 4.5.6


I didn't see this listed in the parameters object documentation. However, when I add it, this populates the query parameter field in Swagger UI with the example value, which is what I want it to do. 

Did I just not see this parameter listed in the docs? Or is it a new feature not yet added to the docs?

Thanks,

Tom

Ron Ratovsky

unread,
Jun 17, 2017, 12:50:15 PM6/17/17
to swagger-sw...@googlegroups.com

It’s a bug :-/ There are no examples in non-body parameters in OpenAPI/Swagger 2.0. This is changing in the next version of the spec.

 

In swagger-ui 2.1.x we had support for a vendor extension called ‘e-example’ to add such examples to the UI, but it’s not yet supported in the 3.X version.

--
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.

Tom Johnson

unread,
Jun 18, 2017, 10:16:37 AM6/18/17
to swagger-sw...@googlegroups.com
Thanks Ron. Am I understanding you correctly to think the examples property will be added to the 3.0 version of the spec but it's not there now? The only reason examples works in 2.0 with the Swagger UI 3.0 is due to a coincidental vendor extension? 

I'm trying to decide whether to leave my examples in there or not. At one point I was getting an error in the Swagger Editor based on these properties (something like, "One is not an instance of ...) but then the errors went away.

Tom

---------------------
email: t...@idratherbewriting.com
phone: 408-540-8562
blog: idratherbewriting.com
twitter: @tomjohnson


To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/7EkCFVPdXoM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ron Ratovsky

unread,
Jun 19, 2017, 3:35:18 PM6/19/17
to swagger-sw...@googlegroups.com

Yeah, they’re already in 3.0 of the spec, but it’ll take about a month for it to be officially released, and you can imagine tooling will take time to catch up too (even though we’re working on it).

--

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.

--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/7EkCFVPdXoM/unsubscribe.

To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.

 

--

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.

Reply all
Reply to author
Forward
0 new messages