Skip to content

[Feature Request] codegen: add support for default values in parameters #5490

Description

@Iilun

Hello maintainers.

First of all thank you for the great work on codegen, it is nice having such a tool in Scala.

While experimenting with it, I found that default values work perfectly for request bodies, but are ignored in parameters (query, headers, path).

Adding such support would be nice, and make for a more coherent experience across the different openapi items.

I did not find it clear if I should open an issue before opening a PR, but I have worked on adding this support in my fork. The included swagger can be used to reproduce the issue (no default value in the generated code).

This is a proposal and maybe you have a better way of implementing it with your knowledge of the code base, as adding support for basic schemas was pretty trivial, but handling schema refs required more substantial changes, and this may need a better refacto than what I submitted, hence why i separated it in two commits.

Thanks for your time, and please let me know if you want me to open the PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions