[Mapbender-commits] r10275 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Oct 1 13:54:01 PDT 2019


Author: armin11
Date: 2019-10-01 13:54:01 -0700 (Tue, 01 Oct 2019)
New Revision: 10275

Modified:
   trunk/mapbender/http/php/mod_linkedDataProxy.php
Log:
New draft for describing linkeddataproxy api via openapi 3.0 (json-format)

Modified: trunk/mapbender/http/php/mod_linkedDataProxy.php
===================================================================
--- trunk/mapbender/http/php/mod_linkedDataProxy.php	2019-10-01 04:22:58 UTC (rev 10274)
+++ trunk/mapbender/http/php/mod_linkedDataProxy.php	2019-10-01 20:54:01 UTC (rev 10275)
@@ -8,7 +8,15 @@
 global $rewritePath;
 global $behindRewrite;
 global $linkedDataProxyUrl;
+/*
+examples:
+get
+http://localhost/mapbender/php/mod_linkedDataProxy.php?wfsid=19&collection=TEHG_RLP%3Atehg_anlagen_2013_gesamt&items=all&f=html
 
+rest
+
+
+*/
 if (file_exists(dirname(__FILE__)."/../../conf/linkedDataProxy.json")) {
      $configObject = json_decode(file_get_contents("../../conf/linkedDataProxy.json"));
 }
@@ -77,7 +85,6 @@
 }
 
 $linkedDataProxyUrl = $schema."://".$_SERVER['HTTP_HOST']."/".$rewritePath;
-//$e = new mb_exception($linkedDataProxy);
 
 if ($behindRewrite == true) {
     $cssFile = MAPBENDER_PATH."/php/".$cssFile;  
@@ -206,6 +213,9 @@
 	    if (isset($requestArray['wfsid']) && $requestArray['wfsid'] != "") {
 		$apiPath .= "/".$requestArray['wfsid']."";
 	    }
+	    /*if (isset($requestArray['getapidescription']) && $requestArray['getapidescription'] == "true") {
+		$apiPath .= "/api/";
+	    }*/
 	    if (isset($requestArray['collection']) && $requestArray['collection'] != "") {
 		if ($requestArray['collection'] == "all") {
 		    $apiPath .= "/collections";
@@ -217,6 +227,9 @@
 		if ($requestArray['items'] == "all") {
 		    $apiPath .= "/items";
 		}
+		if ($requestArray['items'] == "api") {
+		    $apiPath .= "/api/";
+		}
 	    }
 	    if (isset($requestArray['item']) && $requestArray['item'] != "") {
 		    $apiPath .= "/items/".$requestArray['item'];
@@ -388,8 +401,8 @@
 if (isset($_REQUEST["collections"]) & $_REQUEST["collections"] != "") {
 	//validate to csv integer list
 	$testMatch = $_REQUEST["collections"];
-	if (!in_array($testMatch, array("all"))){ 
-		echo 'Parameter <b>collections</b> is not valid (maybe all).<br/>'; 
+	if (!in_array($testMatch, array("all", "api"))){ 
+		echo 'Parameter <b>collections</b> is not valid (maybe all or api).<br/>'; 
 		die(); 		
  	}
 	$collections = $testMatch;
@@ -552,7 +565,675 @@
     	$returnObject->message = "Wfs object could not be created from db!";
     } else {
 	//create service part if no collection is requested		
-	if (!isset($collection) || $collection == "" || $collections == "all") {
+	if (!isset($collection) || $collection == "" || $collections == "all" || $collections == "api") {
+	    if ($collections == "api") {
+		$apiDescriptionJson = new stdClass();
+		$apiDescriptionJson->openapi = "3.0.1";
+		$apiDescriptionJson->info->title = "wfs title";
+		$apiDescriptionJson->info->description = "wfs description";
+		$apiDescriptionJson->contact->name = "wfs description";
+		$apiDescriptionJson->contact->url = "wfs description";
+		$apiDescriptionJson->contact->email = "wfs contact email";
+
+		$apiDescriptionJson->license->name = "wfs description";
+		$apiDescriptionJson->license->version = "wfs description";
+
+		$apiDescriptionJson->servers[0]->url = "server url - ...";
+
+		$apiDescriptionJson->tags[0]->name = "Capabilities";
+		$apiDescriptionJson->tags[0]->description = "Essential characteristics of this API including information about the data.";
+		$apiDescriptionJson->tags[1]->name = "Features";
+		$apiDescriptionJson->tags[1]->description = "Access to data (features).";
+		//path / ****************************************************************
+		$apiDescriptionJson->paths->{'/'}->get->tags = array("Capabilities");
+		$apiDescriptionJson->paths->{'/'}->get->summary = "landing page of this API";
+		$apiDescriptionJson->paths->{'/'}->get->description = "The landing page provides links to the API definition, the Conformance statements and the metadata about the feature data in this dataset.";
+		$apiDescriptionJson->paths->{'/'}->get->operationId = "getLandingPage";
+		$apiDescriptionJson->paths->{'/'}->get->parameters = array();
+
+		$apiDescriptionJson->paths->{'/'}->get->responses->{'200'}->description = "links to the API capabilities and the feature collections shared by this API.";
+		$apiDescriptionJson->paths->{'/'}->get->responses->{'200'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/root";
+		$apiDescriptionJson->paths->{'/'}->get->responses->{'200'}->content->{'text/html'}->schema->type = "string";
+		$apiDescriptionJson->paths->{'/'}->get->responses->{'default'}->description = "An error occured.";
+		$apiDescriptionJson->paths->{'/'}->get->responses->{'default'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/exception";
+		$apiDescriptionJson->paths->{'/'}->get->responses->{'default'}->content->{'text/html'}->schema->{'type'} = "string";
+		//path / ****************************************************************
+		//path /api ****************************************************************
+		$apiDescriptionJson->paths->{'/api'}->get->tags = array("Capabilities");
+		$apiDescriptionJson->paths->{'/api'}->get->summary = "the API description - this document";
+		$apiDescriptionJson->paths->{'/api'}->get->operationId = "getApiDescription";
+		$apiDescriptionJson->paths->{'/api'}->get->parameters = array();
+
+		$apiDescriptionJson->paths->{'/api'}->get->responses->{'200'}->description = "The formal documentation of this API according to the OpenAPI specification, version 3.0. I.e., this document.";
+		$apiDescriptionJson->paths->{'/api'}->get->responses->{'200'}->content->{'application/openapi+json;version=3.0'}->schema->type = "object";
+		$apiDescriptionJson->paths->{'/api'}->get->responses->{'200'}->content->{'text/html'}->schema->type = "string";
+		$apiDescriptionJson->paths->{'/api'}->get->responses->{'default'}->description = "An error occured.";
+		$apiDescriptionJson->paths->{'/api'}->get->responses->{'default'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/exception";
+		$apiDescriptionJson->paths->{'/api'}->get->responses->{'default'}->content->{'text/html'}->schema->{'type'} = "string";
+		//path /api ****************************************************************
+		//path /conformance ****************************************************************
+		$apiDescriptionJson->paths->{'/conformance'}->get->tags = array("Capabilities");
+		$apiDescriptionJson->paths->{'/conformance'}->get->summary = "information about standards that this API conforms to";
+		$apiDescriptionJson->paths->{'/conformance'}->get->description = "list all requirements classes specified in a standard (e.g., WFS 3.0 Part 1: Core) that the server conforms to";
+		$apiDescriptionJson->paths->{'/conformance'}->get->operationId = "getRequirementsClasses";
+		$apiDescriptionJson->paths->{'/conformance'}->get->parameters = array();
+
+		$apiDescriptionJson->paths->{'/conformance'}->get->responses->{'200'}->description = "the URIs of all requirements classes supported by the server";
+		$apiDescriptionJson->paths->{'/conformance'}->get->responses->{'200'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/req-classes";
+		$apiDescriptionJson->paths->{'/conformance'}->get->responses->{'default'}->description = "An error occured.";
+		$apiDescriptionJson->paths->{'/conformance'}->get->responses->{'default'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/exception";
+		//path /conformance ****************************************************************
+		//path /collections ****************************************************************
+		$apiDescriptionJson->paths->{'/collections'}->get->tags = array("Capabilities");
+		$apiDescriptionJson->paths->{'/collections'}->get->summary = "describe the feature collections in the dataset";
+		$apiDescriptionJson->paths->{'/collections'}->get->operationId = "describeCollections";
+		$apiDescriptionJson->paths->{'/collections'}->get->parameters = array();
+
+		$apiDescriptionJson->paths->{'/collections'}->get->responses->{'200'}->description = "Metadata about the feature collections shared by this API.";
+		$apiDescriptionJson->paths->{'/collections'}->get->responses->{'200'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/content";
+		$apiDescriptionJson->paths->{'/collections'}->get->responses->{'200'}->content->{'text/html'}->schema->type = "string";
+		$apiDescriptionJson->paths->{'/collections'}->get->responses->{'default'}->description = "An error occured.";
+		$apiDescriptionJson->paths->{'/collections'}->get->responses->{'default'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/exception";
+		$apiDescriptionJson->paths->{'/collections'}->get->responses->{'default'}->content->{'text/html'}->schema->{'type'} = "string";
+		//path /collections ****************************************************************
+		//collect the elements foreach featuretype via sql
+		foreach ($wfs->featureTypeArray as $featureType) {
+			//path /collections ****************************************************************
+			$featuretypePathPart = '/collections/'.$featureType->name;
+
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->tags = array("Capabilities");
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->summary = "describe the ".$featureType->title." feature collection";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->operationId = "describeCollection".$featureType->name;
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->parameters = array();
+
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->description = "Metadata about the collection shared by this API.";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->content->{'application/geo+json'}->schema->{'$ref'} = "#/components/schemas/collectionInfo";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->content->{'text/html'}->schema->type = "string";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->description = "An error occured.";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/exception";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->content->{'text/html'}->schema->{'type'} = "string";
+			//items *************************************************************************
+			$featuretypePathPart = '/collections/'.$featureType->name.'/items';
+
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->tags = array("Features");
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->summary = "retrieve features of ".$featureType->title." feature collection";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->operationId = "getFeatures".$featureType->name;
+			//possible query filters:
+			$queryParams = array("f", "limit", "offset", "bbox", "resultType", "properties");
+			//TODO: crs, bbox-crs, maxAllowableOffset
+			foreach ($queryParams as $param) {
+			    $apiDescriptionJson->paths->{$featuretypePathPart}->get->parameters[]->{'$ref'} = "#/components/parameters/".$param;
+			}
+			//TODO : funktion ? -https://www.ldproxy.nrw.de/topographie/api/?f=json  -$apiDescriptionJson->paths->{$featuretypePathPart}->get->parameters[] = 
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->description = "A feature.";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->content->{'application/geo+json'}->schema->{'$ref'} = "#/components/schemas/featureGeoJSON";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->content->{'text/html'}->schema->type = "string";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->description = "An error occured.";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/exception";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->content->{'text/html'}->schema->{'type'} = "string";
+			//items *************************************************************************
+			//{items}/{featureId} *************************************************************************
+			$featuretypePathPart = '/collections/'.$featureType->name.'/items/{featureId}';
+
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->tags = array("Features");
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->summary = "retrieve a ".$featureType->title;
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->operationId = "getFeature".$featureType->name;
+			//possible query filters:
+			$queryParams = array("featureId", "f", "properties");
+			//TODO: crs, maxAllowableOffset
+			foreach ($queryParams as $param) {
+			    $apiDescriptionJson->paths->{$featuretypePathPart}->get->parameters[]->{'$ref'} = "#/components/parameters/".$param;
+			}
+			//TODO : funktion ? -https://www.ldproxy.nrw.de/topographie/api/?f=json  -$apiDescriptionJson->paths->{$featuretypePathPart}->get->parameters[] = 
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->description = "Information about the feature collection plus the first features matching the selection parameters.";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->content->{'application/geo+json'}->schema->{'$ref'} = "#/components/schemas/featureCollectionGeoJSON";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'200'}->content->{'text/html'}->schema->type = "string";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->description = "An error occured.";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->content->{'application/json'}->schema->{'$ref'} = "#/components/schemas/exception";
+			$apiDescriptionJson->paths->{$featuretypePathPart}->get->responses->{'default'}->content->{'text/html'}->schema->{'type'} = "string";
+			//{items}/{featureId}*************************************************************************
+		//path /collections ****************************************************************
+		}
+/*$iaEampleJson = <<<JSON
+{  "components" : {
+    "schemas" : {
+      "exception" : {
+        "required" : [ "code" ],
+        "type" : "object",
+        "properties" : {
+          "code" : {
+            "type" : "string"
+          },
+          "description" : {
+            "type" : "string"
+          }
+        }
+      },
+      "root" : {
+        "required" : [ "links" ],
+        "type" : "object",
+        "properties" : {
+          "links" : {
+            "type" : "array",
+            "example" : [ {
+              "href" : "http://data.example.org/",
+              "rel" : "self",
+              "type" : "application/json",
+              "title" : "this document"
+            }, {
+              "href" : "http://data.example.org/api",
+              "rel" : "service",
+              "type" : "application/openapi+json;version=3.0",
+              "title" : "the API definition"
+            }, {
+              "href" : "http://data.example.org/conformance",
+              "rel" : "conformance",
+              "type" : "application/json",
+              "title" : "WFS 3.0 conformance classes implemented by this server"
+            }, {
+              "href" : "http://data.example.org/collections",
+              "rel" : "data",
+              "type" : "application/json",
+              "title" : "Metadata about the feature collections"
+            } ],
+            "items" : {
+              "$ref" : "#/components/schemas/link"
+            }
+          }
+        }
+      },
+      "req-classes" : {
+        "required" : [ "conformsTo" ],
+        "type" : "object",
+        "properties" : {
+          "conformsTo" : {
+            "type" : "array",
+            "example" : [ "http://www.opengis.net/spec/wfs-1/3.0/req/core", "http://www.opengis.net/spec/wfs-1/3.0/req/oas30", "http://www.opengis.net/spec/wfs-1/3.0/req/html", "http://www.opengis.net/spec/wfs-1/3.0/req/geojson" ],
+            "items" : {
+              "type" : "string"
+            }
+          }
+        }
+      },
+      "link" : {
+        "required" : [ "href" ],
+        "type" : "object",
+        "properties" : {
+          "href" : {
+            "type" : "string",
+            "example" : "http://data.example.com/buildings/123"
+          },
+          "rel" : {
+            "type" : "string",
+            "example" : "prev"
+          },
+          "type" : {
+            "type" : "string",
+            "example" : "application/geo+json"
+          },
+          "hreflang" : {
+            "type" : "string",
+            "example" : "en"
+          }
+        }
+      },
+      "content" : {
+        "required" : [ "collections", "links" ],
+        "type" : "object",
+        "properties" : {
+          "links" : {
+            "type" : "array",
+            "example" : [ {
+              "href" : "http://data.example.org/collections.json",
+              "rel" : "self",
+              "type" : "application/json",
+              "title" : "this document"
+            }, {
+              "href" : "http://data.example.org/collections.html",
+              "rel" : "alternate",
+              "type" : "text/html",
+              "title" : "this document as HTML"
+            }, {
+              "href" : "http://schemas.example.org/1.0/foobar.xsd",
+              "rel" : "describedBy",
+              "type" : "application/xml",
+              "title" : "XML schema for Acme Corporation data"
+            } ],
+            "items" : {
+              "$ref" : "#/components/schemas/link"
+            }
+          },
+          "collections" : {
+            "type" : "array",
+            "items" : {
+              "$ref" : "#/components/schemas/collectionInfo"
+            }
+          }
+        }
+      },
+      "collectionInfo" : {
+        "required" : [ "links", "name" ],
+        "type" : "object",
+        "properties" : {
+          "name" : {
+            "type" : "string",
+            "description" : "identifier of the collection used, for example, in URIs",
+            "example" : "buildings"
+          },
+          "title" : {
+            "type" : "string",
+            "description" : "human readable title of the collection",
+            "example" : "Buildings"
+          },
+          "description" : {
+            "type" : "string",
+            "description" : "a description of the features in the collection",
+            "example" : "Buildings in the city of Bonn."
+          },
+          "links" : {
+            "type" : "array",
+            "example" : [ {
+              "href" : "http://data.example.org/collections/buildings/items",
+              "rel" : "item",
+              "type" : "application/geo+json",
+              "title" : "Buildings"
+            }, {
+              "href" : "http://example.com/concepts/buildings.html",
+              "rel" : "describedBy",
+              "type" : "text/html",
+              "title" : "Feature catalogue for buildings"
+            } ],
+            "items" : {
+              "$ref" : "#/components/schemas/link"
+            }
+          },
+          "extent" : {
+            "$ref" : "#/components/schemas/extent"
+          },
+          "crs" : {
+            "type" : "array",
+            "description" : "The coordinate reference systems in which geometries may be retrieved. Coordinate reference systems are identified by a URI. The first coordinate reference system is the coordinate reference system that is used by default. This is always \"http://www.opengis.net/def/crs/OGC/1.3/CRS84\", i.e. WGS84 longitude/latitude.",
+            "example" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84", "http://www.opengis.net/def/crs/EPSG/0/4326" ],
+            "items" : {
+              "type" : "string"
+            },
+            "default" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84" ]
+          },
+          "relations" : {
+            "type" : "object",
+            "description" : "Related collections that may be retrieved for this collection",
+            "example" : "{\"id\": \"label\"}"
+          }
+        }
+      },
+      "extent" : {
+        "required" : [ "spatial" ],
+        "type" : "object",
+        "properties" : {
+          "crs" : {
+            "type" : "string",
+            "description" : "Coordinate reference system of the coordinates in the spatial extent (property `spatial`). In the Core, only WGS84 longitude/latitude is supported. Extensions may support additional coordinate reference systems.",
+            "enum" : [ "http://www.opengis.net/def/crs/OGC/1.3/CRS84" ],
+            "default" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
+          },
+          "spatial" : {
+            "maxItems" : 6,
+            "minItems" : 4,
+            "type" : "array",
+            "description" : "West, north, east, south edges of the spatial extent. The minimum and maximum values apply to the coordinate reference system WGS84 longitude/latitude that is supported in the Core. If, for example, a projected coordinate reference system is used, the minimum and maximum values need to be adjusted.",
+            "example" : [ -180, -90, 180, 90 ],
+            "items" : {
+              "type" : "number"
+            }
+          }
+        }
+      },
+      "featureCollectionGeoJSON" : {
+        "required" : [ "features", "type" ],
+        "type" : "object",
+        "properties" : {
+          "type" : {
+            "type" : "string",
+            "enum" : [ "FeatureCollection" ]
+          },
+          "features" : {
+            "type" : "array",
+            "items" : {
+              "$ref" : "#/components/schemas/featureGeoJSON"
+            }
+          },
+          "links" : {
+            "type" : "array",
+            "items" : {
+              "$ref" : "#/components/schemas/link"
+            }
+          },
+          "timeStamp" : {
+            "type" : "string",
+            "format" : "dateTime"
+          },
+          "numberMatched" : {
+            "minimum" : 0,
+            "type" : "integer"
+          },
+          "numberReturned" : {
+            "minimum" : 0,
+            "type" : "integer"
+          }
+        }
+      },
+      "featureGeoJSON" : {
+        "required" : [ "geometry", "properties", "type" ],
+        "type" : "object",
+        "properties" : {
+          "type" : {
+            "type" : "string",
+            "enum" : [ "Feature" ]
+          },
+          "geometry" : {
+            "$ref" : "#/components/schemas/geometryGeoJSON"
+          },
+          "properties" : {
+            "type" : "object",
+            "nullable" : true
+          },
+          "id" : {
+            "oneOf" : [ {
+              "type" : "string"
+            }, {
+              "type" : "integer"
+            } ]
+          }
+        }
+      },
+      "geometryGeoJSON" : {
+        "required" : [ "type" ],
+        "type" : "object",
+        "properties" : {
+          "type" : {
+            "type" : "string",
+            "enum" : [ "Point", "MultiPoint", "LineString", "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection" ]
+          }
+        }
+      }
+    },
+    "parameters" : {
+      "f" : {
+        "name" : "f",
+        "in" : "query",
+        "description" : "The format of the response. If no value is provided, the standard http rules apply, i.e., the accept header shall be used to determine the format.\\\nPre-defined values are \"xml\", \"json\" and \"html\". The response to other  values is determined by the server.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "string",
+          "enum" : [ "json", "xml", "html" ]
+        },
+        "example" : "json"
+      },
+      "limit" : {
+        "name" : "limit",
+        "in" : "query",
+        "description" : "The optional limit parameter limits the number of items that are presented in the response document.\\\nOnly items are counted that are on the first level of the collection in the response document.  Nested objects contained within the explicitly requested items shall not be counted.\\\nMinimum = 1.\\\nMaximum = 10000.\\\nDefault = 10.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "maximum" : 10000,
+          "minimum" : 1,
+          "type" : "integer",
+          "default" : 10
+        },
+        "example" : 10
+      },
+      "offset" : {
+        "name" : "offset",
+        "in" : "query",
+        "description" : "The optional offset parameter indicates the index within the result set from which the server shall begin presenting results in the response document. The first element has an index of 0.\\\nMinimum = 0.\\\nDefault = 0.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "minimum" : 0,
+          "type" : "integer",
+          "default" : 0
+        },
+        "example" : 0
+      },
+      "bbox" : {
+        "name" : "bbox",
+        "in" : "query",
+        "description" : "Only features that have a geometry that intersects the bounding box are selected. The bounding box is provided as four or six numbers, depending on whether the coordinate reference system includes a vertical axis (elevation or depth):\n \n* Lower left corner, coordinate axis 1\n* Lower left corner, coordinate axis 2\n* Lower left corner, coordinate axis 3 (optional)\n* Upper right corner, coordinate axis 1\n* Upper right corner, coordinate axis 2\n* Upper right corner, coordinate axis 3 (optional)\n\nThe coordinate reference system of the values is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84) unless a different coordinate reference system is specified in the parameter `bbox-crs`.\n\nFor WGS84 longitude/latitude the values are in most cases the sequence of minimum longitude, minimum latitude, maximum longitude and maximum latitude. However, in cases where the box spans the antimeridian the first value (west-most box edge) is larger 
 than the third value (east-most box edge).\n\nIf a feature has multiple spatial geometry properties, it is the decision of the server whether only a single spatial geometry property is used to determine the extent or all relevant geometries.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "maxItems" : 6,
+          "minItems" : 4,
+          "type" : "array",
+          "items" : {
+            "type" : "number"
+          }
+        }
+      },
+      "time" : {
+        "name" : "time",
+        "in" : "query",
+        "description" : "Either a date-time or a period string that adheres to RFC 3339. Examples:\n\n* A date-time: \"2018-02-12T23:20:50Z\"\n* A period: \"2018-02-12T00:00:00Z/2018-03-18T12:31:12Z\" or \"2018-02-12T00:00:00Z/P1M6DT12H31M12S\"\n\nOnly features that have a temporal property that intersects the value of\n`time` are selected.\n\nIf a feature has multiple temporal properties, it is the decision of the\nserver whether only a single temporal property is used to determine\nthe extent or all relevant temporal properties.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "string"
+        }
+      },
+      "resultType" : {
+        "name" : "resultType",
+        "in" : "query",
+        "description" : "This service will respond to a query in one of two ways (excluding an exception response). It may either generate a complete response document containing resources that satisfy the operation or it may simply generate an empty response container that indicates the count of the total number of resources that the operation would return. Which of these two responses is generated is determined by the value of the optional resultType parameter.\\\nThe allowed values for this parameter are \"results\" and \"hits\".\\\nIf the value of the resultType parameter is set to \"results\", the server will generate a complete response document containing resources that satisfy the operation.\\\nIf the value of the resultType attribute is set to \"hits\", the server will generate an empty response document containing no resource instances.\\\nDefault = \"results\".",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "string",
+          "enum" : [ "hits", "results" ],
+          "default" : "results"
+        },
+        "example" : "results"
+      },
+      "featureId" : {
+        "name" : "featureId",
+        "in" : "path",
+        "description" : "Local identifier of a specific feature",
+        "required" : true,
+        "schema" : {
+          "type" : "string"
+        }
+      },
+      "relations" : {
+        "name" : "relations",
+        "in" : "query",
+        "description" : "Comma-separated list of related collections that should be shown for this feature",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "array",
+          "items" : {
+            "type" : "string"
+          }
+        }
+      },
+      "resolve" : {
+        "name" : "resolve",
+        "in" : "query",
+        "description" : "Only provide links to related collections by default, resolve the links when true",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "boolean",
+          "default" : false
+        }
+      },
+      "limitList" : {
+        "name" : "limit",
+        "in" : "query",
+        "description" : "Comma-separated list of limits for related collections",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "array",
+          "items" : {
+            "maximum" : 10000,
+            "minimum" : 0,
+            "type" : "integer",
+            "format" : "int32",
+            "default" : 5
+          }
+        }
+      },
+      "offsetList" : {
+        "name" : "offset",
+        "in" : "query",
+        "description" : "Comma-separated list of offsets for related collections",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "array",
+          "items" : {
+            "minimum" : 0,
+            "type" : "integer",
+            "format" : "int32",
+            "default" : 0
+          }
+        }
+      },
+      "properties" : {
+        "name" : "properties",
+        "in" : "query",
+        "description" : "The properties that should be included for each feature. The parameter value is a comma-separated list of property names.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "array",
+          "items" : {
+            "type" : "string"
+          }
+        }
+      },
+      "crs" : {
+        "name" : "crs",
+        "in" : "query",
+        "description" : "The coordinate reference system of the response geometries. Default is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84).",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "string",
+          "enum" : [ "http://www.opengis.net/def/crs/EPSG/0/25832", "http://www.opengis.net/def/crs/OGC/1.3/CRS84", "http://www.opengis.net/def/crs/EPSG/0/3034", "http://www.opengis.net/def/crs/EPSG/0/3035", "http://www.opengis.net/def/crs/EPSG/0/3043", "http://www.opengis.net/def/crs/EPSG/0/3044", "http://www.opengis.net/def/crs/EPSG/0/3045", "http://www.opengis.net/def/crs/EPSG/0/3857", "http://www.opengis.net/def/crs/EPSG/0/4258", "http://www.opengis.net/def/crs/EPSG/0/4326", "http://www.opengis.net/def/crs/EPSG/0/4647", "http://www.opengis.net/def/crs/EPSG/0/5649", "http://www.opengis.net/def/crs/EPSG/0/5650", "http://www.opengis.net/def/crs/EPSG/0/5651", "http://www.opengis.net/def/crs/EPSG/0/5652", "http://www.opengis.net/def/crs/EPSG/0/5653", "http://www.opengis.net/def/crs/EPSG/0/28992", "http://www.opengis.net/def/crs/EPSG/0/25831", "http://www.opengis.net/def/crs/EPSG/0/25833" ],
+          "default" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
+        }
+      },
+      "bbox-crs" : {
+        "name" : "bbox-crs",
+        "in" : "query",
+        "description" : "The coordinate reference system of the bbox parameter. Default is WGS84 longitude/latitude (http://www.opengis.net/def/crs/OGC/1.3/CRS84).",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "string",
+          "enum" : [ "http://www.opengis.net/def/crs/EPSG/0/25832", "http://www.opengis.net/def/crs/OGC/1.3/CRS84", "http://www.opengis.net/def/crs/EPSG/0/3034", "http://www.opengis.net/def/crs/EPSG/0/3035", "http://www.opengis.net/def/crs/EPSG/0/3043", "http://www.opengis.net/def/crs/EPSG/0/3044", "http://www.opengis.net/def/crs/EPSG/0/3045", "http://www.opengis.net/def/crs/EPSG/0/3857", "http://www.opengis.net/def/crs/EPSG/0/4258", "http://www.opengis.net/def/crs/EPSG/0/4326", "http://www.opengis.net/def/crs/EPSG/0/4647", "http://www.opengis.net/def/crs/EPSG/0/5649", "http://www.opengis.net/def/crs/EPSG/0/5650", "http://www.opengis.net/def/crs/EPSG/0/5651", "http://www.opengis.net/def/crs/EPSG/0/5652", "http://www.opengis.net/def/crs/EPSG/0/5653", "http://www.opengis.net/def/crs/EPSG/0/28992", "http://www.opengis.net/def/crs/EPSG/0/25831", "http://www.opengis.net/def/crs/EPSG/0/25833" ],
+          "default" : "http://www.opengis.net/def/crs/OGC/1.3/CRS84"
+        }
+      },
+      "maxAllowableOffset" : {
+        "name" : "maxAllowableOffset",
+        "in" : "query",
+        "description" : "This option can be used to specify the maxAllowableOffset to be used for generalizing the response geometries.\n \nThe maxAllowableOffset is in the units of the response coordinate reference system.",
+        "required" : false,
+        "style" : "form",
+        "explode" : false,
+        "schema" : {
+          "type" : "number",
+          "default" : 0
+        },
+        "example" : 0.05
+      }
+    }
+  }
+}
+JSON;
+$jsonTemplate = json_decode($iaEampleJson);
+$apiDescriptionJson->components = $jsonTemplate;*/
+		//components
+		$apiDescriptionJson->components->schemas->exception->required[0] = "code";
+		$apiDescriptionJson->components->schemas->exception->type = "object";
+		$apiDescriptionJson->components->schemas->exception->properties->code->type = "string";
+		$apiDescriptionJson->components->schemas->exception->properties->description->type = "string";
+
+		$apiDescriptionJson->components->schemas->root->required[0] = "links";
+		$apiDescriptionJson->components->schemas->root->type = "object";
+		$apiDescriptionJson->components->schemas->root->properties->links->type = "array";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[0]->href = "http://data.example.org/";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[0]->rel = "self";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[0]->type = "application/json";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[0]->title = "this document";
+		
+		$apiDescriptionJson->components->schemas->root->properties->links->example[1]->href = "http://data.example.org/api";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[1]->rel = "service";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[1]->type = "application/openapi+json;version=3.0";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[1]->title = "the API definition";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[2]->href = "http://data.example.org/conformance";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[2]->rel = "conformance";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[2]->type = "application/json";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[2]->title = "WFS 3.0 conformance classes implemented by this server";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[3]->href = "http://data.example.org/collections";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[3]->rel = "data";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[3]->type = "application/json";
+		$apiDescriptionJson->components->schemas->root->properties->links->example[1]->title = "Metadata about the feature collections";
+
+
+		$apiDescriptionJson->components->schemas->{'req-classes'}->required[0] = "conformsTo"; 
+		$apiDescriptionJson->components->schemas->{'req-classes'}->type = "object"; 
+		$apiDescriptionJson->components->schemas->{'req-classes'}->properties->conformsTo->type = "array"; 
+		$apiDescriptionJson->components->schemas->{'req-classes'}->properties->conformsTo->example[0] = "http://www.opengis.net/spec/wfs-1/3.0/req/core"; 
+		$apiDescriptionJson->components->schemas->{'req-classes'}->properties->conformsTo->example[1] = "http://www.opengis.net/spec/wfs-1/3.0/req/oas30"; 
+		$apiDescriptionJson->components->schemas->{'req-classes'}->properties->conformsTo->example[2] = "http://www.opengis.net/spec/wfs-1/3.0/req/html"; 
+		$apiDescriptionJson->components->schemas->{'req-classes'}->properties->conformsTo->example[3] = "http://www.opengis.net/spec/wfs-1/3.0/req/geojson"; 
+		$apiDescriptionJson->components->schemas->{'req-classes'}->properties->conformsTo->items = "string"; 
+
+		$apiDescriptionJson->components->schemas->link->required[0] = "href";
+		$apiDescriptionJson->components->schemas->link->type = "object";
+		$apiDescriptionJson->components->schemas->link->properties->href->type = "string";
+		$apiDescriptionJson->components->schemas->link->properties->href->example = "http://data.example.com/buildings/123";
+		$apiDescriptionJson->components->schemas->link->properties->rel->type = "string";
+		$apiDescriptionJson->components->schemas->link->properties->rel->example = "prev";
+		$apiDescriptionJson->components->schemas->link->properties->type->type = "string";
+		$apiDescriptionJson->components->schemas->link->properties->type->example = "application/geo+json";
+		$apiDescriptionJson->components->schemas->link->properties->type->hreflang = "string";
+		$apiDescriptionJson->components->schemas->link->properties->type->hreflang = "de";
+		
+		
+/*
+		$apiDescriptionJson->components->schemas->content->
+		$apiDescriptionJson->components->schemas->collectionInfo->
+		$apiDescriptionJson->components->schemas->extent->
+		$apiDescriptionJson->components->schemas->featureCollectionGeoJSON->
+		$apiDescriptionJson->components->schemas->featureGeoJSON->
+		$apiDescriptionJson->components->schemas->geometryGeoJSON->
+
+		$apiDescriptionJson->components->parameters->*/
+		$paramArray = array("f", "limit", "offset", "bbox", "resultType", "featureId", "limitList", "properties"); //TODO: relations, resolve, offsetList, crs, bbox-crs, maxAllowedOffset
+		//schemas
+		echo json_encode($apiDescriptionJson, JSON_UNESCAPED_SLASHES);
+		die();
+
+	    }
             //************************************************************************************************************************************
             //service only part 
             //************************************************************************************************************************************
@@ -649,7 +1330,6 @@
 		    $ftElementArray = $featureType->elementArray; //consists of name and type
 		    //get allowed attributes for filtering
 		    $ftAllowedAttributesArray = array();
-
 		    foreach ($ftElementArray as $ftElement) {
                         //$e = new mb_exception($ftElement->name ." - " .$ftElement->type);
 			if ($ftElement->type == "string") {
@@ -697,6 +1377,7 @@
 		    $returnObject->links[0]->type = "application/geo+json";
  		    $returnObject->links[0]->title = $myFeatureType->title." as GeoJSON";
                     $returnObject->links[0]->href = get2Rest($_SERVER['REQUEST_URI']."&collection=".$featureType->name."&items=all&f=json");
+
 		    //TODO: items in other formats, self, alternate
 		    if ($items == "all") { //show items in list!
 			//reinitialize object!



More information about the Mapbender_commits mailing list