-
Notifications
You must be signed in to change notification settings - Fork 1
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
Ability to add and update SSP Impl Req #94
Conversation
- Created an `OscalSspImplReqMarshallerImpl` - Updated `IterableAssemblyClassBinding` to define a list of `secondaryRootObjects` that will 'trick' the deserializer to allow as root objects - Updated `BaseOscalObjectMarshallerLiboscalImpl` to be able to create deserializer with `IterableAssemblyClassBinding` - Updated `SspController` and tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so love this. I started to take a look at doing this and got a little put off (overwhelmed) by the fact this was the first time we're really handling any sort of non-universal "inner" elements (because like we play with UUID and Metadata but everything root has one of those). So not only is this cool because I want this feature but I think this is cool because it's a really good starting point for all the features to come which is really exciting.
Nothing here is concerning enough to me to block merging but I do want to ask a few questions to make sure I understand what's going on before I fully approve (and of course, while I was making comments anyway, I made fun of Java once or twice).
...mons/src/main/java/com/easydynamics/oscal/data/marshalling/IterableAssemblyClassBinding.java
Outdated
Show resolved
Hide resolved
...mons/src/main/java/com/easydynamics/oscal/data/marshalling/IterableAssemblyClassBinding.java
Outdated
Show resolved
Hide resolved
...mons/src/main/java/com/easydynamics/oscal/data/marshalling/IterableAssemblyClassBinding.java
Outdated
Show resolved
Hide resolved
oscal-rest-service-app/src/main/java/com/easydynamics/oscalrestservice/api/SspController.java
Show resolved
Hide resolved
...mons/src/main/java/com/easydynamics/oscal/data/marshalling/IterableAssemblyClassBinding.java
Outdated
Show resolved
Hide resolved
oscal-rest-service-app/src/main/java/com/easydynamics/oscalrestservice/api/SspController.java
Show resolved
Hide resolved
oscal-rest-service-app/src/main/java/com/easydynamics/oscalrestservice/api/SspController.java
Show resolved
Hide resolved
...-app/src/main/java/com/easydynamics/oscalrestservice/api/OscalControllerExceptionAdvice.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #95 for issues around spec compliance. It was a little too cumbersome to add as suggestions directly in this PR.
Separate the implementation of the POST endpoint (that adds a new Impl Req) and the PUT endpoint (that updates existing Impl Reqs) into two functions. This is done to match the API spec which specifies different parameters for the two endpoints; the POST endpoint does not need the Impl Req ID.
Update the tests to accomodate the changes to the POST SSP Impl Req endpoint's parameters
Resolve linter complaints on SSP Impl Req implementation and tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Works great in my local Docker deployment.
Only a couple notes.
.orElse(null); | ||
} | ||
if (existingImplReq != null && isCreateOnly) { | ||
throw new OscalObjectConflictException("Implented Requirement already exists"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new OscalObjectConflictException("Implented Requirement already exists"); | |
throw new OscalObjectConflictException("Implemented Requirement already exists"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
oscal-rest-service-app/src/main/java/com/easydynamics/oscalrestservice/api/SspController.java
Outdated
Show resolved
Hide resolved
@@ -23,13 +35,17 @@ | |||
@RequestMapping(path = "/oscal/v1") | |||
@RestController | |||
public class SspController extends BaseOscalController<SystemSecurityPlan> { | |||
private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
private final OscalObjectMarshaller<ImplementedRequirement> oscalSspImplReqtMarshaller; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private final OscalObjectMarshaller<ImplementedRequirement> oscalSspImplReqtMarshaller; | |
private final OscalObjectMarshaller<ImplementedRequirement> oscalSspImplReqMarshaller; |
Maybe change this to match the naming convention of "Impl Req" used elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed
@PostMapping(value = "/system-security-plans/{id}/control-implementation/" | ||
+ "implemented-requirements/{implementedRequirementId}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per the API spec, the POST request does not include the implementedRequirementID
as a parameter.
Kind of annoying because the ID validation cannot happen in the marshaller - the functionality probably needs to be separated between the POST and PUT.
Per my comment about the POST endpoint parameters, see the commits I just pushed for a potential way to separate out the POST and PUT endpoints. If we want a different way or to change the API spec I can revert |
Per the specification, we must return the _new_ implemented requirement object; not the entire SSP. We can add somewhat more generic versions of the existing `makeXxxResponse` methods for this use case (and we can leave the old implementations as more convenient wrappers for the root object types).
Only return the new implemented requirement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your changes! This looks good as far as I can tell. We still need to see why the Viewer doesn't update after a PUT but right now I'm not sure anyone else has reproduced that behavior and it also feels more likely to be a viewer bug.
|
OscalSspImplReqMarshallerImpl
IterableAssemblyClassBinding
to define a list ofsecondaryRootObjects
that will 'trick' the deserializer to allow asroot objects
BaseOscalObjectMarshallerLiboscalImpl
to be able to createdeserializer with
IterableAssemblyClassBinding
SspController
and testsCloses #57
Closes #58