Skip to content

Commit

Permalink
Merge branch 'issue-447'
Browse files Browse the repository at this point in the history
  • Loading branch information
cportele committed Mar 21, 2021
2 parents 3031249 + 5ce713b commit 3e334ab
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| "geometry", |
| "properties" |
| ], |
| "additionalProperties": false, |
| "properties": { |
| "id": { |
| "type": "string", |
Expand All @@ -25,7 +26,7 @@
| "enum": [ "Feature" ] |
| }, |
| "geometry": { |
| "$ref": "geometryGeoJSON.json" |
| "$ref": "https://geojson.org/schema/Polygon.json" |
| }, |
| "properties": { |
| "type": "object", |
Expand Down Expand Up @@ -83,7 +84,7 @@
| "links": { |
| "type": "array", |
| "items": { |
| "$ref": "common/link.json" |
| "$ref": "http://schemas.opengis.net/tbd/link.json" |
| } |
| } |
| } |
Expand Down
93 changes: 93 additions & 0 deletions extensions/transactions/simple/examples/json/replace_schema.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
....
Client Server
| |
| GET /collections/oakland_buildings/schema?type=replace HTTP/1.1 |
| Accept: application/schema+json |
|------------------------------------------------------------------>|
| |
| HTTP/1.1 200 OK |
| Content-Type: application/schema+json |
| |
| { |
| "type": "object", |
| "required": [ |
| "type", |
| "geometry", |
| "properties" |
| ], |
| "additionalProperties": false, |
| "properties": { |
| "id": { |
| "type": "string", |
| "format": "uri" |
| }, |
| "type": { |
| "type": "string", |
| "enum": [ "Feature" ] |
| }, |
| "geometry": { |
| "$ref": "https://geojson.org/schema/Polygon.json" |
| }, |
| "properties": { |
| "type": "object", |
| "required": [ |
| "apnid", |
| "bldgid2", |
| "bldgtype", |
| "final_apn" |
| ], |
| "properties": { |
| "shape_len": { |
| "type": "number", |
| "format": "double" |
| }, |
| "shape_area": { |
| "type": "number", |
| "format": "double" |
| }, |
| "bldgid3": { |
| "type": "string" |
| }, |
| "bldgid2": { |
| "type": "string" |
| }, |
| "bldgtype": { |
| "type": "string", |
| "enum": ["Commercial Building", ...] |
| }, |
| "final_apn": { |
| "type": "string", |
| "pattern": "\\d{13}" |
| }, |
| "apnid": { |
| "type": "number", |
| "format": "integer" |
| }, |
| "nostory": { |
| "type": "number", |
| "format": "integer", |
| "minimum": 1, |
| "maximum": 400 |
| }, |
| "bldgnum": { |
| "type": "string" |
| }, |
| "numbldgs": { |
| "type": "number", |
| "format": "integer" |
| }, |
| "comname": { |
| "type": "string" |
| } |
| } |
| }, |
| "links": { |
| "type": "array", |
| "items": { |
| "$ref": "http://schemas.opengis.net/tbd/link.json" |
| } |
| } |
| } |
| } |
|<------------------------------------------------------------------|
....
89 changes: 89 additions & 0 deletions extensions/transactions/simple/examples/json/update_schema.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
....
Client Server
| |
| GET /collections/oakland_buildings/schema?type=update HTTP/1.1 |
| Accept: application/schema+json |
|------------------------------------------------------------------>|
| |
| HTTP/1.1 200 OK |
| Content-Type: application/schema+json |
| |
| { |
| "type": "object", |
| "additionalProperties": false, |
| "properties": { |
| "type": { |
| "type": "string", |
| "enum": [ "Feature" ] |
| }, |
| "geometry": { |
| "$ref": "https://geojson.org/schema/Polygon.json" |
| }, |
| "properties": { |
| "type": "object", |
| "properties": { |
| "shape_len": { |
| "oneOf": [ |
| { "type": "number", "format": "double" }, |
| { "type": "null" } |
| ] |
| }, |
| "shape_area": { |
| "oneOf": [ |
| { "type": "number", "format": "double" }, |
| { "type": "null" } |
| ] |
| }, |
| "bldgid3": { |
| "type": [ "string", "null" ] |
| }, |
| "bldgid2": { |
| "type": "string" |
| }, |
| "bldgtype": { |
| "type": "string", |
| "enum": ["Commercial Building", ...] |
| }, |
| "final_apn": { |
| "type": "string", |
| "pattern": "\\d{13}" |
| }, |
| "apnid": { |
| "type": "number", |
| "format": "integer" |
| }, |
| "nostory": { |
| "oneOf": [ |
| { |
| "type": "number", |
| "format": "integer", |
| "minimum": 1, |
| "maximum": 400 |
| }, |
| { "type": "null" } |
| ] |
| }, |
| "bldgnum": { |
| "type": [ "string", "null" ] |
| }, |
| "numbldgs": { |
| "oneOf": [ |
| { "type": "number", "format": "integer" }, |
| { "type": "null" } |
| ] |
| }, |
| "comname": { |
| "type": [ "string", "null" ] |
| } |
| } |
| }, |
| "links": { |
| "type": "array", |
| "items": { |
| "$ref": "http://schemas.opengis.net/tbd/link.json" |
| } |
| } |
| } |
| } |
|<------------------------------------------------------------------|
....
23 changes: 20 additions & 3 deletions extensions/transactions/simple/standard/clause_9_features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,29 @@ include::requirements/features/REQ_representation-geojson-create.adoc[]

*Example*

The following example fetches the create schema for the `oakland_buildings` collection. The `type` parameter with a value of `create` is used to indicate that the desired schema is the schema that should be followed to create a new feature instance. A pseudo-sequence diagram notation is used to illustrate the details of the HTTP communication between the client and the server.
The following examples fetch the "create", "replace" and "update" schemas for the `oakland_buildings` collection. The `type` parameter with a value of `create`, `replace` and `update` are used to indicate that the desired schema is the schema that should be followed to create, replace or update a feature instance. Pseudo-sequence diagram notation is used to illustrate the details of the HTTP communication between the client and the server.

[#create-schema,reftext=`Create Schema Example`]
.Create Schema Example
All schemas are based on the GeoJSON schema of a `oakland_buildings` feature. The server will reject any feature that does not validate against the schema for the requested operation. Since each schema includes a statement `"additionalProperties": false`, the server will reject any feature that has additional properties that are not specified in the schema.

The differences between the schemas are in the nature of the operation:

- The "create" schema is the standard GeoJSON schema. It includes an `id` member and likely indicates that the server will take the value into account when assigning a feature id to the new feature, but this is the decision of the server.
- The "replace" schema is identical to the "create" schema. The server may reject feature instances that have an `id` member that is not the same as the feature identifier of the feature that is replaced.
- The "update" schema has no `id` member and no required members since in the PATCH request only the members that are changed will be included. In addition, the schema allows `null` values for properties that are not required in the create/replace schema.

[#create-schema,reftext=`"Create" Schema Example`]
."Create" Schema Example
include::../examples/json/create_schema.adoc[]

[#replace-schema,reftext=`"Replace" Schema Example`]
."Replace" Schema Example
include::../examples/json/replace_schema.adoc[]

[#update-schema,reftext=`"Update Schema Example`]
."Update" Schema Example
include::../examples/json/update_schema.adoc[]


include::requirements/features/REQ_representation-geojson-replace.adoc[]

include::requirements/features/REQ_representation-geojson-update.adoc[]
Expand Down

0 comments on commit 3e334ab

Please sign in to comment.