Skip to content

support generated code customization #15

@zerlok

Description

@zerlok

User may wish to tune the code (optimization or better readability / documentation). Thus, simple codegen which overwrites exiting modules becomes useless.

Case:

  1. user generates code first time (invokes gendalf cast)
  2. user customizes the generated code (some methods / DTO field types)
  3. user generates code second time -- gendalf modifies only own code, doesn't change user's code

Consider which changes gendalf should avoid and is it useful.

  • gendalf should change a set of fields in DTO and mapping
    • allow & keep custom validators on existing fields (e.g. email: str , but user wants to validate it with email regexp)
  • gendalf should change server & client signatures
  • gendalf should not change server & client existing method implementations. Mypy will complain on types mismatch.

Also, add force flag to overwrite whole module. Consider entrypoint / method filters for this flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions