Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Server OAPIF: add PATCH to api description
  • Loading branch information
elpaso committed Nov 11, 2019
1 parent 7879ae0 commit 20652c8
Show file tree
Hide file tree
Showing 2 changed files with 202 additions and 10 deletions.
28 changes: 26 additions & 2 deletions src/server/services/wfs3/qgswfs3handlers.cpp
Expand Up @@ -1024,7 +1024,7 @@ json QgsWfs3CollectionsItemsHandler::schema( const QgsServerApiContext &context
{ "summary", "Adds a new feature to the collection {collectionId}" },
{ "tags", { "edit", "insert" } },
{ "description", "Adds a new feature to the collection {collectionId}" },
{ "operationId", operationId() + "POST" },
{ "operationId", operationId() + '_' + layerId.toStdString() + '_' + "POST" },
{
"responses", {
{
Expand Down Expand Up @@ -1908,7 +1908,7 @@ json QgsWfs3CollectionsFeatureHandler::schema( const QgsServerApiContext &contex
{ "tags", jsonTags() },
{ "summary", "Retrieve a single feature from the '" + title + "' feature collection"},
{ "description", description() },
{ "operationId", operationId() + '_' + layerId.toStdString() },
{ "operationId", operationId() + '_' + layerId.toStdString() + '_' + "GET" },
{
"parameters", {{ // array of objects
{ "$ref", "#/components/parameters/featureId" }
Expand Down Expand Up @@ -1973,6 +1973,30 @@ json QgsWfs3CollectionsFeatureHandler::schema( const QgsServerApiContext &contex
}
}
},
{
"patch", {
{ "summary", "Changes attributes of feature with ID {featureId} in the collection {collectionId}" },
{ "tags", { "edit" } },
{ "description", "Changes attributes of feature with ID {featureId} in the collection {collectionId}" },
{ "operationId", operationId() + "PUT" },
{
"responses", {
{
"200", {
{ "description", "The feature was successfully updated" }
},
"403", {
{ "description", "Forbidden: the operation requested was not authorized" }
},
"500", {
{ "description", "Posted data could not be parsed correctly or another error occourred" }
}
},
{ "default", defaultResponse() }
}
}
}
},
{
"delete", {
{ "summary", "Deletes the feature with ID {featureId} in the collection {collectionId}" },
Expand Down
184 changes: 176 additions & 8 deletions tests/testdata/qgis_server/api/test_wfs3_api_project.json
Expand Up @@ -781,7 +781,7 @@ Content-Type: application/openapi+json;version=3.0
},
"post": {
"description": "Adds a new feature to the collection {collectionId}",
"operationId": "getFeaturesPOST",
"operationId": "getFeatures_testlayer_èé_2_a5f61891_b949_43e3_ad30_84013fc922de_POST",
"responses": [
[
"201",
Expand Down Expand Up @@ -869,7 +869,7 @@ Content-Type: application/openapi+json;version=3.0
},
"get": {
"description": "Retrieve a feature with ID {featureId} from the collection with ID {collectionId}; use content negotiation or specify a file extension to request HTML (.html or GeoJSON (.json).",
"operationId": "getFeature_testlayer_èé_2_a5f61891_b949_43e3_ad30_84013fc922de",
"operationId": "getFeature_testlayer_èé_2_a5f61891_b949_43e3_ad30_84013fc922de_GET",
"parameters": [
{
"$ref": "#/components/parameters/featureId"
Expand Down Expand Up @@ -912,6 +912,48 @@ Content-Type: application/openapi+json;version=3.0
"Features"
]
},
"patch": {
"description": "Changes attributes of feature with ID {featureId} in the collection {collectionId}",
"operationId": "getFeaturePUT",
"responses": [
[
"200",
{
"description": "The feature was successfully updated"
},
"403",
{
"description": "Forbidden: the operation requested was not authorized"
},
"500",
{
"description": "Posted data could not be parsed correctly or another error occourred"
}
],
[
"default",
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/exception"
}
},
"text/html": {
"schema": {
"type": "string"
}
}
},
"description": "An error occurred."
}
]
],
"summary": "Changes attributes of feature with ID {featureId} in the collection {collectionId}",
"tags": [
"edit"
]
},
"put": {
"description": "Replaces the feature with ID {featureId} in the collection {collectionId}",
"operationId": "getFeaturePUT",
Expand Down Expand Up @@ -1108,7 +1150,7 @@ Content-Type: application/openapi+json;version=3.0
},
"post": {
"description": "Adds a new feature to the collection {collectionId}",
"operationId": "getFeaturesPOST",
"operationId": "getFeatures_testlayer_èé_cf86cf11_222f_4b62_929c_12cfc82b9774_POST",
"responses": [
[
"201",
Expand Down Expand Up @@ -1196,7 +1238,7 @@ Content-Type: application/openapi+json;version=3.0
},
"get": {
"description": "Retrieve a feature with ID {featureId} from the collection with ID {collectionId}; use content negotiation or specify a file extension to request HTML (.html or GeoJSON (.json).",
"operationId": "getFeature_testlayer_èé_cf86cf11_222f_4b62_929c_12cfc82b9774",
"operationId": "getFeature_testlayer_èé_cf86cf11_222f_4b62_929c_12cfc82b9774_GET",
"parameters": [
{
"$ref": "#/components/parameters/featureId"
Expand Down Expand Up @@ -1239,6 +1281,48 @@ Content-Type: application/openapi+json;version=3.0
"Features"
]
},
"patch": {
"description": "Changes attributes of feature with ID {featureId} in the collection {collectionId}",
"operationId": "getFeaturePUT",
"responses": [
[
"200",
{
"description": "The feature was successfully updated"
},
"403",
{
"description": "Forbidden: the operation requested was not authorized"
},
"500",
{
"description": "Posted data could not be parsed correctly or another error occourred"
}
],
[
"default",
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/exception"
}
},
"text/html": {
"schema": {
"type": "string"
}
}
},
"description": "An error occurred."
}
]
],
"summary": "Changes attributes of feature with ID {featureId} in the collection {collectionId}",
"tags": [
"edit"
]
},
"put": {
"description": "Replaces the feature with ID {featureId} in the collection {collectionId}",
"operationId": "getFeaturePUT",
Expand Down Expand Up @@ -1435,7 +1519,7 @@ Content-Type: application/openapi+json;version=3.0
},
"post": {
"description": "Adds a new feature to the collection {collectionId}",
"operationId": "getFeaturesPOST",
"operationId": "getFeatures_testlayer_c0988fd7_97ca_451d_adbc_37ad6d10583a_POST",
"responses": [
[
"201",
Expand Down Expand Up @@ -1523,7 +1607,7 @@ Content-Type: application/openapi+json;version=3.0
},
"get": {
"description": "Retrieve a feature with ID {featureId} from the collection with ID {collectionId}; use content negotiation or specify a file extension to request HTML (.html or GeoJSON (.json).",
"operationId": "getFeature_testlayer_c0988fd7_97ca_451d_adbc_37ad6d10583a",
"operationId": "getFeature_testlayer_c0988fd7_97ca_451d_adbc_37ad6d10583a_GET",
"parameters": [
{
"$ref": "#/components/parameters/featureId"
Expand Down Expand Up @@ -1566,6 +1650,48 @@ Content-Type: application/openapi+json;version=3.0
"Features"
]
},
"patch": {
"description": "Changes attributes of feature with ID {featureId} in the collection {collectionId}",
"operationId": "getFeaturePUT",
"responses": [
[
"200",
{
"description": "The feature was successfully updated"
},
"403",
{
"description": "Forbidden: the operation requested was not authorized"
},
"500",
{
"description": "Posted data could not be parsed correctly or another error occourred"
}
],
[
"default",
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/exception"
}
},
"text/html": {
"schema": {
"type": "string"
}
}
},
"description": "An error occurred."
}
]
],
"summary": "Changes attributes of feature with ID {featureId} in the collection {collectionId}",
"tags": [
"edit"
]
},
"put": {
"description": "Replaces the feature with ID {featureId} in the collection {collectionId}",
"operationId": "getFeaturePUT",
Expand Down Expand Up @@ -1762,7 +1888,7 @@ Content-Type: application/openapi+json;version=3.0
},
"post": {
"description": "Adds a new feature to the collection {collectionId}",
"operationId": "getFeaturesPOST",
"operationId": "getFeatures_testlayer20150528120452665_POST",
"responses": [
[
"201",
Expand Down Expand Up @@ -1850,7 +1976,7 @@ Content-Type: application/openapi+json;version=3.0
},
"get": {
"description": "Retrieve a feature with ID {featureId} from the collection with ID {collectionId}; use content negotiation or specify a file extension to request HTML (.html or GeoJSON (.json).",
"operationId": "getFeature_testlayer20150528120452665",
"operationId": "getFeature_testlayer20150528120452665_GET",
"parameters": [
{
"$ref": "#/components/parameters/featureId"
Expand Down Expand Up @@ -1893,6 +2019,48 @@ Content-Type: application/openapi+json;version=3.0
"Features"
]
},
"patch": {
"description": "Changes attributes of feature with ID {featureId} in the collection {collectionId}",
"operationId": "getFeaturePUT",
"responses": [
[
"200",
{
"description": "The feature was successfully updated"
},
"403",
{
"description": "Forbidden: the operation requested was not authorized"
},
"500",
{
"description": "Posted data could not be parsed correctly or another error occourred"
}
],
[
"default",
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/exception"
}
},
"text/html": {
"schema": {
"type": "string"
}
}
},
"description": "An error occurred."
}
]
],
"summary": "Changes attributes of feature with ID {featureId} in the collection {collectionId}",
"tags": [
"edit"
]
},
"put": {
"description": "Replaces the feature with ID {featureId} in the collection {collectionId}",
"operationId": "getFeaturePUT",
Expand Down

0 comments on commit 20652c8

Please sign in to comment.