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

Change GeoJSON to be used for f=json, add f=elastic-json for old format #119

Merged
merged 5 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public GnMediaType(String type) {
public static final String APPLICATION_GEOJSON_VALUE = "application/geo+json";
public static final MediaType APPLICATION_GEOJSON;

public static final String APPLICATION_ELASTICJSON_VALUE = "application/elastic+json";
public static final MediaType APPLICATION_ELASTICJSON;


static {
TEXT_TURTLE = new MediaType("text", "turtle");
Expand All @@ -55,5 +58,6 @@ public GnMediaType(String type) {
APPLICATION_GN_XML = new MediaType("application", "gn+xml");
APPLICATION_JSON_LD = new MediaType("application", "ld+json");
APPLICATION_GEOJSON = new MediaType("application", "geo+json");
APPLICATION_ELASTICJSON = new MediaType("application", "elastic+json");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
APPLICATION_ELASTICJSON = new MediaType("application", "elastic+json");
APPLICATION_ELASTICJSON = new MediaType("application", "gnindex+json");

maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @fxprunayre - I've changed it to "gnindex+json".

Thanks for the review - its really really helpful!

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ gn:
-
name: json
mimeType: application/json
responseProcessor: JsonUserAndSelectionAwareResponseProcessorImpl
responseProcessor: GeoJsonResponseProcessorImpl
operations:
- root
- conformance
Expand Down Expand Up @@ -111,6 +111,12 @@ gn:
responseProcessor: RssResponseProcessorImpl
operations:
- items
- name : elastic-json
mimeType : application/elastic+json
responseProcessor : JsonUserAndSelectionAwareResponseProcessorImpl
operations :
- items
- item
-
name : geojson
mimeType : application/geo+json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public class ItemApiController {
GnMediaType.APPLICATION_RDF_XML_VALUE,
GnMediaType.APPLICATION_DCAT2_XML_VALUE,
GnMediaType.TEXT_TURTLE_VALUE,
GnMediaType.APPLICATION_GEOJSON_VALUE})
GnMediaType.APPLICATION_GEOJSON_VALUE,
GnMediaType.APPLICATION_ELASTICJSON_VALUE})
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Describe a collection item.")
Expand Down Expand Up @@ -216,6 +217,7 @@ public ResponseEntity<Void> collectionsCollectionIdItemsRecordIdGet(
GnMediaType.APPLICATION_DCAT2_XML_VALUE,
MediaType.TEXT_HTML_VALUE,
GnMediaType.APPLICATION_GEOJSON_VALUE,
GnMediaType.APPLICATION_ELASTICJSON_VALUE
})
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
Expand Down Expand Up @@ -284,11 +286,19 @@ public ResponseEntity<Void> collectionsCollectionIdItemsGet(
|| mediaType.equals(GnMediaType.APPLICATION_DCAT2_XML)
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
|| mediaType.equals(MediaType.APPLICATION_RSS_XML)
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)) {
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)
|| mediaType.equals(GnMediaType.APPLICATION_ELASTICJSON)) {

boolean allSourceFields =
mediaType.equals(GnMediaType.APPLICATION_DCAT2_XML)
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML);
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)
|| mediaType.equals(GnMediaType.APPLICATION_JSON_LD)
|| mediaType.equals(MediaType.APPLICATION_JSON)
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
|| mediaType.equals(GnMediaType.APPLICATION_ELASTICJSON);


return collectionsCollectionIdItemsGetInternal(
query,
Expand Down