Skip to content
This repository was archived by the owner on Dec 25, 2024. It is now read-only.

Commit afb4894

Browse files
committed
Templates updated to render if then in schema classes
1 parent a2745ab commit afb4894

8 files changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{#with if_}}
2+
if_: typing.Type[{{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}] = dataclasses.field(default_factory=lambda: {{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}) # type: ignore
3+
{{/with}}

src/main/resources/python/components/schemas/schema_cls/_schema_anytype_or_multitype.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ class {{jsonPathPiece.camelCase}}(
9999
{{#if not}}
100100
{{> components/schemas/schema_cls/_not }}
101101
{{/if}}
102+
{{#if if_}}
103+
{{> components/schemas/schema_cls/_if }}
104+
{{/if}}
105+
{{#if then}}
106+
{{> components/schemas/schema_cls/_then }}
107+
{{/if}}
102108
{{#if dependentRequired}}
103109
{{> components/schemas/schema_cls/_dependent_required }}
104110
{{/if}}

src/main/resources/python/components/schemas/schema_cls/_schema_boolean.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,12 @@ class {{jsonPathPiece.camelCase}}(
3434
{{#if not}}
3535
{{> components/schemas/schema_cls/_not }}
3636
{{/if}}
37+
{{#if if_}}
38+
{{> components/schemas/schema_cls/_if }}
39+
{{/if}}
40+
{{#if then}}
41+
{{> components/schemas/schema_cls/_then }}
42+
{{/if}}
3743
{{#or enumInfo constInfo}}
3844

3945
{{> components/schemas/schema_cls/validate/validate }}

src/main/resources/python/components/schemas/schema_cls/_schema_dict.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class {{jsonPathPiece.camelCase}}(
4343
{{#if not}}
4444
{{> components/schemas/schema_cls/_not }}
4545
{{/if}}
46+
{{#if if_}}
47+
{{> components/schemas/schema_cls/_if }}
48+
{{/if}}
49+
{{#if then}}
50+
{{> components/schemas/schema_cls/_then }}
51+
{{/if}}
4652
{{#if dependentRequired}}
4753
{{> components/schemas/schema_cls/_dependent_required }}
4854
{{/if}}

src/main/resources/python/components/schemas/schema_cls/_schema_list.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ class {{jsonPathPiece.camelCase}}(
4646
{{#if not}}
4747
{{> components/schemas/schema_cls/_not }}
4848
{{/if}}
49+
{{#if if_}}
50+
{{> components/schemas/schema_cls/_if }}
51+
{{/if}}
52+
{{#if then}}
53+
{{> components/schemas/schema_cls/_then }}
54+
{{/if}}
4955
{{#if unevaluatedItems}}
5056
{{> components/schemas/schema_cls/_unevaluated_items }}
5157
{{/if}}

src/main/resources/python/components/schemas/schema_cls/_schema_number.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ class {{jsonPathPiece.camelCase}}(
4646
{{#if not}}
4747
{{> components/schemas/schema_cls/_not }}
4848
{{/if}}
49+
{{#if if_}}
50+
{{> components/schemas/schema_cls/_if }}
51+
{{/if}}
52+
{{#if then}}
53+
{{> components/schemas/schema_cls/_then }}
54+
{{/if}}
4955
{{#or enumInfo constInfo}}
5056

5157
{{> components/schemas/schema_cls/validate/validate }}

src/main/resources/python/components/schemas/schema_cls/_schema_string.hbs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ class {{jsonPathPiece.camelCase}}(
5858
{{#if not}}
5959
{{> components/schemas/schema_cls/_not }}
6060
{{/if}}
61+
{{#if if_}}
62+
{{> components/schemas/schema_cls/_if }}
63+
{{/if}}
64+
{{#if then}}
65+
{{> components/schemas/schema_cls/_then }}
66+
{{/if}}
6167
{{#or enumInfo constInfo}}
6268

6369
{{> components/schemas/schema_cls/validate/validate }}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{{#with then}}
2+
if_: typing.Type[{{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}] = dataclasses.field(default_factory=lambda: {{#if refInfo.refClass}}{{#if refInfo.refModule}}{{refInfo.refModule}}.{{/if}}{{refInfo.refClass}}{{else}}{{jsonPathPiece.camelCase}}{{/if}}) # type: ignore
3+
{{/with}}

0 commit comments

Comments
 (0)