-
-
Save idkw/fc35bb78c4bf08e47708f57b060996fe to your computer and use it in GitHub Desktop.
A swagger geojson geometry description
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
swagger: '2.0' | |
info: | |
version: "1.0.0" | |
title: GeoJSON geometry | |
description: An example of swagger file for a geographic API. It contains the geometry definitions | |
termsOfService: "no" | |
contact: | |
name: Daniele Andreis | |
email: [email protected] | |
url: "" | |
license: | |
name: GPLv3 | |
url: https://www.gnu.org/licenses/gpl-3.0.html | |
externalDocs: | |
description: find more info here | |
url: http://geojson.org/geojson-spec.html#geometry-objects | |
schemes: | |
- http | |
host: myHost | |
basePath: /v1 | |
consumes: | |
- "application/json" | |
produces: | |
- "application/json" | |
securityDefinitions: | |
UserSecurity: | |
type: basic | |
# AdminSecurity: | |
# type: basic | |
# MediaSecurity: | |
# type: basic | |
#globalmente e' userSecurity ma posso cambiare localmente | |
security: | |
- UserSecurity: [] | |
paths: | |
/geometries: | |
get: | |
summary: GeoJSON geometry array | |
responses: | |
200: | |
description: Successful response | |
schema: | |
type: array | |
items: | |
$ref: "#/definitions/GeometryCollection" | |
400: | |
$ref: "#/responses/BadRequest400ErrorResponse" | |
401: | |
$ref: "#/responses/Unauthorized401ErrorResponse" | |
500: | |
$ref: "#/responses/Standard500ErrorResponse" | |
post: | |
summary: Create new geometry | |
parameters: | |
- name: geom | |
in: body | |
required: true | |
schema: | |
$ref: "#/definitions/Geometry" | |
responses: | |
201: | |
description: new geometry created | |
400: | |
$ref: "#/responses/BadRequest400ErrorResponse" | |
401: | |
$ref: "#/responses/Unauthorized401ErrorResponse" | |
403: | |
$ref: "#/responses/Forbidden403ErrorResponse" | |
500: | |
$ref: "#/responses/Standard500ErrorResponse" | |
definitions: | |
Error: | |
required: | |
- code | |
- message | |
properties: | |
code: | |
type: string | |
message: | |
type: string | |
Geometry: | |
type: object | |
description: GeoJSon geometry | |
discriminator: type | |
required: | |
- type | |
externalDocs: | |
url: http://geojson.org/geojson-spec.html#geometry-objects | |
properties: | |
type: | |
type: string | |
enum: | |
- Point | |
- LineString | |
- Polygon | |
- MultiPoint | |
- MultiLineString | |
- MultiPolygon | |
description: the geometry type | |
Point2D: | |
type: array | |
maxItems: 2 | |
minItems: 2 | |
items: | |
type: number | |
Point: | |
type: object | |
description: GeoJSon geometry | |
externalDocs: | |
url: http://geojson.org/geojson-spec.html#id2 | |
allOf: | |
- $ref: "#/definitions/Geometry" | |
- properties: | |
coordinates: | |
$ref: '#/definitions/Point2D' | |
LineString: | |
type: object | |
description: GeoJSon geometry | |
externalDocs: | |
url: http://geojson.org/geojson-spec.html#id3 | |
allOf: | |
- $ref: "#/definitions/Geometry" | |
- properties: | |
coordinates: | |
type: array | |
items: | |
$ref: '#/definitions/Point2D' | |
Polygon: | |
type: object | |
description: GeoJSon geometry | |
externalDocs: | |
url: http://geojson.org/geojson-spec.html#id4 | |
allOf: | |
- $ref: "#/definitions/Geometry" | |
- properties: | |
coordinates: | |
type: array | |
items: | |
type: array | |
items: | |
$ref: '#/definitions/Point2D' | |
MultiPoint: | |
type: object | |
description: GeoJSon geometry | |
externalDocs: | |
url: http://geojson.org/geojson-spec.html#id5 | |
allOf: | |
- $ref: "#/definitions/Geometry" | |
- properties: | |
coordinates: | |
type: array | |
items: | |
$ref: '#/definitions/Point2D' | |
MultiLineString: | |
type: object | |
description: GeoJSon geometry | |
externalDocs: | |
url: http://geojson.org/geojson-spec.html#id6 | |
allOf: | |
- $ref: "#/definitions/Geometry" | |
- properties: | |
coordinates: | |
type: array | |
items: | |
type: array | |
items: | |
$ref: '#/definitions/Point2D' | |
MultiPolygon: | |
type: object | |
description: GeoJSon geometry | |
externalDocs: | |
url: http://geojson.org/geojson-spec.html#id6 | |
allOf: | |
- $ref: "#/definitions/Geometry" | |
- properties: | |
coordinates: | |
type: array | |
items: | |
type: array | |
items: | |
type: array | |
items: | |
$ref: '#/definitions/Point2D' | |
GeometryCollection: | |
type: object | |
description: GeoJSon geometry collection | |
required: | |
- type | |
- geometries | |
externalDocs: | |
url: http://geojson.org/geojson-spec.html#geometrycollection | |
properties: | |
type: | |
type: string | |
enum: | |
- GeometryCollection | |
geometries: | |
type: array | |
items: | |
$ref: '#/definitions/Geometry' | |
responses: | |
Standard500ErrorResponse: | |
description: An unexpected error occured. | |
schema: | |
$ref: "#/definitions/Error" | |
BadRequest400ErrorResponse: | |
description: The JSON is not valid | |
schema: | |
$ref: "#/definitions/Error" | |
Unauthorized401ErrorResponse: | |
description: The request requires an user authentication | |
schema: | |
$ref: "#/definitions/Error" | |
Forbidden403ErrorResponse: | |
description: the access is not allowed | |
schema: | |
$ref: "#/definitions/Error" | |
# NotFound404ErrorResponse: | |
# description: not found check the path or the query | |
# schema: | |
# $ref: "#/definitions/Error" | |
# Ok200Response: | |
# description: Eyerything is working | |
# schema: | |
# $ref: "#/definitions/OK" | |
# Create201Response: | |
# description: New resource has been created | |
# schema: | |
# $ref: "#/definitions/OK" | |
# Delete204Response: | |
# description: The resource was successfully deleted | |
# schema: | |
# $ref: "#/definitions/OK" |
Very nice schema. But geometries are enclosed in Features. What about features?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @idkw for the fix :)