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

Clarifying comments in checklist-mapper file #6654

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions libs/hdf-converters/src/ckl-mapper/checklist-mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,28 @@ function getHdfSpecificDataAttribute(
}

/**
* ChecklistResults is a wrapper for ChecklistMapper using the intakeType
* default returns a single hdf object without any modifications
* split returns multiple hdf object based on number of iSTIG objects in checklist
* wrapper returns a single hdf object with an additional profile created using file name as profile name and adds parent_profile key to each mapped profile
* The `ChecklistResults` class extends the `ChecklistJsonixConverter` and is responsible for converting
* checklist data between different formats (XML CKL, HDF JSON).
*
* @extends ChecklistJsonixConverter
*
* @property {string | ExecJSON.Execution} data - The input data, which can be a string of XML data or an HDF JSON execution object.
* @property {Checklist} jsonixData - The JSON representation of the checklist data.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd revise this statement to explain better that it's like the jsonix, direct conversion of the ckl, js checklist data in comparison to the intermediate representation which cleans it up and makes it easier to use.

* @property {ChecklistObject} checklistObject - The intermediate object representation of the checklist data.
* @property {boolean} withRaw - A flag indicating whether to include raw data in the output.
*
* @constructor
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we defining the constructor parameters both here and on top of the constructor?

* @param {string | ExecJSON.Execution} data - The input data, which can be a string of XML data or an HDF JSON execution object.
* @param {boolean} [withRaw=false] - Optional flag indicating whether to include raw data in the output.
*
* @method getJsonix
Copy link
Contributor

Choose a reason for hiding this comment

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

should this info be here or directly on top of the corresponding function?

* @returns {Checklist} - Returns the JSON representation of the checklist data.
*
* @method toCkl
* @returns {string} - Converts the checklist data to CKL (Checklist) XML format.
Copy link
Contributor

Choose a reason for hiding this comment

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

converts the jsonix json representation of the ckl data into the xml format

*
* @method toHdf
* @returns {ExecJSON.Execution} - Converts the checklist data to HDF (Heimdall Data Format).
Copy link
Contributor

Choose a reason for hiding this comment

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

converts the intermediate format ckl data into hdf

*/
export class ChecklistResults extends ChecklistJsonixConverter {
data: string | ExecJSON.Execution;
Expand All @@ -308,8 +326,12 @@ export class ChecklistResults extends ChecklistJsonixConverter {
withRaw: boolean;

/**
* Creates instance of ChecklistResult object because ChecklistMapper uses the intermediate ChecklistObject to create HDF mapping
* @param checklistXml - string of xml data
* @param {string | ExecJSON.Execution} data - The input data, which can be either an HDF JSON object
* or an XML CKL string, depending on the direction of the conversion.
* @param {boolean} [withRaw=false] - A flag indicating whether to include raw data in the output.
* Defaults to false.
*
* @throws Will throw an error if the asset metadata is invalid.
*/
constructor(data: string | ExecJSON.Execution, withRaw = false) {
super(jsonixMapping);
Expand Down
Loading