apache / apache/grails-core

Suggestion: Add create-command-object to the Grails CLI

Open
#9,948 0 comments 0 reactions 0 assignees View on GitHub
type: enhancement type: improvement type: minor
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

### Suggestion
- Add create-command-object to the Grails CLI
### Why?

For example with IntelliJ, when you create a new file/class it gets automatically saved and loaded by Spring Loader. As a command object needs to implement the Validateable interface and Spring Loaded does not support reloading interfaces this cause some issues. You either need to rename the class or restart your development application.

Example:

```
Spring Loaded: Cannot reload new version of com.example.person.UpdatePersonForm
Reason: Interfaces changed from [groovy/lang/GroovyObject] to [grails/validation/Validateable, grails/validation/Validateable$Trait$FieldHelper, groovy/lang/GroovyObject]
```

This could be avoided by using the create-command-object command which uses a template. Also maybe command objects could get their own folder like domain-classes, controllers and taglibs?

I would love to hear what other people think about this.

Contributor guide

Open the contributing guide

Research direction

No files or tests are named. Start by inspecting the existing Grails CLI create commands and their templates, then compare how domain classes, controllers, and taglibs choose generated locations. Done means a create-command-object command generates a command object implementing Validateable and establishes its intended folder placement.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.