Skip to content

Commit a0b9c10

Browse files
committed
Regenerate CLI docs
1 parent e0ad9a6 commit a0b9c10

3 files changed

Lines changed: 79 additions & 1 deletion

File tree

docs/cli-reference/base-options.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
| [`--input-model`](#input-model) | Import a Python type or dict schema from a module. |
1111
| [`--input-model-ref-strategy`](#input-model-ref-strategy) | Strategy for referenced types when using --input-model. |
1212
| [`--output`](#output) | Specify the destination path for generated Python code. |
13+
| [`--schema-version`](#schema-version) | Schema version to use for parsing. |
14+
| [`--schema-version-mode`](#schema-version-mode) | Schema version validation mode. |
1315
| [`--url`](#url) | Fetch schema from URL with custom HTTP headers. |
1416

1517
---
@@ -326,6 +328,76 @@ is written to stdout.
326328

327329
---
328330

331+
## `--schema-version` {#schema-version}
332+
333+
Schema version to use for parsing.
334+
335+
The `--schema-version` option specifies the schema version to use instead of auto-detection.
336+
Valid values depend on input type: JsonSchema (draft-04, draft-06, draft-07, 2019-09, 2020-12)
337+
or OpenAPI (3.0, 3.1). Default is 'auto' (detected from $schema or openapi field).
338+
339+
!!! tip "Usage"
340+
341+
```bash
342+
datamodel-codegen --input schema.json --schema-version draft-07 # (1)!
343+
```
344+
345+
1. :material-arrow-left: `--schema-version` - the option documented here
346+
347+
??? example "Examples"
348+
349+
**Input Schema:**
350+
351+
```json
352+
{
353+
"$schema": "http://json-schema.org/draft-07/schema",
354+
"type": "object",
355+
"properties": {"s": {"type": ["string"]}},
356+
"required": ["s"]
357+
}
358+
```
359+
360+
**Output:**
361+
362+
> **Error:** File not found: jsonschema/simple_string.py
363+
364+
---
365+
366+
## `--schema-version-mode` {#schema-version-mode}
367+
368+
Schema version validation mode.
369+
370+
The `--schema-version-mode` option controls how schema version validation is performed.
371+
'lenient' (default): accept all features regardless of version.
372+
'strict': warn on features outside the declared/detected version.
373+
374+
!!! tip "Usage"
375+
376+
```bash
377+
datamodel-codegen --input schema.json --schema-version-mode lenient # (1)!
378+
```
379+
380+
1. :material-arrow-left: `--schema-version-mode` - the option documented here
381+
382+
??? example "Examples"
383+
384+
**Input Schema:**
385+
386+
```json
387+
{
388+
"$schema": "http://json-schema.org/draft-07/schema",
389+
"type": "object",
390+
"properties": {"s": {"type": ["string"]}},
391+
"required": ["s"]
392+
}
393+
```
394+
395+
**Output:**
396+
397+
> **Error:** File not found: jsonschema/simple_string.py
398+
399+
---
400+
329401
## `--url` {#url}
330402

331403
Fetch schema from URL with custom HTTP headers.

docs/cli-reference/index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This documentation is auto-generated from test cases.
88

99
| Category | Options | Description |
1010
|----------|---------|-------------|
11-
| 📁 [Base Options](base-options.md) | 7 | Input/output configuration |
11+
| 📁 [Base Options](base-options.md) | 9 | Input/output configuration |
1212
| 🔧 [Typing Customization](typing-customization.md) | 27 | Type annotation and import behavior |
1313
| 🏷️ [Field Customization](field-customization.md) | 24 | Field naming and docstring behavior |
1414
| 🏗️ [Model Customization](model-customization.md) | 39 | Model generation behavior |
@@ -161,6 +161,8 @@ This documentation is auto-generated from test cases.
161161

162162
### S {#s}
163163

164+
- [`--schema-version`](base-options.md#schema-version)
165+
- [`--schema-version-mode`](base-options.md#schema-version-mode)
164166
- [`--set-default-enum-member`](field-customization.md#set-default-enum-member)
165167
- [`--shared-module-name`](general-options.md#shared-module-name)
166168
- [`--skip-root-model`](model-customization.md#skip-root-model)

docs/cli-reference/quick-reference.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ datamodel-codegen [OPTIONS]
2222
| [`--input-model`](base-options.md#input-model) | Import a Python type or dict schema from a module. |
2323
| [`--input-model-ref-strategy`](base-options.md#input-model-ref-strategy) | Strategy for referenced types when using --input-model. |
2424
| [`--output`](base-options.md#output) | Specify the destination path for generated Python code. |
25+
| [`--schema-version`](base-options.md#schema-version) | Schema version to use for parsing. |
26+
| [`--schema-version-mode`](base-options.md#schema-version-mode) | Schema version validation mode. |
2527
| [`--url`](base-options.md#url) | Fetch schema from URL with custom HTTP headers. |
2628

2729
### 🔧 Typing Customization
@@ -299,6 +301,8 @@ All options sorted alphabetically:
299301
- [`--remove-special-field-name-prefix`](field-customization.md#remove-special-field-name-prefix) - Remove the special prefix from field names.
300302
- [`--reuse-model`](model-customization.md#reuse-model) - Reuse identical model definitions instead of generating dupl...
301303
- [`--reuse-scope`](model-customization.md#reuse-scope) - Scope for model reuse detection (root or tree).
304+
- [`--schema-version`](base-options.md#schema-version) - Schema version to use for parsing.
305+
- [`--schema-version-mode`](base-options.md#schema-version-mode) - Schema version validation mode.
302306
- [`--set-default-enum-member`](field-customization.md#set-default-enum-member) - Set the first enum member as the default value for enum fiel...
303307
- [`--shared-module-name`](general-options.md#shared-module-name) - Customize the name of the shared module for deduplicated mod...
304308
- [`--skip-root-model`](model-customization.md#skip-root-model) - Skip generation of root model when schema contains nested de...

0 commit comments

Comments
 (0)