Derive Debug for types (#145)

* Derive Debug for client and types

* run tests

* update changelog

* refactor
This commit is contained in:
Karen Cárcamo 2022-08-03 13:18:43 +12:00 committed by GitHub
parent cc67e26c24
commit ba00230176
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 327 additions and 315 deletions

View File

@ -17,6 +17,7 @@ https://github.com/oxidecomputer/progenitor/compare/v0.1.1\...HEAD[Full list of
* Add support for a builder-style generation in addition to the positional style (#86)
* Add support for body parameters with application/x-www-form-urlencoded media type (#109)
* Derive Debug for Client and builders for the various operations (#145)
== 0.1.1 (released 2022-05-13)

View File

@ -219,7 +219,7 @@ impl Generator {
#(#types)*
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,

View File

@ -1418,7 +1418,14 @@ impl Generator {
}
});
let maybe_clone = cloneable.then(|| quote! { #[derive(Clone)] });
let mut derives = vec![quote! { Debug }];
if cloneable {
derives.push(quote! { Clone });
}
let derive = quote! {
#[derive( #( #derives ),* )]
};
// Build a reasonable doc comment depending on whether this struct is
// the output from
@ -1480,7 +1487,7 @@ impl Generator {
Ok(quote! {
#[doc = #struct_doc]
#maybe_clone
#derive
pub struct #struct_ident<'a> {
client: &'a super::Client,
#( #param_names: #param_types, )*

View File

@ -134,7 +134,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,
@ -373,7 +373,7 @@ pub mod builder {
///Builder for [`Client::control_hold`]
///
///[`Client::control_hold`]: super::Client::control_hold
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ControlHold<'a> {
client: &'a super::Client,
}
@ -400,7 +400,7 @@ pub mod builder {
///Builder for [`Client::control_resume`]
///
///[`Client::control_resume`]: super::Client::control_resume
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ControlResume<'a> {
client: &'a super::Client,
}
@ -427,7 +427,7 @@ pub mod builder {
///Builder for [`Client::task_get`]
///
///[`Client::task_get`]: super::Client::task_get
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskGet<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -473,7 +473,7 @@ pub mod builder {
///Builder for [`Client::tasks_get`]
///
///[`Client::tasks_get`]: super::Client::tasks_get
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TasksGet<'a> {
client: &'a super::Client,
}
@ -500,7 +500,7 @@ pub mod builder {
///Builder for [`Client::task_submit`]
///
///[`Client::task_submit`]: super::Client::task_submit
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskSubmit<'a> {
client: &'a super::Client,
body: Result<types::TaskSubmit, String>,
@ -542,7 +542,7 @@ pub mod builder {
///Builder for [`Client::task_events_get`]
///
///[`Client::task_events_get`]: super::Client::task_events_get
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskEventsGet<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -610,7 +610,7 @@ pub mod builder {
///Builder for [`Client::task_outputs_get`]
///
///[`Client::task_outputs_get`]: super::Client::task_outputs_get
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskOutputsGet<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -656,7 +656,7 @@ pub mod builder {
///Builder for [`Client::task_output_download`]
///
///[`Client::task_output_download`]: super::Client::task_output_download
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskOutputDownload<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -720,7 +720,7 @@ pub mod builder {
///Builder for [`Client::user_create`]
///
///[`Client::user_create`]: super::Client::user_create
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct UserCreate<'a> {
client: &'a super::Client,
body: Result<types::UserCreate, String>,
@ -762,7 +762,7 @@ pub mod builder {
///Builder for [`Client::whoami`]
///
///[`Client::whoami`]: super::Client::whoami
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct Whoami<'a> {
client: &'a super::Client,
}
@ -789,7 +789,7 @@ pub mod builder {
///Builder for [`Client::worker_bootstrap`]
///
///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerBootstrap<'a> {
client: &'a super::Client,
body: Result<types::WorkerBootstrap, String>,
@ -831,7 +831,7 @@ pub mod builder {
///Builder for [`Client::worker_ping`]
///
///[`Client::worker_ping`]: super::Client::worker_ping
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerPing<'a> {
client: &'a super::Client,
}
@ -858,7 +858,7 @@ pub mod builder {
///Builder for [`Client::worker_task_append`]
///
///[`Client::worker_task_append`]: super::Client::worker_task_append
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerTaskAppend<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -917,6 +917,7 @@ pub mod builder {
///Builder for [`Client::worker_task_upload_chunk`]
///
///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk
#[derive(Debug)]
pub struct WorkerTaskUploadChunk<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -983,7 +984,7 @@ pub mod builder {
///Builder for [`Client::worker_task_complete`]
///
///[`Client::worker_task_complete`]: super::Client::worker_task_complete
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerTaskComplete<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -1042,7 +1043,7 @@ pub mod builder {
///Builder for [`Client::worker_task_add_output`]
///
///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerTaskAddOutput<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -1101,7 +1102,7 @@ pub mod builder {
///Builder for [`Client::workers_list`]
///
///[`Client::workers_list`]: super::Client::workers_list
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkersList<'a> {
client: &'a super::Client,
}
@ -1128,7 +1129,7 @@ pub mod builder {
///Builder for [`Client::workers_recycle`]
///
///[`Client::workers_recycle`]: super::Client::workers_recycle
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkersRecycle<'a> {
client: &'a super::Client,
}

View File

@ -134,7 +134,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,
@ -375,7 +375,7 @@ pub mod builder {
///Builder for [`Client::control_hold`]
///
///[`Client::control_hold`]: super::Client::control_hold
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ControlHold<'a> {
client: &'a super::Client,
}
@ -402,7 +402,7 @@ pub mod builder {
///Builder for [`Client::control_resume`]
///
///[`Client::control_resume`]: super::Client::control_resume
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ControlResume<'a> {
client: &'a super::Client,
}
@ -429,7 +429,7 @@ pub mod builder {
///Builder for [`Client::task_get`]
///
///[`Client::task_get`]: super::Client::task_get
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskGet<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -475,7 +475,7 @@ pub mod builder {
///Builder for [`Client::tasks_get`]
///
///[`Client::tasks_get`]: super::Client::tasks_get
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TasksGet<'a> {
client: &'a super::Client,
}
@ -502,7 +502,7 @@ pub mod builder {
///Builder for [`Client::task_submit`]
///
///[`Client::task_submit`]: super::Client::task_submit
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskSubmit<'a> {
client: &'a super::Client,
body: Result<types::TaskSubmit, String>,
@ -544,7 +544,7 @@ pub mod builder {
///Builder for [`Client::task_events_get`]
///
///[`Client::task_events_get`]: super::Client::task_events_get
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskEventsGet<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -612,7 +612,7 @@ pub mod builder {
///Builder for [`Client::task_outputs_get`]
///
///[`Client::task_outputs_get`]: super::Client::task_outputs_get
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskOutputsGet<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -658,7 +658,7 @@ pub mod builder {
///Builder for [`Client::task_output_download`]
///
///[`Client::task_output_download`]: super::Client::task_output_download
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct TaskOutputDownload<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -722,7 +722,7 @@ pub mod builder {
///Builder for [`Client::user_create`]
///
///[`Client::user_create`]: super::Client::user_create
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct UserCreate<'a> {
client: &'a super::Client,
body: Result<types::UserCreate, String>,
@ -764,7 +764,7 @@ pub mod builder {
///Builder for [`Client::whoami`]
///
///[`Client::whoami`]: super::Client::whoami
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct Whoami<'a> {
client: &'a super::Client,
}
@ -791,7 +791,7 @@ pub mod builder {
///Builder for [`Client::worker_bootstrap`]
///
///[`Client::worker_bootstrap`]: super::Client::worker_bootstrap
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerBootstrap<'a> {
client: &'a super::Client,
body: Result<types::WorkerBootstrap, String>,
@ -833,7 +833,7 @@ pub mod builder {
///Builder for [`Client::worker_ping`]
///
///[`Client::worker_ping`]: super::Client::worker_ping
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerPing<'a> {
client: &'a super::Client,
}
@ -860,7 +860,7 @@ pub mod builder {
///Builder for [`Client::worker_task_append`]
///
///[`Client::worker_task_append`]: super::Client::worker_task_append
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerTaskAppend<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -919,6 +919,7 @@ pub mod builder {
///Builder for [`Client::worker_task_upload_chunk`]
///
///[`Client::worker_task_upload_chunk`]: super::Client::worker_task_upload_chunk
#[derive(Debug)]
pub struct WorkerTaskUploadChunk<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -985,7 +986,7 @@ pub mod builder {
///Builder for [`Client::worker_task_complete`]
///
///[`Client::worker_task_complete`]: super::Client::worker_task_complete
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerTaskComplete<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -1044,7 +1045,7 @@ pub mod builder {
///Builder for [`Client::worker_task_add_output`]
///
///[`Client::worker_task_add_output`]: super::Client::worker_task_add_output
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkerTaskAddOutput<'a> {
client: &'a super::Client,
task: Result<String, String>,
@ -1103,7 +1104,7 @@ pub mod builder {
///Builder for [`Client::workers_list`]
///
///[`Client::workers_list`]: super::Client::workers_list
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkersList<'a> {
client: &'a super::Client,
}
@ -1130,7 +1131,7 @@ pub mod builder {
///Builder for [`Client::workers_recycle`]
///
///[`Client::workers_recycle`]: super::Client::workers_recycle
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct WorkersRecycle<'a> {
client: &'a super::Client,
}

View File

@ -134,7 +134,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,

View File

@ -75,7 +75,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,
@ -181,7 +181,7 @@ pub mod builder {
///Builder for [`Client::enrol`]
///
///[`Client::enrol`]: super::Client::enrol
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct Enrol<'a> {
client: &'a super::Client,
body: Result<types::EnrolBody, String>,
@ -223,7 +223,7 @@ pub mod builder {
///Builder for [`Client::global_jobs`]
///
///[`Client::global_jobs`]: super::Client::global_jobs
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct GlobalJobs<'a> {
client: &'a super::Client,
}
@ -250,7 +250,7 @@ pub mod builder {
///Builder for [`Client::ping`]
///
///[`Client::ping`]: super::Client::ping
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct Ping<'a> {
client: &'a super::Client,
}
@ -277,7 +277,7 @@ pub mod builder {
///Builder for [`Client::report_finish`]
///
///[`Client::report_finish`]: super::Client::report_finish
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ReportFinish<'a> {
client: &'a super::Client,
body: Result<types::ReportFinishBody, String>,
@ -319,7 +319,7 @@ pub mod builder {
///Builder for [`Client::report_output`]
///
///[`Client::report_output`]: super::Client::report_output
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ReportOutput<'a> {
client: &'a super::Client,
body: Result<types::ReportOutputBody, String>,
@ -361,7 +361,7 @@ pub mod builder {
///Builder for [`Client::report_start`]
///
///[`Client::report_start`]: super::Client::report_start
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ReportStart<'a> {
client: &'a super::Client,
body: Result<types::ReportStartBody, String>,

View File

@ -75,7 +75,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,
@ -183,7 +183,7 @@ pub mod builder {
///Builder for [`Client::enrol`]
///
///[`Client::enrol`]: super::Client::enrol
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct Enrol<'a> {
client: &'a super::Client,
body: Result<types::EnrolBody, String>,
@ -225,7 +225,7 @@ pub mod builder {
///Builder for [`Client::global_jobs`]
///
///[`Client::global_jobs`]: super::Client::global_jobs
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct GlobalJobs<'a> {
client: &'a super::Client,
}
@ -252,7 +252,7 @@ pub mod builder {
///Builder for [`Client::ping`]
///
///[`Client::ping`]: super::Client::ping
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct Ping<'a> {
client: &'a super::Client,
}
@ -279,7 +279,7 @@ pub mod builder {
///Builder for [`Client::report_finish`]
///
///[`Client::report_finish`]: super::Client::report_finish
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ReportFinish<'a> {
client: &'a super::Client,
body: Result<types::ReportFinishBody, String>,
@ -321,7 +321,7 @@ pub mod builder {
///Builder for [`Client::report_output`]
///
///[`Client::report_output`]: super::Client::report_output
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ReportOutput<'a> {
client: &'a super::Client,
body: Result<types::ReportOutputBody, String>,
@ -363,7 +363,7 @@ pub mod builder {
///Builder for [`Client::report_start`]
///
///[`Client::report_start`]: super::Client::report_start
#[derive(Clone)]
#[derive(Debug, Clone)]
pub struct ReportStart<'a> {
client: &'a super::Client,
body: Result<types::ReportStartBody, String>,

View File

@ -75,7 +75,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2885,7 +2885,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,

View File

@ -34,7 +34,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,

View File

@ -15,7 +15,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,

View File

@ -15,7 +15,7 @@ pub mod types {
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Client {
pub(crate) baseurl: String,
pub(crate) client: reqwest::Client,