swagger-api / swagger-api/swagger-codegen
[JAVA-JAXRS-RESTEASY] Bug DELETE not working
Open
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I have a delete API which doesn't work. Not sure if it's bug or something wrong with my schema. Please help!
Here is the YAML schema
/ops/{property}/action1/{id}:
delete:
produces:
- application/json
operationId: deleteById
parameters:
- name: property
in: path
description: property id
required: true
type: string
- name: id
in: path
description: the id
required: true
type: string
responses:
200:
description: Delete success
Generated api code:
@DELETE
@Path("/{property}/roomholds/{id}")
@Produces({ "application/json" })
@io.swagger.annotations.ApiOperation(value = "Delete id ", notes = "", response = CommonResponse.class)
@io.swagger.annotations.ApiResponses(value = {
@io.swagger.annotations.ApiResponse(code = 200, message = "Delete success", response = CommonResponse.class),
@io.swagger.annotations.ApiResponse(code = 400, message = "ID not found or invalid", response = CommonResponse.class) })
public Response deleteById( @PathParam("property") String property, @PathParam("id") String id,@Context SecurityContext securityContext)
throws NotFoundException {
return delegate.deleteById(property,id,securityContext);
}
The response I get is:
<html>
<head>
<title>Error</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
p,h3,li{
font-family: verdana;
font-size: 8pt;
}
h3{
font-size: 12pt;
}
</style>
</head>
<body marginwidth="10" marginheight="10" topmargin="10" leftmargin="10" bgcolor="#FFFFFF">
<h3>Error 500, 404 or 403:</h3>
<p>
The file you requested is not available.
</p>
<p>
Please contact your <b>System Administrator</b> about this problem.
<li>Include the url of the page you were on when the error occurred</li>
<li>Describe the link or button you selected which caused the error</li>
</p>
</body>
</html>
Swagger-codegen version
2.2.2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the YAML DELETE definition and the generated Java deleteById method, then compare the requested URL and HTTP method with the generated @Path and @PathParam values. The issue names no repository file or test; done would require identifying whether the failure is caused by the schema, generated route, or server configuration and documenting a reproducible correction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100