-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Atomic Operations Support (#2979)
* Add atomic operations extension * Add test dsl. * Fix tests * Add operations to json api endpoint * Fix delete case with no data * Fix don't wrap runtimeexception in another runtimeexception * Add life cycle tests * Add tests for json api atomic operations mapper * Add tests for relationship * Add tests for invalid input * Add dsl and tests for local id * Fix tests * Adds ability to customize the object mapper used by the JsonApiMapper * Refactor naming * Add tests * Add standalone test * Handle media type parameters according to spec * Verify responses * Infer ref only for add and update resource. * Use id for remove resource * Add ResourceIT tests * Add lid to resource and tests for lid * Change ref to href * Set id when lid set * Add json api lid test case * Ref cannot be explicitly specified when creating resources * Validate ref and href mutually exclusive * Atomic operations result may contain meta * Add lid test * Validate ref cannot have both id and lid specified * Update error messages for consistency * Update ResourceIT lid test * Add dsl tests * Update error message * Add native hints * Fix test
- Loading branch information
1 parent
a23401f
commit e570df5
Showing
106 changed files
with
6,253 additions
and
314 deletions.
There are no files selected for viewing
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
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
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
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
32 changes: 32 additions & 0 deletions
32
...-core/src/main/java/com/yahoo/elide/core/exceptions/JsonApiAtomicOperationsException.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright 2016, Yahoo Inc. | ||
* Licensed under the Apache License, Version 2.0 | ||
* See LICENSE file in project root for terms. | ||
*/ | ||
package com.yahoo.elide.core.exceptions; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import org.apache.commons.lang3.tuple.Pair; | ||
|
||
/** | ||
* Exception describing error caused from JSON API Atomic Extension request. | ||
*/ | ||
public class JsonApiAtomicOperationsException extends HttpStatusException { | ||
private static final long serialVersionUID = 1L; | ||
private final Pair<Integer, JsonNode> response; | ||
|
||
public JsonApiAtomicOperationsException(int status, final JsonNode errorNode) { | ||
super(status, ""); | ||
response = Pair.of(status, errorNode); | ||
} | ||
|
||
@Override | ||
public Pair<Integer, JsonNode> getErrorResponse() { | ||
return response; | ||
} | ||
|
||
@Override | ||
public Pair<Integer, JsonNode> getVerboseErrorResponse() { | ||
return response; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
elide-core/src/main/java/com/yahoo/elide/jsonapi/JsonApi.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright 2023, the original author or authors. | ||
* Licensed under the Apache License, Version 2.0 | ||
* See LICENSE file in project root for terms. | ||
*/ | ||
package com.yahoo.elide.jsonapi; | ||
|
||
/** | ||
* JSON:API. | ||
*/ | ||
public class JsonApi { | ||
private JsonApi() { | ||
} | ||
public static final String MEDIA_TYPE = "application/vnd.api+json"; | ||
|
||
public static class JsonPatch { | ||
private JsonPatch() { | ||
} | ||
|
||
public static final String MEDIA_TYPE = "application/vnd.api+json; ext=jsonpatch"; | ||
} | ||
|
||
public static class AtomicOperations { | ||
private AtomicOperations() { | ||
} | ||
|
||
public static final String MEDIA_TYPE = "application/vnd.api+json; ext=\"https://jsonapi.org/ext/atomic\""; | ||
} | ||
} |
Oops, something went wrong.