Skip to content

Inheritance is not considered correctly in all scenarios #423

@nickevansuk

Description

@nickevansuk

The error for the below JSON in a Orders feed is:

Required property provider is missing from IndividualFacilityUse.

This error would lead a developer to add the provider property to IndividualFacilityUse, which is also invalid, as the property should be added to the FacilityUse.

The error should instead respect the inheritance hierarchy and the error message should prefer the property to be added to the parent rather than the child in order to fulfil the requirements of the rule.

{
  "@type": "Order",
  "@context": [
    "https://openactive.io/",
    "https://openactive.io/ns-beta"
  ],
  "@id": "http://localhost:8080/openactive/booking/orders/21085685-8ad7-49be-a8d1-569cf4d5fc2d",
  "identifier": "21085685-8ad7-49be-a8d1-569cf4d5fc2d",
  "orderedItem": [
    {
      "@type": "OrderItem",
      "@id": "http://localhost:8080/openactive/booking/orders/21085685-8ad7-49be-a8d1-569cf4d5fc2d/individual-facility-use-slots/22201",
      "orderItemStatus": "https://openactive.io/SellerCancelled",
      "orderedItem": {
        "@type": "Slot",
        "@id": "http://localhost:8080/openactive/feed/facility-uses/23/individual-facility-uses/9/slots/14949",
        "startDate": "2023-07-05T11:00:00+01:00",
        "endDate": "2023-07-05T12:00:00+01:00",
        "duration": "PT1H",
        "facilityUse": {
          "@type": "IndividualFacilityUse",
          "@id": "http://localhost:8080/openactive/feed/facility-uses/23/individual-facility-uses/9",
          "name": "Court 1",
          "aggregateFacilityUse": {
            "@type": "FacilityUse",
            "@id": "http://localhost:8080/openactive/feed/facility-uses/23",
            "identifier": "23",
            "name": "Tennis courts at Botley Park",
            "url": "http://localhost:8080/openactive/locations/23",
            "facilityType": [
              {
                "@type": "Concept",
                "@id": "https://openactive.io/facility-types#becfafc0-c63f-444c-aed5-a3665f2d172d",
                "inScheme": "https://openactive.io/facility-types",
                "prefLabel": "Tennis Court"
              }
            ],
            "hoursAvailable": [
              {
                "@type": "OpeningHoursSpecification",
                "closes": "21:00:00",
                "dayOfWeek": [
                  "https://schema.org/Monday"
                ],
                "opens": "07:00:00"
              },
              {
                "@type": "OpeningHoursSpecification",
                "closes": "21:00:00",
                "dayOfWeek": [
                  "https://schema.org/Tuesday"
                ],
                "opens": "07:00:00"
              },
              {
                "@type": "OpeningHoursSpecification",
                "closes": "21:00:00",
                "dayOfWeek": [
                  "https://schema.org/Wednesday"
                ],
                "opens": "07:00:00"
              },
              {
                "@type": "OpeningHoursSpecification",
                "closes": "21:00:00",
                "dayOfWeek": [
                  "https://schema.org/Thursday"
                ],
                "opens": "07:00:00"
              },
              {
                "@type": "OpeningHoursSpecification",
                "closes": "21:00:00",
                "dayOfWeek": [
                  "https://schema.org/Friday"
                ],
                "opens": "07:00:00"
              },
              {
                "@type": "OpeningHoursSpecification",
                "closes": "21:00:00",
                "dayOfWeek": [
                  "https://schema.org/Saturday"
                ],
                "opens": "07:00:00"
              },
              {
                "@type": "OpeningHoursSpecification",
                "closes": "21:00:00",
                "dayOfWeek": [
                  "https://schema.org/Sunday"
                ],
                "opens": "07:00:00"
              }
            ],
            "location": {
              "@type": "Place",
              "@id": "http://localhost:8080/openactive/locations/23",
              "name": "Botley Park",
              "address": {
                "@type": "PostalAddress",
                "addressCountry": "GB",
                "addressRegion": "Oxfordshire",
                "addressLocality": "Oxford",
                "postalCode": "OX2 0BT",
                "streetAddress": "Botley Road"
              },
              "geo": {
                "@type": "GeoCoordinates",
                "latitude": 51.7520967,
                "longitude": -1.2782961
              }
            }
          }
        },
        "maximumUses": 1,
        "remainingUses": 1
      },
      "acceptedOffer": {
        "@type": "Offer",
        "@id": "http://localhost:8080/openactive/feed/facility-uses/23/individual-facility-uses/9/slots/14949/offers/base",
        "identifier": "base",
        "name": "1h tennis",
        "priceCurrency": "GBP",
        "price": 0
      },
      "accessCode": [
        {
          "@type": "PropertyValue",
          "name": "Access code",
          "description": "1234",
          "value": "defaultValue"
        }
      ]
    }
  ],
  "totalPaymentDue": {
    "@type": "PriceSpecification",
    "priceCurrency": "GBP",
    "price": 0
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions