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

docs: updates README.md usage snippet #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Below is a table to show what is currently supported by the SDK.
| SDK Functionality | Supported |
|-------------------------------------------|--------------------|
| OSCAL Types with Basic Trestle Extensions | :heavy_check_mark: |
| OSCAL Schema Validation | :x: |
| OSCAL Schema Validation | :heavy_check_mark: |
| Target Components Extension | :x: |
| Multiple Parameters per Rule | :x: |
| OSCAL to OSCAL Transformation | :heavy_check_mark: |
Expand All @@ -40,19 +40,20 @@ go get github.com/oscal-compass/oscal-sdk-go

```go
import (
...
...
oscalTypes "github.com/defenseunicorns/go-oscal/src/types/oscal-1-1-2"
"github.com/oscal-compass/oscal-sdk-go/validation"

"github.com/oscal-compass/oscal-sdk-go/generators"
"github.com/oscal-compass/oscal-sdk-go/models"
"github.com/oscal-compass/oscal-sdk-go/transformers"
)

func main() {
file, err := os.Open("path-to-my-compdef")
file, err := os.Open("example-component-definition.json")
if err != nil {
log.Fatalf("failed to open component definition, %v", err)
}
definition, err := generators.NewComponentDefinition(file)
definition, err := models.NewComponentDefinition(file, validation.NoopValidator{})
if err != nil {
log.Fatalf("failed to read component definition, %v", err)
}
Expand All @@ -66,7 +67,7 @@ func main() {
if err != nil {
log.Fatalf("failed to marshal assessment plan, %v", err)
}
fmt.Println(assessmentPlanJSON)
fmt.Println(string(assessmentPlanJSON))
}
}
```
Expand Down