You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/site/markdown/guides/cli-reference.md.vm
+28-19Lines changed: 28 additions & 19 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
# CLI Reference
2
2
3
-
Complete reference for all oscal-cli commands.
3
+
This page provides a complete reference for all oscal-cli commands and options. For task-oriented guides, see the individual guide pages linked at the bottom.
4
4
5
5
## Global Options
6
6
7
-
These options are available for all commands:
7
+
These options work with any command and control the general behavior of the CLI:
8
8
9
9
| Option | Description |
10
-
|--------|-------------|
10
+
|:-------|:------------|
11
11
| `--help`, `-h` | Show help for any command |
12
12
| `--version`, `-V` | Show version information |
13
13
| `--show-stack-trace` | Show detailed error information |
The CLI recognizes these OSCAL document types automatically:
208
+
The CLI automatically detects the document type by examining the root element. You don't need to specify the document type—validation and conversion work for all types:
209
209
210
210
| Type | Root Element |
211
-
|------|--------------|
211
+
|:-----|:-------------|
212
212
| Catalog | `catalog` |
213
213
| Profile | `profile` |
214
+
| Mapping | `mapping-collection` |
214
215
| System Security Plan | `system-security-plan` |
215
216
| Component Definition | `component-definition` |
216
217
| Assessment Plan | `assessment-plan` |
@@ -219,10 +220,10 @@ The CLI recognizes these OSCAL document types automatically:
219
220
220
221
## Format Detection
221
222
222
-
File formats are detected by extension:
223
+
The CLI determines input format from the file extension. This works for most cases:
223
224
224
225
| Extension | Format |
225
-
|-----------|--------|
226
+
|:----------|:-------|
226
227
| `.xml` | XML |
227
228
| `.json` | JSON |
228
229
| `.yaml`, `.yml` | YAML |
@@ -231,23 +232,29 @@ Use `--as` to override detection for files with non-standard extensions.
231
232
232
233
## Environment Variables
233
234
235
+
The CLI respects standard Java environment variables for configuration:
236
+
234
237
| Variable | Description |
235
-
|----------|-------------|
238
+
|:---------|:------------|
236
239
| `JAVA_HOME` | Java installation directory |
237
240
| `JAVA_OPTS` | JVM options (e.g., `-Xmx2g`) |
238
241
239
242
## Container Reference
240
243
244
+
When using Docker, the following tags and options are available:
245
+
241
246
### Image Tags
242
247
243
248
| Tag | Description |
244
-
|-----|-------------|
249
+
|:----|:------------|
245
250
| `latest` | Latest stable release |
246
251
| `x.y.z` | Specific version |
247
252
| `develop` | Latest development build |
248
253
249
254
### Volume Mounting
250
255
256
+
Mount local directories to make your files accessible inside the container:
257
+
251
258
```bash
252
259
# Mount current directory
253
260
docker run --rm -v "$(pwd):/data" ghcr.io/metaschema-framework/oscal-cli:latest ...
@@ -258,6 +265,8 @@ docker run --rm -v "/path/to/files:/data" ghcr.io/metaschema-framework/oscal-cli
258
265
259
266
### Resource Limits
260
267
268
+
For large documents, you may need to increase container memory or CPU limits:
269
+
261
270
```bash
262
271
# Limit memory
263
272
docker run --rm -m 2g ghcr.io/metaschema-framework/oscal-cli:latest ...
Copy file name to clipboardExpand all lines: src/site/markdown/guides/converting-formats.md.vm
+38-6Lines changed: 38 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,21 @@
2
2
3
3
This guide explains how to convert OSCAL documents between XML, JSON, and YAML formats.
4
4
5
+
## Why Convert?
6
+
7
+
OSCAL supports three serialization formats—XML, JSON, and YAML—with identical semantics across all three. Organizations often need to convert between formats for various reasons:
8
+
9
+
- **Tooling requirements** - Different tools in your workflow may require specific formats
10
+
- **Standardization** - Establishing a single canonical format for your organization
11
+
- **Human readability** - YAML is often preferred for manual editing, XML for transformation
12
+
- **Integration** - APIs and web services typically prefer JSON
13
+
- **Storage efficiency** - JSON is generally more compact than XML
14
+
15
+
The OSCAL CLI makes conversion simple. Because OSCAL defines format-agnostic semantics, you can convert documents without data loss—the information remains identical regardless of format.
16
+
5
17
## Overview
6
18
7
-
The `convert` command transforms OSCAL documents between supported formats while preserving all content and structure.
19
+
The `convert` command transforms OSCAL documents between supported formats while preserving all content and structure. The command reads the input document, validates it against the OSCAL model, and writes it in the target format.
The CLI automatically detects the input format based on file extension:
49
+
The CLI determines the input format automatically by examining the file extension. This makes typical conversions simple—you only need to specify the desired output format:
38
50
39
51
| Extension | Format |
40
-
|-----------|--------|
52
+
|:----------|:-------|
41
53
| `.xml` | XML |
42
54
| `.json` | JSON |
43
55
| `.yaml`, `.yml` | YAML |
44
56
45
-
To override automatic detection:
57
+
If your file uses a non-standard extension (or no extension), you can override automatic detection:
Conversion works the same way for all OSCAL document types. The CLI detects the document type from the content and applies the appropriate conversion rules. Here are examples for each type:
When migrating a collection of documents to a new format, shell scripting handles the repetitive work. The following examples show how to convert multiple files at once:
Docker provides a convenient way to run conversions without installing Java locally. Mount your working directory into the container to access your files:
153
+
130
154
#[[
131
155
```bash
132
156
# Convert a single file
@@ -145,6 +169,8 @@ docker run --rm -v "$(pwd):/data" \
145
169
146
170
## CI/CD Integration
147
171
172
+
Automated format conversion is useful when publishing artifacts—for example, generating JSON versions of XML source files when creating a release:
173
+
148
174
### GitHub Actions - Convert on Release
149
175
150
176
#[[
@@ -166,10 +192,12 @@ docker run --rm -v "$(pwd):/data" \
166
192
167
193
## Format Considerations
168
194
195
+
Choosing a format depends on your use case. Each format has trade-offs that may influence your decision. The following tables summarize the key differences:
196
+
169
197
### XML vs JSON
170
198
171
199
| Aspect | XML | JSON |
172
-
|--------|-----|------|
200
+
|:-------|:----|:-----|
173
201
| Human readability | Good with formatting | Good |
174
202
| File size | Larger | Smaller |
175
203
| Comments | Supported | Not supported |
@@ -179,7 +207,7 @@ docker run --rm -v "$(pwd):/data" \
179
207
### YAML vs JSON
180
208
181
209
| Aspect | YAML | JSON |
182
-
|--------|------|------|
210
+
|:-------|:-----|:-----|
183
211
| Human readability | Excellent | Good |
184
212
| Editing | Easy | Standard |
185
213
| Comments | Supported | Not supported |
@@ -188,6 +216,8 @@ docker run --rm -v "$(pwd):/data" \
188
216
189
217
## Troubleshooting
190
218
219
+
When conversion fails, the error messages point to the issue. Here are solutions for common problems:
0 commit comments