-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
193 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{{#if (and val.path (not (eq val.type "alias")))}}{{#with (resolve val)}}{{#if (eq this.type "obj")}}{{#if this.adt}}{{>dtoName val=(fmtClass (fmtName ../val.path))}}Base{{else}}{{>dtoName val=(fmtClass ../val.path)}}{{/if}}.get(){{else}}{{>stubImpl val=this indent=indent}}{{/if}}{{/with}}{{else if (or (eq val.type "obj") val.vars)}}{{key}}({{#each val.vars}} | ||
{{../indent}} {{fmtName @key}}={{>stubImpl val=this key=(fmtClass @key) indent=(add ../indent " ") prefix=../key}},{{/each}} | ||
{{indent}}){{else if (eq val.type "map")}}{ {{#if val.key}}{{#if (and prefix (not val.key.path))}}{{prefix}}.{{/if}}{{>stubImpl val=val.key key=(add key "Key") indent=indent}}{{else}}{{>stubImpl val="str" key=(add key "Key") indent=indent}}{{/if}}: {{#if val.val}}{{#if (and prefix (not val.val.path))}}{{prefix}}.{{/if}}{{>stubImpl val=val.val key=(add key "Val") indent=indent}}{{else}}{{>stubImpl val="str" key=(add key "Val") indent=indent}}{{/if}} }{{else if (eq val.type "seq")}}[{{#if (eq val.item.type "obj")}}{{#if prefix}}{{prefix}}.{{/if}}{{add key "Item"}}.get(){{else}}{{>stubImpl val=val.item indent=indent prefix=null}}{{/if}}]{{else if val.mix}}{{unimplemented}}{{else}}{{stubImpl val indent=indent}}{{/if}} | ||
{{#if (and val.path (not (eq val.type "alias")))}}{{#with (resolve val)}}{{#if (eq this.type "obj")}}{{#if this.adt}}{{>dtoName val=(fmtClass (fmtName ../val.path))}}Base{{else}}{{>dtoName val=(fmtClass ../val.path)}}{{/if}}.get(){{else}}{{>stubImpl val=this indent=indent}}{{/if}}{{/with}}{{else if (or (eq val.type "obj") (or val.vars val.mix))}}{{key}}({{#each val.vars}} | ||
{{../indent}} {{fmtName @key}}={{>stubImpl val=this key=(fmtClass @key) indent=(add ../indent " ") prefix=../key}}{{#if (or (not @last) ../val.mix)}},{{/if}}{{/each}}{{#each val.mix}} | ||
{{../indent}} **{{#if ../adtVar}}{ k:v for k, v in {{/if}}{{>dtoName val=(fmtClass this.path)}}.get().dict(){{#if ../adtVar}}.items() if k != {{json (fmtName ../adtVar)}} }{{/if}}{{#unless @last}},{{/unless}}{{/each}} | ||
{{indent}}){{else if (eq val.type "map")}}{ {{#if val.key}}{{#if (eq val.key.type "obj")}}{{#if prefix}}{{prefix}}.{{/if}}{{add key "Key"}}.get(){{else}}{{>stubImpl val=val.item indent=indent prefix=null}}{{/if}}{{else}}{{>stubImpl val="str" key=(add key "Key") indent=indent}}{{/if}}: {{#if val.val}}{{#if (eq val.val.type "obj")}}{{#if prefix}}{{prefix}}.{{/if}}{{add key "Val"}}.get(){{else}}{{>stubImpl val=val.val indent=indent prefix=null}}{{/if}}{{else}}{{>stubImpl val="str" key=(add key "Val") indent=indent}}{{/if}} }{{else if (eq val.type "seq")}}[{{#if (eq val.item.type "obj")}}{{#if prefix}}{{prefix}}.{{/if}}{{#if origin}}{{>dtoName val=(fmtClass origin.path)}}{{/if}}{{add key "Item"}}.get(){{else}}{{>stubImpl val=val.item indent=indent prefix=prefix}}{{/if}}]{{else}}{{stubImpl val indent=indent}}{{/if}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from typing import Any | ||
|
||
from {{fmtName module}}.{{fmtName feature}}.service import {{fmtClass feature}}Service | ||
|
||
service={{fmtClass ../../feature}}Service() | ||
|
||
{{#each ops}}{{#each this}} | ||
def test_{{to_snake_case this.name}}({{#if this.req}}{{#if this.req.path}}{{fmtName (fmtType this.req)}}: {{fmtType this.req (to_pascal_case this.name)}}{{else if (or (eq this.req.type "obj") (eq this.req.type "seq") (eq this.req.type "map"))}}{{fmtName (add this.name "Req")}}: {{>dtoName val=(fmtClass (add this.name "Req"))}}{{else}}request: {{fmtType this.req}}{{/if}}{{#if (eq this.req.form "multipart/form-data")}}, file: BufferedReader{{/if}} = {{>stubImpl val=this.req key="Req"}}{{/if}}{{#if this.params}}{{#if this.req}}, {{/if}}{{#each (sortOptionalsLast this.params)}}{{to_snake_case this.name}}: {{fmtType this}} = {{>stubImpl val=this key=this.name}}{{#unless @last}}, {{/unless}}{{/each}}{{/if}}) -> None: | ||
service.{{to_snake_case this.name}}({{#if this.req}}{{#if this.req.path}}{{fmtName (fmtType this.req)}}{{else if (or (eq this.req.type "obj") (eq this.req.type "seq") (eq this.req.type "map"))}}{{fmtName (add this.name "Req")}}{{else}}request{{/if}}{{#if (eq this.req.form "multipart/form-data")}}, file{{/if}}{{/if}}{{#if this.params}}{{#if this.req}}, {{/if}}{{#each (sortOptionalsLast this.params)}}{{to_snake_case this.name}}{{#unless @last}}, {{/unless}}{{/each}}{{/if}}) | ||
{{/each}}{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.