From a9831c13caa930233119d238ed6a978ce0cc7d20 Mon Sep 17 00:00:00 2001 From: ivan-gomes Date: Sat, 27 Mar 2021 23:20:24 -0700 Subject: [PATCH] ST5AS-120 Re-inline @context and respond with JSON (non-LD) by default --- app/controllers/BaseController.java | 4 ++-- public/swagger/openapi.yaml | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/BaseController.java b/app/controllers/BaseController.java index 063c273a..01171b28 100644 --- a/app/controllers/BaseController.java +++ b/app/controllers/BaseController.java @@ -44,7 +44,7 @@ public abstract class BaseController extends Controller { - protected static final boolean INLINE_JSON_LD_CONTEXT_DEFAULT = false; + protected static final boolean INLINE_JSON_LD_CONTEXT_DEFAULT = true; protected static final boolean INLINE_JSON_LD_CONTEXT = Optional.ofNullable(System.getenv("INLINE_JSON_LD_CONTEXT")) .map(Boolean::parseBoolean) .orElse(INLINE_JSON_LD_CONTEXT_DEFAULT); @@ -178,6 +178,6 @@ protected static JsonLdMofObjectAdornment adornMofObject(MofObject mof, Http.Req } protected static boolean respondWithJsonLd(Http.Request request) { - return request.accepts(JSONLD_MIME_TYPE); + return request.accepts(JSONLD_MIME_TYPE) && !request.accepts(Http.MimeTypes.JSON); } } diff --git a/public/swagger/openapi.yaml b/public/swagger/openapi.yaml index da550a65..d855f8b2 100644 --- a/public/swagger/openapi.yaml +++ b/public/swagger/openapi.yaml @@ -270,8 +270,8 @@ paths: operationId: getElementsByProjectCommit summary: Get elements by project and commit produces: - - application/ld+json - application/json + - application/ld+json responses: 200: description: Ok @@ -313,8 +313,8 @@ paths: operationId: getElementByProjectCommitId summary: Get element by project, commit and ID produces: - - application/ld+json - application/json + - application/ld+json responses: 200: description: Ok @@ -364,8 +364,8 @@ paths: operationId: getRootsByProjectCommit summary: Get root elements by project and commit produces: - - application/ld+json - application/json + - application/ld+json responses: 200: description: Ok @@ -433,8 +433,8 @@ paths: operationId: getRelationshipsByProjectCommitRelatedElement summary: Get relationships by project, commit, and related element produces: - - application/ld+json - application/json + - application/ld+json responses: 200: description: Ok @@ -580,8 +580,8 @@ paths: operationId: getQueryResultsByProjectIdQueryId summary: Get query results by project and query produces: - - application/ld+json - application/json + - application/ld+json responses: 200: description: Ok @@ -619,8 +619,8 @@ paths: consumes: - application/json produces: - - application/ld+json - application/json + - application/ld+json parameters: - in: body name: body @@ -651,8 +651,8 @@ paths: consumes: - application/json produces: - - application/ld+json - application/json + - application/ld+json parameters: - in: body name: body