ApiModelProperty annotation - "position" element not supported in 2.0 Schema?

813 views
Skip to first unread message

Chris Cosentino

unread,
Aug 11, 2017, 2:40:31 PM8/11/17
to Swagger

Hello!

We are using Swagger Annotations and for the APIModelProperty annotation (http://docs.swagger.io/swagger-core/current/apidocs/io/swagger/annotations/ApiModelProperty.html) we use the position element.

However, when trying to validate against the swagger 2.0 specification (https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v2.0/schema.json) it returns an error:

jsonschema.exceptions.ValidationError: u'position' does not match any of the regexes: u'^x-'

Is the annotation API incorrect in stating that it supports the position element, or is the swagger schema missing the position element?

I understand we can get around this by prefacing the name of the "position" property with "x-", but we were trying to follow the standards.

The reason we use the position property is to order the properties for any given API model manually for better readability.

Is this an omission in the 2.0 schema?

Thanks much,
Chris

Ron Ratovsky

unread,
Aug 11, 2017, 9:38:50 PM8/11/17
to swagger-sw...@googlegroups.com

Not sure why it’s not, but position should be deprecated from that annotation. It’s definitely not supported by the spec.

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

Chris Cosentino

unread,
Aug 14, 2017, 9:54:40 AM8/14/17
to swagger-sw...@googlegroups.com
Thanks Ron,

It looks like the following annotation elements for ApiModelProperty are also missing from the 2.0 spec:

access
allowableValues
dataType
hidden
notes


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/qqT0UWHXqO8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggersocket+unsub...@googlegroups.com.

Ron Ratovsky

unread,
Aug 14, 2017, 1:02:51 PM8/14/17
to swagger-sw...@googlegroups.com

They’re not missing from the spec, they either have a meaning outside the spec, translate to something in the spec, or should be deprecated.

 

access = allows you to filter out properties before making it into the API definition.

allowableValues = allows you to set the enum values if applicable.

dataType = `type`/`schema`

hidden = allows you to always hide the property from the API definition.

notes = I believe that should be deprecated

--

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

Chris Cosentino

unread,
Aug 14, 2017, 1:15:40 PM8/14/17
to swagger-sw...@googlegroups.com
Thanks for the clarification! I did not see a one-to-one mapping between those annotation element and a swagger spec property.

--

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/qqT0UWHXqO8/unsubscribe.

To unsubscribe from this group and all its topics, 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 the Google Groups "Swagger" group.

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/qqT0UWHXqO8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages