camaraproject / DeviceLocation

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

Cyclic reference in location-verification #179

Closed RobertoSngular closed 2 months ago

RobertoSngular commented 3 months ago

The schema Area refence Circle and Circle reference Area properties

Circle probably doenst need Area properties

I fixed it like this:

Area:
  type: object
  properties:
     areaType:
       $ref: "#/components/schemas/AreaType"
   required:
     - areaType
   discriminator:
     propertyName: areaType
     mapping:
       CIRCLE: "#/components/schemas/Circle"

AreaType:
  type: string
  description: Type of this area. CIRCLE - The area is defined as a circle.
  enum:
    - CIRCLE

Circle:
  description: Circular area
  type: object
  properties:
    center:
      $ref: "#/components/schemas/Point"
    radius:
      type: integer
      description: Expected accuracy for the verification in meters, from location (radius)
      minimum: 2000
      maximum: 200000
  required:
    - center
    - radius
jlurien commented 3 months ago

Hi,

This way you are removing the areaType from Circle, which is inherited from Area. The API input is an Area, not a Circle. Even if currently can only be a Circle, there may be other areaType values in the future. The reference to Circle in Area as part of the mapping in the discriminator allows to use a value for the property (CIRCLE) different from the schema name.

bigludo7 commented 2 months ago

Agree with @jlurien and you can check other API like RegionUserCount to see other area.

jlurien commented 2 months ago

Nothing needed to be changed