FEATURE: add method call based default valuer#29
Merged
Conversation
gx578007
reviewed
Aug 22, 2025
go.mod
Outdated
| module github.com/c9s/requestgen | ||
|
|
||
| go 1.21.0 | ||
| go 1.23.0 |
Collaborator
There was a problem hiding this comment.
Should be at least 1.24?
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for method-based default values in the requestgen code generator, allowing users to define custom default values by implementing methods like GetDefaultFieldName(). The changes update Go toolchain dependencies and enhance the generated code with better parameter handling and validation.
- Adds method-based default valuer support with
defaultValuer:"method"tag option - Updates Go toolchain from 1.21.0 to 1.23.0 and dependency versions
- Improves generated code with slice parameter handling and response unmarshaling
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| go.mod | Updates Go version to 1.23.0 and dependency versions |
| example/api/place_order_request.go | Adds Meta struct and demonstrates method-based default valuer usage |
| example/api/place_order_request_requestgen.go | Shows generated code with new method-based defaults and improved parameter handling |
| cmd/requestgen/main.go | Implements core logic for method-based default valuers and field parsing |
| cmd/requestgen/field.go | Adds ReceiverName and IsPointer fields to support new functionality |
| cmd/requestgen/tmplfuncs.go | Adds title function for method name generation |
| cmd/requestgen/utils.go | Improves logging with proper log levels |
| example/api/v1/*.go | Generated code updates showing slice handling and response validation improvements |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
gx578007
approved these changes
Aug 22, 2025
kbearXD
approved these changes
Aug 22, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Usage
users can now customize the default valuer by defining a method: