Mock code doesn't compile if path parameters are renamed (#782)

This commit is contained in:
Adam Leventhal 2024-04-22 09:51:38 -07:00 committed by GitHub
parent 3a76093e7b
commit d4decd4728
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 13 additions and 9 deletions

View File

@ -161,7 +161,11 @@ impl Generator {
// can specify a prescribed value for that parameter.
let when_methods = method.params.iter().map(
|OperationParameter {
name, typ, kind, ..
name,
typ,
kind,
api_name,
description: _,
}| {
let arg_type_name = match typ {
OperationParameterType::Type(arg_type_id) => self
@ -187,7 +191,7 @@ impl Generator {
let name_ident = format_ident!("{}", name);
let handler = match kind {
OperationParameterKind::Path => {
let re_fmt = method.path.as_wildcard_param(name);
let re_fmt = method.path.as_wildcard_param(api_name);
quote! {
let re = regex::Regex::new(
&format!(#re_fmt, value.to_string())

View File

@ -2174,7 +2174,7 @@ impl Client {
builder::ControlResume::new(self)
}
///Sends a `GET` request to `/v1/task/{task}`
///Sends a `GET` request to `/v1/task/{Task}`
///
///```ignore
/// let response = client.task_get()
@ -2478,7 +2478,7 @@ pub mod builder {
self
}
///Sends a `GET` request to `/v1/task/{task}`
///Sends a `GET` request to `/v1/task/{Task}`
pub async fn send(self) -> Result<ResponseValue<types::Task>, Error<()>> {
let Self { client, task } = self;
let task = task.map_err(Error::InvalidRequest)?;

View File

@ -2174,7 +2174,7 @@ impl Client {
builder::ControlResume::new(self)
}
///Sends a `GET` request to `/v1/task/{task}`
///Sends a `GET` request to `/v1/task/{Task}`
///
///```ignore
/// let response = client.task_get()
@ -2478,7 +2478,7 @@ pub mod builder {
self
}
///Sends a `GET` request to `/v1/task/{task}`
///Sends a `GET` request to `/v1/task/{Task}`
pub async fn send(self) -> Result<ResponseValue<types::Task>, Error<()>> {
let Self { client, task } = self;
let task = task.map_err(Error::InvalidRequest)?;

View File

@ -858,7 +858,7 @@ impl Client {
}
}
///Sends a `GET` request to `/v1/task/{task}`
///Sends a `GET` request to `/v1/task/{Task}`
pub async fn task_get<'a>(
&'a self,
task: &'a str,

View File

@ -34,13 +34,13 @@
}
}
},
"/v1/task/{task}": {
"/v1/task/{Task}": {
"get": {
"operationId": "task_get",
"parameters": [
{
"in": "path",
"name": "task",
"name": "Task",
"required": true,
"schema": {
"type": "string"