swagger, change x-examples field to example field in schema definition

Bug #1535122 reported by Karen Bradshaw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstackdocstheme
Fix Released
High
Karen Bradshaw

Bug Description

Currently, if an operation has a request example, the example is included in the generated swagger files under the extension field, x-examples.
It may be more appropriate to include the request example under the 'example' field in the schema definition for this
request (body parameter).

For instance in an operation definition,

"parameters": [
{
  "name": "user",
  "in": "body",
  "description": "user to add to the system",
  "required": true,
  "schema": {
    "$ref": "#/definitions/SomeRequestSchema",
  }
}
]

"definition": {
  "SomeRequestSchema": {
  "properties": {},
  "example": {},
  "type": "object"
  }
}

The definition of 'SomeRequestSchema' would include an example field with the request example.

Revision history for this message
Anne Gentle (annegentle) wrote :

Agreed, marking High as I think this change would make easier to understand the Swagger content.

Changed in openstack-doc-tools:
status: New → Confirmed
importance: Undecided → High
Changed in openstack-doc-tools:
assignee: nobody → Karen Bradshaw (kbhawkey)
Revision history for this message
Karen Bradshaw (kbhawkey) wrote :

I will investigate whether the current 'body' parameter's schema object matches the
generated request examples and if the generated json validates.

Changed in openstack-doc-tools:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to fairy-slipper (master)

Reviewed: https://review.openstack.org/273718
Committed: https://git.openstack.org/cgit/openstack/fairy-slipper/commit/?id=d57fa5841d283825aff50d8555aab1bd5ddd06d3
Submitter: Jenkins
Branch: master

commit d57fa5841d283825aff50d8555aab1bd5ddd06d3
Author: Karen Bradshaw <email address hidden>
Date: Thu Jan 28 14:13:07 2016 -0500

    Fix request example field

    -Updated swagger_to_rst to read request example field.
    -Updated wadl_to_swagger_valid to generate request example
     in schema property field. Removed instances of
     x-examples field.

    Closes-Bug: #1535122

    Change-Id: I5aa2a5d6eac67dcf20a54922555ed7d9325cfcb3

Changed in openstack-doc-tools:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/fairy-slipper 0.2.0

This issue was fixed in the openstack/fairy-slipper 0.2.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.