Skip to content

Support @RequestMapping.param for overloaded endpoints #580

Closed
@pcalouche

Description

@pcalouche

I saw this issues was marked as won't fix here #15, but I think there are valid uses cases for it and Spring supports it. Springfox also supported this as well.

For example

// handle save draft of audit
@PatchMapping(value = "/audits/{auditId}", params = "action=saveDraft")
public AuditDto saveDraft(@PathVariable int auditId, @RequestBody AuditPatchRequest auditPatchRequest) {
}

// save audit and mark it as reviewed
@PatchMapping(value = "/audits/{auditId}", params = "action=markReviewed")
public AuditDto markedReviewed(@PathVariable int auditId, @RequestBody AuditPatchRequest auditPatchRequest) {
}

// marks audit as complete, but makes no other changes
@PatchMapping(value = "/audits/{auditId}", params = "action=markComplete")
public AuditDto markComplete(@PathVariable int auditId) {

}

I would expect to see these endpoints generated in the documentation:

PATCH /audits/{auditId}?action=saveDraft
PATCH /audits/{auditId}?action=markReviewed
PATCH /audits/{auditId}?action=markComplete

I'm open to an alternate way to do handle such endpoints if you can suggest one along with constructive criticism as to why may not be good REST API practice. Keep up the good work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions