camaraproject / DeviceLocation

Repository to describe, develop, document and test the DeviceLocation API family
Apache License 2.0
21 stars 32 forks source link

[Geofencing]: Invalid `area` example for `POST /subscriptions` #164

Closed maxl2287 closed 6 months ago

maxl2287 commented 7 months ago

Problem description The area-object is currently empty ("area": {}) in the POST /subscriptions - request.

{
  "webhook": {
    "notificationUrl": "https://application-server.com",
    "notificationAuthToken": "c8974e592c2fa383d4a3960714"
  },
  "subscriptionDetail": {
    "device": {
      "phoneNumber": "123456789",
      "networkAccessIdentifier": "123456789@domain.com",
      "ipv4Address": {
        "publicAddress": "84.125.93.10",
        "publicPort": 59765
      },
      "ipv6Address": "2001:db8:85a3:8d3:1319:8a2e:370:7344"
    },
    "area": {},
    "type": "org.camaraproject.geofencing.v0.area-entered"
  },
  "subscriptionExpireTime": "2024-03-07T09:26:12.562Z"
}

Expected behavior The area - object should be filled with a valid example.

{
  "webhook": {
    "notificationUrl": "https://application-server.com",
    "notificationAuthToken": "c8974e592c2fa383d4a3960714"
  },
  "subscriptionDetail": {
    "device": {
      "phoneNumber": 4912345678912,
      "networkAccessIdentifier": "123456789@domain.com",
      "ipv4Address": {
        "publicAddress": "84.125.93.10",
        "publicPort": 59765
      },
      "ipv6Address": "2001:db8:85a3:8d3:1319:8a2e:370:7344"
    },
    "area": {
      "areaType": "CIRCLE",
      "center": {
        "latitude": 50.735851,
        "longitude": 7.10066
      },
      "radius": 2000
    },
    "type": "org.camaraproject.geofencing.v0.area-entered"
  },
  "subscriptionExpireTime": "2024-03-22T05:40:58.469Z"
}
jlurien commented 7 months ago

I think the problem is that there is no explicit example for the requestBody so the viewers (Redoc, SwaggerEditor) build one on their own and they are not capable of inferring the area model correctly. It is not properly an error in the spec, but adding an explicit example is a convenient improvement.