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

Ability to add and update SSP Impl Req #94

Merged
merged 8 commits into from
May 20, 2022
Merged

Conversation

rgauss
Copy link
Contributor

@rgauss rgauss commented May 12, 2022

  • 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

Closes #57
Closes #58

- 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
@rgauss rgauss requested a review from a team May 12, 2022 17:53
Copy link
Contributor

@laurelmay laurelmay left a 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).

@rgauss rgauss requested a review from laurelmay May 13, 2022 12:04
@laurelmay laurelmay requested a review from a team May 13, 2022 21:04
Copy link
Contributor

@laurelmay laurelmay left a 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
Copy link
Contributor

@hreineck hreineck left a 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");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
throw new OscalObjectConflictException("Implented Requirement already exists");
throw new OscalObjectConflictException("Implemented Requirement already exists");

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed

@@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private final OscalObjectMarshaller<ImplementedRequirement> oscalSspImplReqtMarshaller;
private final OscalObjectMarshaller<ImplementedRequirement> oscalSspImplReqMarshaller;

Maybe change this to match the naming convention of "Impl Req" used elsewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Addressed

Comment on lines 183 to 184
@PostMapping(value = "/system-security-plans/{id}/control-implementation/"
+ "implemented-requirements/{implementedRequirementId}",
Copy link
Contributor

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.

@hreineck
Copy link
Contributor

hreineck commented May 14, 2022

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

Kyle Laker and others added 3 commits May 14, 2022 21:19
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
Copy link
Contributor

@laurelmay laurelmay left a 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.

@rgauss
Copy link
Contributor Author

rgauss commented May 18, 2022

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.

@kylelaker, see EasyDynamics/oscal-react-library#396

@rgauss rgauss requested a review from a team May 18, 2022 19:40
@rgauss rgauss merged commit f771520 into develop May 20, 2022
@rgauss rgauss deleted the feature/update-ssp-impl-req branch May 20, 2022 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants