Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust link templates #876

Merged
merged 2 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions core/openapi/ogcapi-features-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ components:
- href: http://example.com/concepts/buildings.html
rel: describedby
type: text/html
linkTemplates:
type: array
items:
$ref: "#/components/schemas/linkTemplate"
extent:
$ref: "#/components/schemas/extent"
itemType:
Expand Down Expand Up @@ -442,6 +446,25 @@ components:
example: Trierer Strasse 70, 53115 Bonn
length:
type: integer
linkTemplate:
type: object
required:
- uriTemplate
- rel
properties:
uriTemplate:
type: string
example: https://data.example.org/collections/buildings/items/{featureId}
rel:
type: string
title:
type: string
example: Link template for building features
type:
type: string
example: application/geo+json
varBase:
type: string
multilinestringGeoJSON:
type: object
required:
Expand Down
4 changes: 4 additions & 0 deletions core/openapi/schemas/collection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ properties:
- href: http://example.com/concepts/buildings.html
rel: describedby
type: text/html
linkTemplates:
type: array
items:
$ref: linkTemplate.yaml
extent:
$ref: extent.yaml
itemType:
Expand Down
32 changes: 10 additions & 22 deletions core/openapi/schemas/link.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
type: object
required:
- href
- rel
properties:
href:
type: string
example: http://data.example.com/buildings/123
rel:
type: string
example: alternate
type:
type: string
example: application/geo+json
hreflang:
type: string
example: en
title:
type: string
example: Trierer Strasse 70, 53115 Bonn
length:
type: integer
allOf:
- $ref: 'linkBase.yaml'
- type: object
required:
- href
properties:
href:
type: string
description: The URI of the link target.
example: http://data.example.com/buildings/123
30 changes: 30 additions & 0 deletions core/openapi/schemas/linkBase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
type: object
required:
- rel
properties:
rel:
type: string
description: The type or semantics of the relation.
example: alternate
type:
type: string
description:
A hint indicating what the media type of the
result of dereferencing the link should be.
example: application/geo+json
hreflang:
type: string
description:
A hint indicating what the language of the
result of dereferencing the link should be.
example: en
title:
type: string
description:
Used to label the destination of a link
such that it can be used as a human-readable
identifier.
example: "Trierer Strasse 70, 53115 Bonn"
length:
type: integer
20 changes: 20 additions & 0 deletions core/openapi/schemas/linkTemplate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
allOf:
- $ref: 'linkBase.yaml'
- type: object
required:
- uriTemplate
properties:
uriTemplate:
type: string
description:
Supplies a URI template that when expanded using
a set of variables, results in a URI.
example: http://data.example.com/buildings/{building-id}
varBase:
type: string
description:
The base URI to which the variable name can be
appended to retrieve the definition of the
variable as a JSON Schema fragment.
format: uri-reference
10 changes: 6 additions & 4 deletions core/standard/clause_7_core.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -657,15 +657,17 @@ Reference system information is not provided as the service provides geometries
{ "href": "https://data.example.org/collections/buildings/items",
"rel": "items", "type": "application/geo+json",
"title": "Buildings" },
{ "href": "https://data.example.org/collections/buildings/items/{featureId}",
"rel": "item", "title": "Link template for building features",
"templated": true },
{ "href": "https://creativecommons.org/publicdomain/zero/1.0/",
"rel": "license", "type": "text/html",
"title": "CC0-1.0" },
{ "href": "https://creativecommons.org/publicdomain/zero/1.0/rdf",
"rel": "license", "type": "application/rdf+xml",
"title": "CC0-1.0" }
],
"linkTemplates": [
{ "uriTemplate": "https://data.example.org/collections/buildings/items/{featureId}",
"rel": "item", "title": "Link template for building features",
"varBase": "https://data.example.org/collections/buildings/var-base/" }
]
}
]
Expand All @@ -690,7 +692,7 @@ link: <https://data.example.org/collections/buildings>; anchor="#/collections/0"
link: <https://data.example.org/collections/buildings/items>; anchor="#/collections/0"; rel="items"; type="application/geo+json"; title="Buildings"
link: <https://creativecommons.org/publicdomain/zero/1.0/>; anchor="#/collections/0"; rel="license"; type="text/html"; title="CC0-1.0"
link: <https://creativecommons.org/publicdomain/zero/1.0/rdf>; anchor="#/collections/0"; rel="license"; type="application/rdf+xml"; title="CC0-1.0"
link-template: <https://data.example.org/collections/buildings/items/{featureId}>; anchor="#/collections/0"; rel="item"; title="Link template for buildung features"
link-template: <https://data.example.org/collections/buildings/items/{featureId}>; anchor="#/collections/0"; rel="item"; title="Link template for buildung features"; var-base="https://data.example.org/collections/buildings/var-base/"
vary: Accept,Accept-Language,Accept-Encoding
content-length: 6178
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[width="90%",cols="2,6a"]
|===
^|*Recommendation {counter:rec-id}* |*/rec/core/fc-md-item-link-templates*
^|A |For each feature collection included in the response, the `links` property of the collection SHOULD include a link template to the URI of the features (relation: `item`).
^|B |The link template SHALL be encoded as a Link object with a property `templated` set to `true` and the URI template in `href`.
^|A |For each feature collection included in the response, the `linkTemplates` property of the collection SHOULD include a link template to the URI of the features (relation: `item`).
^|B |The link template SHALL be encoded as a LinkTemplate object with the URI template in `uriTemplate`.
^|C |If links are included in `Link` HTTP headers of the response, the link templates SHOULD also be included in `Link-Template` HTTP headers according to the https://datatracker.ietf.org/doc/draft-ietf-httpapi-link-template/[draft "The Link-Template HTTP Header Field" specification].
|===