Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 20 additions & 0 deletions docs/llms-full.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24161,13 +24161,33 @@ The following features are tracked in the codebase with their implementation sta
| `definitions/$defs` | Draft 4 | ✅ Supported | Key for reusable schema definitions |
| `exclusiveMinimum/Maximum as number` | Draft 6 | ✅ Supported | Numeric `exclusiveMinimum`/`exclusiveMaximum` (boolean in Draft 4) |
| `readOnly/writeOnly` | Draft 7 | ✅ Supported | Field visibility hints for read-only and write-only properties |
| `const` | Draft 6 | ✅ Supported | Single constant value constraint |
| `propertyNames` | Draft 6 | ✅ Supported | Dict key type constraints via pattern, enum, or $ref |
| `contains` | Draft 6 | ❌ Not Supported | Array contains at least one matching item |
| `deprecated` | 2019-09 | ⚠️ Partial | Marks schema elements as deprecated |
| `if/then/else` | Draft 7 | ❌ Not Supported | Conditional schema validation |
| `contentMediaType/contentEncoding` | Draft 7 | ❌ Not Supported | Content type and encoding hints for strings |
| `$anchor` | 2019-09 | ❌ Not Supported | Location-independent schema references |
| `$vocabulary` | 2019-09 | ❌ Not Supported | Vocabulary declarations for meta-schemas |
| `unevaluatedProperties` | 2019-09 | ❌ Not Supported | Additional properties not evaluated by subschemas |
| `unevaluatedItems` | 2019-09 | ❌ Not Supported | Additional items not evaluated by subschemas |
| `dependentRequired` | 2019-09 | ❌ Not Supported | Conditional property requirements |
| `dependentSchemas` | 2019-09 | ❌ Not Supported | Conditional schema application based on property presence |
| `$dynamicRef/$dynamicAnchor` | 2020-12 | ❌ Not Supported | Dynamic reference resolution across schemas |

#### OpenAPI-Specific Features

| Feature | Introduced | Status | Description |
|---------|------------|--------|-------------|
| `nullable` | OAS 3.0 | ✅ Supported | Uses `nullable: true` for nullable types (deprecated in 3.1) |
| `discriminator` | OAS 3.0 | ✅ Supported | Polymorphism support via `discriminator` keyword |
| `webhooks` | OAS 3.1 | ✅ Supported | Top-level webhooks object for incoming events |
| `$ref with sibling keywords` | OAS 3.1 | ⚠️ Partial | $ref can coexist with description, summary (no allOf workaround) |
| `xml` | OAS 3.0 | ❌ Not Supported | XML serialization metadata (name, namespace, prefix) |
| `externalDocs` | OAS 3.0 | ❌ Not Supported | Reference to external documentation |
| `links` | OAS 3.0 | ❌ Not Supported | Links between operations |
| `callbacks` | OAS 3.0 | ❌ Not Supported | Callback definitions for webhooks |
| `securitySchemes` | OAS 3.0 | ❌ Not Supported | API security mechanism definitions |
<!-- END AUTO-GENERATED SUPPORTED FEATURES -->

## Data Format Support
Expand Down
20 changes: 20 additions & 0 deletions docs/supported_formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,33 @@ The following features are tracked in the codebase with their implementation sta
| `definitions/$defs` | Draft 4 | ✅ Supported | Key for reusable schema definitions |
| `exclusiveMinimum/Maximum as number` | Draft 6 | ✅ Supported | Numeric `exclusiveMinimum`/`exclusiveMaximum` (boolean in Draft 4) |
| `readOnly/writeOnly` | Draft 7 | ✅ Supported | Field visibility hints for read-only and write-only properties |
| `const` | Draft 6 | ✅ Supported | Single constant value constraint |
| `propertyNames` | Draft 6 | ✅ Supported | Dict key type constraints via pattern, enum, or $ref |
| `contains` | Draft 6 | ❌ Not Supported | Array contains at least one matching item |
| `deprecated` | 2019-09 | ⚠️ Partial | Marks schema elements as deprecated |
| `if/then/else` | Draft 7 | ❌ Not Supported | Conditional schema validation |
| `contentMediaType/contentEncoding` | Draft 7 | ❌ Not Supported | Content type and encoding hints for strings |
| `$anchor` | 2019-09 | ❌ Not Supported | Location-independent schema references |
| `$vocabulary` | 2019-09 | ❌ Not Supported | Vocabulary declarations for meta-schemas |
| `unevaluatedProperties` | 2019-09 | ❌ Not Supported | Additional properties not evaluated by subschemas |
| `unevaluatedItems` | 2019-09 | ❌ Not Supported | Additional items not evaluated by subschemas |
| `dependentRequired` | 2019-09 | ❌ Not Supported | Conditional property requirements |
| `dependentSchemas` | 2019-09 | ❌ Not Supported | Conditional schema application based on property presence |
| `$dynamicRef/$dynamicAnchor` | 2020-12 | ❌ Not Supported | Dynamic reference resolution across schemas |

#### OpenAPI-Specific Features

| Feature | Introduced | Status | Description |
|---------|------------|--------|-------------|
| `nullable` | OAS 3.0 | ✅ Supported | Uses `nullable: true` for nullable types (deprecated in 3.1) |
| `discriminator` | OAS 3.0 | ✅ Supported | Polymorphism support via `discriminator` keyword |
| `webhooks` | OAS 3.1 | ✅ Supported | Top-level webhooks object for incoming events |
| `$ref with sibling keywords` | OAS 3.1 | ⚠️ Partial | $ref can coexist with description, summary (no allOf workaround) |
| `xml` | OAS 3.0 | ❌ Not Supported | XML serialization metadata (name, namespace, prefix) |
| `externalDocs` | OAS 3.0 | ❌ Not Supported | Reference to external documentation |
| `links` | OAS 3.0 | ❌ Not Supported | Links between operations |
| `callbacks` | OAS 3.0 | ❌ Not Supported | Callback definitions for webhooks |
| `securitySchemes` | OAS 3.0 | ❌ Not Supported | API security mechanism definitions |
<!-- END AUTO-GENERATED SUPPORTED FEATURES -->

## Data Format Support
Expand Down
188 changes: 188 additions & 0 deletions src/datamodel_code_generator/parser/schema_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,125 @@ class JsonSchemaFeatures:
status="supported",
),
)
# --- Partially supported features ---
const_support: bool = field(
default=True,
metadata=FeatureMetadata(
introduced="Draft 6",
doc_name="const",
description="Single constant value constraint",
status="supported",
),
)
property_names: bool = field(
default=True,
metadata=FeatureMetadata(
introduced="Draft 6",
doc_name="propertyNames",
description="Dict key type constraints via pattern, enum, or $ref",
status="supported",
),
)
contains: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="Draft 6",
doc_name="contains",
description="Array contains at least one matching item",
status="not_supported",
),
)
deprecated_keyword: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="2019-09",
doc_name="deprecated",
description="Marks schema elements as deprecated",
status="partial",
),
)
# --- Unsupported features ---
if_then_else: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="Draft 7",
doc_name="if/then/else",
description="Conditional schema validation",
status="not_supported",
),
)
content_encoding: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="Draft 7",
doc_name="contentMediaType/contentEncoding",
description="Content type and encoding hints for strings",
status="not_supported",
),
)
anchor: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="2019-09",
doc_name="$anchor",
description="Location-independent schema references",
status="not_supported",
),
)
vocabulary: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="2019-09",
doc_name="$vocabulary",
description="Vocabulary declarations for meta-schemas",
status="not_supported",
),
)
unevaluated_properties: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="2019-09",
doc_name="unevaluatedProperties",
description="Additional properties not evaluated by subschemas",
status="not_supported",
),
)
unevaluated_items: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="2019-09",
doc_name="unevaluatedItems",
description="Additional items not evaluated by subschemas",
status="not_supported",
),
)
dependent_required: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="2019-09",
doc_name="dependentRequired",
description="Conditional property requirements",
status="not_supported",
),
)
dependent_schemas: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="2019-09",
doc_name="dependentSchemas",
description="Conditional schema application based on property presence",
status="not_supported",
),
)
dynamic_ref: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="2020-12",
doc_name="$dynamicRef/$dynamicAnchor",
description="Dynamic reference resolution across schemas",
status="not_supported",
),
)

@classmethod
def from_version(cls, version: JsonSchemaVersion) -> JsonSchemaFeatures:
Expand All @@ -133,6 +252,8 @@ def from_version(cls, version: JsonSchemaVersion) -> JsonSchemaFeatures:
definitions_key="definitions",
exclusive_as_number=False,
read_only_write_only=False,
const_support=False,
property_names=False,
)
case JsonSchemaVersion.Draft6:
return cls(
Expand Down Expand Up @@ -208,6 +329,71 @@ class OpenAPISchemaFeatures(JsonSchemaFeatures):
status="supported",
),
)
webhooks: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="OAS 3.1",
doc_name="webhooks",
description="Top-level webhooks object for incoming events",
status="supported",
),
)
# --- Partially supported features ---
ref_sibling_keywords: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="OAS 3.1",
doc_name="$ref with sibling keywords",
description="$ref can coexist with description, summary (no allOf workaround)",
status="partial",
),
)
# --- Unsupported features ---
xml_support: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="OAS 3.0",
doc_name="xml",
description="XML serialization metadata (name, namespace, prefix)",
status="not_supported",
),
)
external_docs: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="OAS 3.0",
doc_name="externalDocs",
description="Reference to external documentation",
status="not_supported",
),
)
links: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="OAS 3.0",
doc_name="links",
description="Links between operations",
status="not_supported",
),
)
callbacks: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="OAS 3.0",
doc_name="callbacks",
description="Callback definitions for webhooks",
status="not_supported",
),
)
security_schemes: bool = field(
default=False,
metadata=FeatureMetadata(
introduced="OAS 3.0",
doc_name="securitySchemes",
description="API security mechanism definitions",
status="not_supported",
),
)

@classmethod
def from_openapi_version(cls, version: OpenAPIVersion) -> OpenAPISchemaFeatures:
Expand Down Expand Up @@ -238,6 +424,8 @@ def from_openapi_version(cls, version: OpenAPIVersion) -> OpenAPISchemaFeatures:
read_only_write_only=True,
nullable_keyword=False,
discriminator_support=True,
webhooks=True,
ref_sibling_keywords=True,
)


Expand Down
6 changes: 6 additions & 0 deletions tests/parser/test_schema_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def test_jsonschema_features_draft4() -> None:
JsonSchemaFeatures(
null_in_type_array=False,
defs_not_definitions=False,
const_support=False,
property_names=False,
prefix_items=False,
boolean_schemas=False,
id_field="id",
Expand Down Expand Up @@ -235,6 +237,8 @@ def test_openapi_features_v31() -> None:
boolean_schemas=True,
id_field="$id",
definitions_key="$defs",
webhooks=True,
ref_sibling_keywords=True,
exclusive_as_number=True,
read_only_write_only=True,
nullable_keyword=False,
Expand All @@ -253,6 +257,8 @@ def test_openapi_features_auto() -> None:
boolean_schemas=True,
id_field="$id",
definitions_key="$defs",
webhooks=True,
ref_sibling_keywords=True,
exclusive_as_number=True,
read_only_write_only=True,
nullable_keyword=False,
Expand Down
Loading