django-cfg 1.4.14__py3-none-any.whl → 1.4.15__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_cfg/modules/django_client/core/generator/typescript/models_generator.py +13 -9
- django_cfg/modules/django_client/core/generator/typescript/schemas_generator.py +3 -6
- django_cfg/pyproject.toml +1 -1
- {django_cfg-1.4.14.dist-info → django_cfg-1.4.15.dist-info}/METADATA +1 -1
- {django_cfg-1.4.14.dist-info → django_cfg-1.4.15.dist-info}/RECORD +8 -8
- {django_cfg-1.4.14.dist-info → django_cfg-1.4.15.dist-info}/WHEEL +0 -0
- {django_cfg-1.4.14.dist-info → django_cfg-1.4.15.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.4.14.dist-info → django_cfg-1.4.15.dist-info}/licenses/LICENSE +0 -0
@@ -140,35 +140,39 @@ class ModelsGenerator:
|
|
140
140
|
Examples:
|
141
141
|
id: number;
|
142
142
|
username: string;
|
143
|
-
email?: string
|
143
|
+
email?: string;
|
144
144
|
status: Enums.StatusEnum;
|
145
145
|
"""
|
146
146
|
# Check if this field is an enum
|
147
147
|
if schema.enum and schema.name:
|
148
148
|
# Use enum type from shared enums (sanitized)
|
149
149
|
ts_type = f"Enums.{self.base.sanitize_enum_name(schema.name)}"
|
150
|
-
|
151
|
-
ts_type = f"{ts_type} | null"
|
150
|
+
# Don't add | null for nullable - use optional marker instead
|
152
151
|
# Check if this field is a reference to an enum (via $ref)
|
153
152
|
elif schema.ref and schema.ref in self.context.schemas:
|
154
153
|
ref_schema = self.context.schemas[schema.ref]
|
155
154
|
if ref_schema.enum:
|
156
155
|
# This is a reference to an enum component (sanitized to PascalCase)
|
157
156
|
ts_type = f"Enums.{self.base.sanitize_enum_name(schema.ref)}"
|
158
|
-
|
159
|
-
ts_type = f"{ts_type} | null"
|
157
|
+
# Don't add | null for nullable - use optional marker instead
|
160
158
|
else:
|
161
|
-
# Regular reference
|
159
|
+
# Regular reference - get base type without | null
|
162
160
|
ts_type = schema.typescript_type
|
161
|
+
# Remove | null suffix if present (we'll use optional marker instead)
|
162
|
+
if ts_type.endswith(" | null"):
|
163
|
+
ts_type = ts_type[:-7] # Remove " | null"
|
163
164
|
else:
|
164
|
-
# Get TypeScript type
|
165
|
+
# Get TypeScript type and remove | null suffix if present
|
165
166
|
ts_type = schema.typescript_type
|
167
|
+
if ts_type.endswith(" | null"):
|
168
|
+
ts_type = ts_type[:-7] # Remove " | null"
|
166
169
|
|
167
170
|
# Check if required
|
168
171
|
is_required = name in required_fields
|
169
172
|
|
170
|
-
# Optional marker
|
171
|
-
|
173
|
+
# Optional marker - use for both non-required AND nullable fields
|
174
|
+
# This converts Django's nullable=True to TypeScript's optional (undefined)
|
175
|
+
optional_marker = "" if is_required and not schema.nullable else "?"
|
172
176
|
|
173
177
|
# Comment
|
174
178
|
if schema.description:
|
@@ -117,14 +117,11 @@ class SchemasGenerator:
|
|
117
117
|
# Check if required
|
118
118
|
is_required = name in required_fields
|
119
119
|
|
120
|
-
# Handle optional fields
|
121
|
-
|
120
|
+
# Handle optional fields - use .optional() for both non-required AND nullable
|
121
|
+
# This converts Django's nullable=True to TypeScript's optional (undefined)
|
122
|
+
if not is_required or schema.nullable:
|
122
123
|
zod_type = f"{zod_type}.optional()"
|
123
124
|
|
124
|
-
# Handle nullable fields
|
125
|
-
if schema.nullable:
|
126
|
-
zod_type = f"{zod_type}.nullable()"
|
127
|
-
|
128
125
|
return f"{name}: {zod_type}"
|
129
126
|
|
130
127
|
def _map_type_to_zod(self, schema: IRSchemaObject) -> str:
|
django_cfg/pyproject.toml
CHANGED
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "django-cfg"
|
7
|
-
version = "1.4.
|
7
|
+
version = "1.4.15"
|
8
8
|
description = "Django AI framework with built-in agents, type-safe Pydantic v2 configuration, and 8 enterprise apps. Replace settings.py, validate at startup, 90% less code. Production-ready AI workflows for Django."
|
9
9
|
readme = "README.md"
|
10
10
|
keywords = [ "django", "configuration", "pydantic", "settings", "type-safety", "pydantic-settings", "django-environ", "startup-validation", "ide-autocomplete", "ai-agents", "enterprise-django", "django-settings", "type-safe-config",]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: django-cfg
|
3
|
-
Version: 1.4.
|
3
|
+
Version: 1.4.15
|
4
4
|
Summary: Django AI framework with built-in agents, type-safe Pydantic v2 configuration, and 8 enterprise apps. Replace settings.py, validate at startup, 90% less code. Production-ready AI workflows for Django.
|
5
5
|
Project-URL: Homepage, https://djangocfg.com
|
6
6
|
Project-URL: Documentation, https://djangocfg.com
|
@@ -764,9 +764,9 @@ django_cfg/modules/django_client/core/generator/typescript/fetchers_generator.py
|
|
764
764
|
django_cfg/modules/django_client/core/generator/typescript/files_generator.py,sha256=faRdhVVf9GQ-0esVz94dsaQMB56zK3csyNkhEHL4al4,7044
|
765
765
|
django_cfg/modules/django_client/core/generator/typescript/generator.py,sha256=_xuQC10SJ1ZKwA2_h3te4ZkSmH2jlnjUr__EJuBwNVE,16982
|
766
766
|
django_cfg/modules/django_client/core/generator/typescript/hooks_generator.py,sha256=DVGb6z_HrNbtMC6QqsyKOjZmAUGBFSEqSo-AijPLw7A,19994
|
767
|
-
django_cfg/modules/django_client/core/generator/typescript/models_generator.py,sha256=
|
767
|
+
django_cfg/modules/django_client/core/generator/typescript/models_generator.py,sha256=2cBA-YzeBkGekoKz0pzT-Rt56MCvRTT-lSb44AAujfk,8787
|
768
768
|
django_cfg/modules/django_client/core/generator/typescript/operations_generator.py,sha256=CIcRLrCBqpxOrYcjFtk0mkZGJgUnQlaRDK6G0xADoUA,13171
|
769
|
-
django_cfg/modules/django_client/core/generator/typescript/schemas_generator.py,sha256=
|
769
|
+
django_cfg/modules/django_client/core/generator/typescript/schemas_generator.py,sha256=tmFZ8yFJ_Nk_iT7QGDDUVSFJhg8WTF79lYDOqQDzz8c,10877
|
770
770
|
django_cfg/modules/django_client/core/generator/typescript/templates/api_instance.ts.jinja,sha256=OPUjnz6Dk3kY97UFIRcgvxkEIKd6fUGqBzXJWOXKykE,2906
|
771
771
|
django_cfg/modules/django_client/core/generator/typescript/templates/app_index.ts.jinja,sha256=gLsoYyEzKD6Gv64vsO9sQHMPiFMGdaB5XVufLHeRyvQ,62
|
772
772
|
django_cfg/modules/django_client/core/generator/typescript/templates/client_file.ts.jinja,sha256=LHUt72fO2eRNAHYEscIYvqVR69GC6mxqjcgSlUzeCtc,251
|
@@ -1093,9 +1093,9 @@ django_cfg/utils/version_check.py,sha256=jI4v3YMdQriUEeb_TvRl511sDghy6I75iKRDUaN
|
|
1093
1093
|
django_cfg/CHANGELOG.md,sha256=jtT3EprqEJkqSUh7IraP73vQ8PmKUMdRtznQsEnqDZk,2052
|
1094
1094
|
django_cfg/CONTRIBUTING.md,sha256=DU2kyQ6PU0Z24ob7O_OqKWEYHcZmJDgzw-lQCmu6uBg,3041
|
1095
1095
|
django_cfg/LICENSE,sha256=xHuytiUkSZCRG3N11nk1X6q1_EGQtv6aL5O9cqNRhKE,1071
|
1096
|
-
django_cfg/pyproject.toml,sha256=
|
1097
|
-
django_cfg-1.4.
|
1098
|
-
django_cfg-1.4.
|
1099
|
-
django_cfg-1.4.
|
1100
|
-
django_cfg-1.4.
|
1101
|
-
django_cfg-1.4.
|
1096
|
+
django_cfg/pyproject.toml,sha256=w_z0KHaUolA5t2-T5vEIyA1QwhXNa2jkBosNLNd4784,8210
|
1097
|
+
django_cfg-1.4.15.dist-info/METADATA,sha256=8mSJYTS5wa4dnkWG-MOuVwQANoWkE1jJU6vZJ-AcA4Y,22533
|
1098
|
+
django_cfg-1.4.15.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
1099
|
+
django_cfg-1.4.15.dist-info/entry_points.txt,sha256=Ucmde4Z2wEzgb4AggxxZ0zaYDb9HpyE5blM3uJ0_VNg,56
|
1100
|
+
django_cfg-1.4.15.dist-info/licenses/LICENSE,sha256=xHuytiUkSZCRG3N11nk1X6q1_EGQtv6aL5O9cqNRhKE,1071
|
1101
|
+
django_cfg-1.4.15.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|