Open-EO / openeo-backend-validator

Service to validate back-end compliance with the API specification.
Apache License 2.0
1 stars 3 forks source link

Validation fails for some instrument fields in /collections #51

Closed sophieherrmann closed 3 years ago

sophieherrmann commented 3 years ago

Dear Devs!

I added the instrument fields platform and constellation to the summaries section in the /collections and /collections/{collection_id} endpoint. (see /collections/s2b_prd_msil1c response at the bottom) Now when running the validation I get the following error msg:

"collection": {
    "message": "Input: ; Error: Response of the back end not valid; Details: response body doesn't match the schema: Error at '/summaries/constellation':Doesn't match schema 'oneOf'Schema: { 'oneOf': [ { 'items': { 'description': 'A value of any type.' }, 'title': 'Set of values', 'type': 'array' }, { '$ref': '#/components/schemas/collection_summary_stats' } ] }Value: 'sentinel-2'",
    "state": "Invalid",
    "type": "GET",
    "url": "/collections/s2b_prd_msil1c"
},
"collections": {
    "message": "Input: ; Error: Response of the back end not valid; Details: response body doesn't match the schema: Error at '/collections/0/summaries/constellation':Doesn't match schema 'oneOf'Schema: { 'oneOf': [ { 'items': { 'description': 'A value of any type.' }, 'title': 'Set of values', 'type': 'array' }, { '$ref': '#/components/schemas/collection_summary_stats' } ] }Value: 'sentinel-2'",
    "state": "Invalid",
    "type": "GET",
    "url": "/collections"
}

This indicates that the constellation field should be an array but according to the STAC Common Metadata instrument documentation it should be a string - as it is in my case.

Am I missing something or is this a bug in the code?

{
  "collections": [
    {
      "cube:dimensions": {
        "bands": {
          "type": "bands" ,
          "values": [
            "B01" ,
            "B02" ,
            "B03" ,
            "B04" ,
            "B05" ,
            "B06" ,
            "B07" ,
            "B08" ,
            "B8A" ,
            "B09" ,
            "B10" ,
            "B11" ,
            "B12"
          ]
        } ,
        "t": {
          "extent": [
            "2017-04-24T00:00:00Z" ,
            null
          ] ,
          "type": "temporal"
        } ,
        "x": {
          "axis": "x" ,
          "extent": [
            -180 ,
            180
          ] ,
          "type": "spatial"
        } ,
        "y": {
          "axis": "y" ,
          "extent": [
            -90 ,
            90
          ] ,
          "type": "spatial"
        }
      } ,
      "deprecated": false ,
      "description": "Sentinel-2 is a multispectral, high-resolution, optical imaging mission, developed by the European Space Agency (ESA) in the frame of the Copernicus program of the European Commission." ,
      "extent": {
        "spatial": {
          "bbox": [
            [
              -180.0 ,
              -90.0 ,
              180.0 ,
              90.0
            ]
          ]
        } ,
        "temporal": {
          "interval": [
            [
              null ,
              null
            ]
          ]
        }
      } ,
      "id": "s2b_prd_msil1c" ,
      "license": "no conditions apply" ,
      "links": [
        {
          "href": "collections/s2b_prd_msil1c" ,
          "rel": "self"
        } ,
        {
          "href": "collections" ,
          "rel": "parent"
        } ,
        {
          "href": "collections" ,
          "rel": "root"
        }
      ] ,
      "stac_version": "0.9.0" ,
      "summaries": {
        "constellation": "sentinel-2" ,
        "eo:bands": [
          {
            "center_wavelength": 0.4427 ,
            "common_name": "coastal" ,
            "full_width_half_max": 0.021 ,
            "gsd": 60 ,
            "name": "B01"
          } ,
          {
            "center_wavelength": 0.4924 ,
            "common_name": "blue" ,
            "full_width_half_max": 0.066 ,
            "gsd": 10 ,
            "name": "B02"
          } ,
          {
            "center_wavelength": 0.5598 ,
            "common_name": "green" ,
            "full_width_half_max": 0.036 ,
            "gsd": 10 ,
            "name": "B03"
          } ,
          {
            "center_wavelength": 0.6646 ,
            "common_name": "red" ,
            "full_width_half_max": 0.031 ,
            "gsd": 10 ,
            "name": "B04"
          } ,
          {
            "center_wavelength": 0.7041 ,
            "common_name": "rededge" ,
            "full_width_half_max": 0.015 ,
            "gsd": 20 ,
            "name": "B05"
          } ,
          {
            "center_wavelength": 0.7405 ,
            "common_name": "rededge" ,
            "full_width_half_max": 0.015 ,
            "gsd": 20 ,
            "name": "B06"
          } ,
          {
            "center_wavelength": 0.7828 ,
            "common_name": "rededge" ,
            "full_width_half_max": 0.02 ,
            "gsd": 20 ,
            "name": "B07"
          } ,
          {
            "center_wavelength": 0.8328 ,
            "common_name": "nir" ,
            "full_width_half_max": 0.106 ,
            "gsd": 10 ,
            "name": "B08"
          } ,
          {
            "center_wavelength": 0.8647 ,
            "common_name": "nir08" ,
            "full_width_half_max": 0.021 ,
            "gsd": 20 ,
            "name": "B8A"
          } ,
          {
            "center_wavelength": 0.9451 ,
            "common_name": "nir09" ,
            "full_width_half_max": 0.02 ,
            "gsd": 60 ,
            "name": "B09"
          } ,
          {
            "center_wavelength": 1.3735 ,
            "common_name": "cirrus" ,
            "full_width_half_max": 0.031 ,
            "gsd": 60 ,
            "name": "B10"
          } ,
          {
            "center_wavelength": 1.6137 ,
            "common_name": "swir16" ,
            "full_width_half_max": 0.091 ,
            "gsd": 20 ,
            "name": "B11"
          } ,
          {
            "center_wavelength": 2.2024 ,
            "common_name": "swir22" ,
            "full_width_half_max": 0.175 ,
            "gsd": 20 ,
            "name": "B12"
          }
        ] ,
        "instrument": [
          "msi"
        ] ,
        "platform": "sentinel-2b"
      }
    }
  ] ,
  "links": []
}
m-mohr commented 3 years ago

In Collection summaries, you always provide an array with values or an object with statistics (min/max). So the validator is fine, you need to wrap the constellation value(s) in an array (same for platform). See the STAC summaries documentation for details: https://github.com/radiantearth/stac-spec/blob/master/collection-spec/collection-spec.md#collection-fields

sophieherrmann commented 3 years ago

Thanks! Somehow I must have missed this.