openactive / data-model-validator

The OpenActive data model validator library
MIT License
1 stars 1 forks source link

Validated for types in schema.org and extension contexts #248

Open nickevansuk opened 6 years ago

nickevansuk commented 6 years ago

Extension properties are not being validated for types (see "britishcycling:publicTransport" below).

{
  "@context": [
    "https://www.openactive.io/ns/oa.jsonld",
    "http://data.goskyride.com/opendata/britishcycling.jsonld"
  ],
  "type": "Event",
  "identifier": 90264,
  "url": "https://www.letsride.co.uk/rides/watford-ebury-and-aquadrome-8-miler-2",
  "activity": [
    {
      "id": "https://openactive.io/activity-list#2a41c553-84be-4970-b3d0-42f9ef6bd9a4",
      "prefLabel": "Road Cycling",
      "type": "Concept",
      "inScheme": "https://openactive.io/activity-list"
    }
  ],
  "startDate": "2017-01-02T10:00:00+00:00",
  "remainingAttendeeCapacity": 4,
  "beta:attendeeCount": 0,
  "beta:distance": { "type": "QuantitativeValue", "value": 8, "unitCode": "SMI" },
  "name": "Watford - Ebury and Aquadrome - 8 miler",
  "programme": {
    "type": "Brand",
    "identifier": "ride-social",
    "name": "HSBC UK Ride Social",
    "description": "Welcome to Britain’s biggest network of cyclists! Meet like-minded riders, create groups, and organise your own rides.",
    "url": "https://lr.staging.phoenixdigital.agencysocial",
    "logo": {
      "type": "ImageObject",
      "url": "https://lr-media.staging.phoenixdigital.agency/view/243b27bc8e1883b44a9afe108a77d45c/RideSocial_Keyline_sRGB.svg"
    }
  },
  "britishcycling:routePhotos": [
    {
      "type": "ImageObject",
      "url": "https://lr-media.staging.phoenixdigital.agency/image/9767d4cc89123074bcc9950c0885a399",
      "caption": ""
    }
  ],
  "level": [ "Steady" ],
  "location": {
    "type": "Place",
    "description": "Watford Cycle Hub,King George V playing fields, Watford, WD18 9QD",
    "address": {
      "type": "PostalAddress",
      "addressCountry": "GB",
      "addressLocality": "Watford",
      "addressRegion": "Hertfordshire",
      "postalCode": "WD18 9QD",
      "streetAddress": "Watford Cycle Hub, King George V playing fields,"
    },
    "geo": {
      "type": "GeoCoordinates",
      "latitude": 51.64229617,
      "longitude": -0.41898814
    },
    "amenityFeature": [
      {
        "name": "Changing Facilities",
        "type": "ChangingFacilities",
        "value": false
      },
      { "name": "Toilets", "type": "Toilets", "value": true },
      {
        "name": "Parking",
        "type": "Parking",
        "value": true,
        "description": "Start location."
      }
    ]
  },
  "duration": "PT2H0M0S",
  "beta:activityDuration": "PT1H15M0S",
  "endDate": "2017-01-02T12:00:00+00:00",
  "ageRange": { "type": "QuantifiedValue", "minValue": 5 },
  "description": "The Ebury Way follows the route of a disused railway track through trees, passing by gravel lakes, rivers and over the Grand Union Canal. At the centre of the Aquadrome are three lakes, formed by the extraction of gravel used in the construction of the original Wembley Stadium. This pleasant, flat, traffic free route allows you to fully appreciate your surroundings!",
  "beta:formattedDescription": "The Ebury Way follows the route of a disused railway track through trees, passing by gravel lakes, rivers and over the Grand Union Canal. At the centre of the Aquadrome are three lakes, formed by the extraction of gravel used in the construction of the original Wembley Stadium. This pleasant, flat, traffic free route allows you to fully appreciate your surroundings!",
  "offers": [
    {
      "type": "Offer",
      "url": "https://www.letsride.co.uk/rides/watford-ebury-and-aquadrome-8-miler-2/book",
      "price": 0
    }
  ],
  "isAccessibleForFree": true,
  "maximumAttendeeCapacity": 18,
  "britishcycling:stoppingPoints": "Refreshment stop 4.1 miles from the start.",
  "britishcycling:gpxFile": "https://lr-media.staging.phoenixdigital.agency/download/2d205aaf256ef9f45e92ecbd5bffae2a",
  "britishcycling:terrain": "Gravel Path",
  "britishcycling:topography": "Flat",
  "meetingPoint": "Watford Cycle Hub,, WD18 9QD",
  "britishcycling:publicTransport": "SHOULD BE AN ERROR",
  "britishcycling:publicTransportDetails": "Watford High Street approximately 0.7 miles away."
}
petewalker commented 5 years ago

This isn't a bug - this has never been in scope as far as I'm aware.

114 just asks that they're recognised, so there's no type-checking logic. The existing type-checking logic uses the data-models metadata, not the @context metadata - so, implementing the type checking would require additional work.

petewalker commented 5 years ago

@MelanieAbraham - can you let me know if this is in scope?

nickevansuk commented 5 years ago

@petewalker does the schema.org logic do type checking, or is that also just check for property existence?

Thinking the same issue exists for both, but also the same additional work would apply to fixing both?

petewalker commented 5 years ago

The behaviour is the same for anything outside of the OpenActive spec - i.e. anything not defined in data-models

nickevansuk commented 5 years ago

Ok updating this to a new feature and moving to bottom of backlog - would be really helpful, but not as high priority as most of the rest of this.