Skip to content

JSON Schema referencing OpenAPI 3.0 Schema #261

@owena11

Description

@owena11

Sorry this is more a question than an issue! Please let me know if there is a better forum to ask this in, hopefully it's relevant to this repository

I'm looking to validate some WCMP2 Records agaisnt the schema using the jsonschema python library with some extensions to resolve $refs against a local schema registry, however I get schema validation errors for examples that validate fine against the bundled schema.

The issue seems be that the schema references some OGCapi schema that is following the OpenAPI 3.0 schema, particularly the geometry attribute references https://raw.githubusercontent.com/opengeospatial/ogcapi-records/master/core/openapi/schemas/recordGeoJSON.yaml#/properties/geometry:

  geometry:
    oneOf:
      - type: object
        nullable: true
      - $ref: 'https://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/schemas/geometryGeoJSON.yaml'

Where the nullable attribute is an openAPI extension to JSON Schema (And removed at OpenAPI 3.1 to aid compatibility).

It looks like the bundling process is aware of OpenAPI and modifes the schema, resulting a bundled schema of:

 "geometry": {
      "oneOf": [
        {
          "enum": [
            null
          ]
        },
        {
          "oneOf": [
                       ... list of geoJSON formats
           ]
         }
       ]

Does anyone else have any experience within this mismatch of schemas? Or is usage of the bundled schema expected?

Changing the WCMP2 schema implementation slightly would likely dodge this miss match by removing the nullable properties in the reference:

  geometry:
    oneOf:
      - type: "null"
      - $ref: 'https://schemas.opengis.net/ogcapi/features/part1/1.0/openapi/schemas/geometryGeoJSON.yaml'

Metadata

Metadata

Assignees

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