Conversation
8390b04 to
ec20854
Compare
ec20854 to
b2a94e4
Compare
b2a94e4 to
daced4a
Compare
daced4a to
5ac618e
Compare
5ac618e to
99d8a25
Compare
99d8a25 to
b411532
Compare
- Update WorkspaceBindings to use new error
- Update Move and Copy to consistently use java.nio.Files instead of a mix of java.nio.Files and java.io.File - Update thrown exceptions list for accuracy
- Will no longer include METADATA type files in response - Made RenderType in charge of the Aerie Metadata type for the backend, as that extension is expected to be fairly constant - Remove unneeded Optional wrapper from `listFiles` method
- No longer updates `lastEditedBy` when the metadata is updated (unless that field is missing)
- Move user setup to before tests are run - Move shared User objects to the User helper class - Move APIResponse Body Parser to RequestBodyHelper
…d as readonly - move exceptions into "Exceptions" package
Error Responses were not using the provided Javax serializer on the single item endpoints due to already being converted to JsonObject
Was only running Copy instructions if the user did not have sufficient permissions
- add missing 500 logs to copy/delete
- do not restrict folder rename
dandelany
left a comment
There was a problem hiding this comment.
Reviewed with @Mythicaeda - minor comments added.
Still in progress: reviewing Test files and doing some more backend testing locally
|
|
||
| // Validate that the optional keys have the correct type, if they're present | ||
| if (metadata.containsKey("readOnly")) { | ||
| readOnly = metadata.getBoolean("readOnly"); |
There was a problem hiding this comment.
It feels weird to be setting this important piece of state only as a side-effect of a method called validate - can we move this up to the constructor after the validateMetadata call?
| @@ -0,0 +1,43 @@ | |||
| package gov.nasa.jpl.aerie.e2e.utils; | |||
There was a problem hiding this comment.
let's add a comment to this file to note it gets auto-loaded by the launcher session listener file
| * - "deep": deep merge JSON Object params (combine nested properties) | ||
| * - "shallow": shallow merge of JSON Object params (combine only top-level properties) | ||
| * - "overwrite": replace JSON Object params with the new value, if provided | ||
| * Defaults to "deep" if not provided |
There was a problem hiding this comment.
should say 'defaults to shallow'
| * If the metadata files contents are malformed, returns a 500 error response | ||
| * If the user passes a malformed set of keys (including non-existent top-level keys or a non-json object "user" field), returns a 400 error. | ||
| * | ||
| * Also takes in a query param "mergeBehavior", which can be one of "deep", "shallow", and "overwrite". Behavior is as follows: |
There was a problem hiding this comment.
note that this part is only applicable to the user object, and eg. doesn't overwrite the entire metadata object
|
|
||
| // Check that the underlying file exists | ||
| if (!workspaceService.checkFileExists(pathInfo.workspaceId, pathInfo.filePath)) { | ||
| context.status(404).json(new FormattedError(new NoSuchFileException(pathInfo.workspaceId, pathInfo.filePath))); |
There was a problem hiding this comment.
let's remove the check for the underlying file here, since this could be a useful endpoint for cleaning up "orphan" metadata files
|
|
||
| boolean success = true; | ||
| private boolean isReadOnly(final Path repoPath, final Path filePath) |
There was a problem hiding this comment.
dedupe this with the previous function & have one call the other
| // Fill in "created" information, using the "metadataLastEdited" information as a fallback | ||
| contents.createdBy().ifPresentOrElse( | ||
| c -> generator.write("createdBy", c), | ||
| () -> generator.write("createdBy", contents.metadataLastEditedBy())); |
There was a problem hiding this comment.
try and use lastEditedBy as fallback before metadataLastEditedBy
| ) throws JsonException { | ||
| final var mergedBuilder = new MetadataUpdates.Builder(updates.metadataLastEditedBy(), updates.metadataLastEditedAt()); | ||
|
|
||
| // Upsert the fields, skipping "lastEditedAt" and "lastEditedBy" (as they're already set), |
There was a problem hiding this comment.
should say "skipping metadataLastEditedBy and metadataLastEditedBy"
| MetadataUpdates updates, | ||
| MetadataMergeBehavior mergeBehavior | ||
| ) throws JsonException { | ||
| final var mergedBuilder = new MetadataUpdates.Builder(updates.metadataLastEditedBy(), updates.metadataLastEditedAt()); |
There was a problem hiding this comment.
add comment/note that these are fallbacks only representing the metadata file changed time
| final var userObject = fileContentsBuilder.getUser(); | ||
| if (userObject == null) continue; | ||
|
|
||
| final var path = new ArrayList<>(Arrays.asList(key.split("\\."))); |
There was a problem hiding this comment.
let's have a comment somewhere (eg. in service interface file) that explains that nested keys are supported by that API
|
Comments have been addressed in the 6 newest commits |
Description
.aerieto.meta.seqdevlistContentsendpoint to hideMETADATA-type files by default, and to provide the contents of the metadata files if thewithMetadataflag is providedVerification
I'd like to add some tests that focus on the contents of the metadata files, and how they're reconstructed after deletion, as well as basic bindings tests for the endpoints.
Documentation
No docs are invalidated, but we should add documenting these new endpoints to writing docs for the other workspace server endpoints
Future work