reverb / swagger-spec

This fork of the swagger-spec is intended for 2.0 planning
Other
19 stars 15 forks source link

xml attribute needed on schema #125

Closed fehguy closed 10 years ago

fehguy commented 10 years ago

Currently the xml decorations are allowed on a property but not the root model schema. This means you cannot override the name, namespace, prefix

webron commented 10 years ago

Doesn't https://github.com/reverb/swagger-spec/blob/master/schemas/v2.0/schema.json#L465 apply to the root model schema?

fehguy commented 10 years ago

no, I believe it just applies to properties. To apply to the root model, it needs to go around line 444 as well.

webron commented 10 years ago

Extending https://github.com/reverb/swagger-spec/blob/master/fixtures/v2.0/json/models/modelWithXmlAttributes.json - I think the following is valid based on the current schema and applies to the root:

{
  "description": "this model serves xml and json structures",
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64",
      "xml": {
        "attribute": true,
        "namespace": "ns1",
        "prefix": "urn1"
      }
    },
    "items": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "xml": {
        "wrapped": true
      }
    }
  },
  "xml": {
    "name": "Pet"
  }
}
fehguy commented 10 years ago

looks like it is supported.

webron commented 10 years ago

Wait, does this mean I was right?

fehguy commented 10 years ago

Yes Ron, you were/are right