Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger-PHP isn't outputting "xml" when specified as child of "items" #279

Closed
xiehan opened this issue Jan 26, 2016 · 0 comments
Closed

Comments

@xiehan
Copy link
Contributor

xiehan commented Jan 26, 2016

The 2.0 spec makes it pretty clear that you should be able to specify xml as a child property of items in a definition, e.g.:

animals:
  type: array
  items:
    type: string
    xml:
      name: animal
  xml:
    wrapped: true

However, I have a definition (some other unnecessary properties truncated) coded in Swagger-PHP as follows:

/**
 * @SWG\Definition(definition="InLineXml",
 *   type="object",
 *   @SWG\Property(property="Extensions",
 *     type="array",
 *     @SWG\Items(type="string",
 *       @SWG\Xml(name="Extension")
 *     ),
 *     @SWG\Xml(wrapped=true)
 *   )
 * )
 */

which outputs:

        "InLineXml": {
            "properties": {
                "Extensions": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "xml": {
                        "wrapped": true
                    }
                }
            },
            "type": "object"
        }

And another definition:

/**
 * @SWG\Definition(definition="ErrorXmlDocument",
 *   type="object",
 *   @SWG\Xml(name="DAAST"),
 *   @SWG\Property(property="error",
 *     type="array",
 *     @SWG\Items(type="string",
 *       @SWG\Xml(name="error")
 *     ),
 *     @SWG\Xml(wrapped=false)
 *   )
 * )
 */

which outputs:

        "ErrorXmlDocument": {
            "properties": {
                "error": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    },
                    "xml": {
                        "wrapped": false
                    }
                }
            },
            "type": "object",
            "xml": {
                "name": "DAAST"
            }
        }

In neither case, the xml property of the items definition is present. However, I don't get any compiler errors.

@bfanger bfanger closed this as completed Apr 8, 2016
bfanger added a commit that referenced this issue May 27, 2016
 - Beter validation of type="file" #305
 - Augment Operations summary and description based on the comment. #293
 - Bugfixes #300
 - Add support for xml (and externalDocs and properties) inside a @swg\Items. #279
 - Nested properties are no longer injected into the Definition #297
 - Fixed nesting issue with verbose property notation #297
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants