Delete request with two path parameters only generates with the first parameter
Have a delete request with two path params but when we generate, only one of them makes it through the process. We have a get request that does not have this issue.
Preview of the json is trimmed a bit but should give a general enough idea. Not shown is here is the get.
"/api/v1/ratelimits/{project_id}/{endpoint}": {
"delete": {
"summary": "Delete a rate limiter definition from the database",
"operationId": "Delete",
"responses": {
"200": {
"description": "A successful response.",
"content": {
"application/json": {
"schema": {
"properties": {}
}
}
}
}
},
"parameters": [
{
"name": "project_id",
"description": "project ID",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "endpoint",
"description": "endpoint",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
},
When generated, this is the output:
export interface RatelimitsDeletePathParams {
/**
* project ID
*/
project_id: string
}
Not sure where endpoint decided to go, but it shows up fine for the get:
export interface RatelimitsReadPathParams {
/**
* project ID
*/
project_id: string;
/**
* endpoint
*/
endpoint: string
}
There's no errors, it just goes MIA. Probably related to https://github.com/contiamo/restful-react/issues/259, if I were to make a guess.
Hi @meinfretr ,
This is because the generated restful-react component will be useDelete (because your operationId is call Delete)and will take the last param as input:
const myComp = () => {
const { mutate, loading } = useDelete({ project_id: "my-id" });
return (
<button onClick={() => mutate("endpoint")} disabled={loading}>
{loading ? "⏳" : "delete endpoint"}
</button>
);
};