RAML 1.0 types equivalent to JSON Schema `dependencies`


#1

For example, what would be the RAML 1.0 version of this JSON schema? Is this something RAML types can support?

{
  "type": "object",
  "required": [
    "id",
    "label"
  ],
  "additionalProperties": false
  "properties": {
    "id": {
      "type": "string"
    },
    "label": {
      "type": "string"
    },
    "latitude": {
      "type": "number",
      "minimum": -90,
      "maximum": 90
    },
    "longitude": {
      "type": "number",
      "minimum": -180,
      "maximum": 180
    }
  },
  "dependencies": {
    "latitude": [ "longitude" ],
    "longitude": [ "latitude" ]
  },
}

To be clear, the outcome of this schema is that it requires that if you provide one of latitude or longitude you also must provide the other.


#2

Hi matto1990,

first part of the specification

LabelWithLocation: properties: id: string label: string latitude: (common.dependFrom): longitude type: number minimum: -90 maximum: 90 longitude: (common.dependFrom): latitude type: number minimum: -180 maximum: 180

where dependencies will be represented from annotations imported from the library of commonly used annotations which we expect to have soon.

Regards,
Pavel


#3

Nice! I completely missed the annotation support, which is a very cool feature.

Looking forward to more tooling being available for the 1.0 spec as it looks vastly improved from 0.8 and from competitors like API Blueprints!


#4

We might just simply introduce some annotations in tooling like converting types to JSON and back. So in @petrochenko_pav example we would have dependFrom to map to that JSON construct. We might find more that are not available in type systems like JSON and XML. These are potential candidates for annotations.