From e3f5249230d3ffa38d7185883950c446dc678582 Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Wed, 22 Jan 2025 11:10:14 -0800 Subject: [PATCH] fix Signed-off-by: Jess Frazelle --- remote/remote-api.rs.patch.json | 2 +- remote/src/employments.rs | 2 +- remote/src/types.rs | 5 +++-- specs/remote.json | 3 ++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/remote/remote-api.rs.patch.json b/remote/remote-api.rs.patch.json index 43d3521..9f2f033 100644 --- a/remote/remote-api.rs.patch.json +++ b/remote/remote-api.rs.patch.json @@ -59,7 +59,7 @@ "op": "add", "path": "/paths/~1v1~1employments/post/x-rust", "value": { - "example": "/// Create employment\n/// \n/// Creates an employment. We support creating employees and contractors.\n/// \n/// This endpoint requires and returns country-specific data. The exact required and returned fields will\n/// vary depending on which country the employment is in. To see the list of parameters for each country,\n/// see the **Show form schema** endpoint under the [Countries](#tag/Countries) category.\n/// \n/// Please note that the compliance requirements for each country are subject to change, which will result\n/// in required and optional parameters being added and deleted without notice.\n/// \n/// If you are using this endpoint to build an integration, make sure you are dynamically collecting or\n/// displaying the latest parameters for each country by querying the _\"Show form schema\"_ endpoint.\n/// \n/// For more information on JSON Schemas, see the **How JSON Schemas work** documentation.\n/// \n/// To learn how you can dynamically generate forms to display in your UI, see the documentation for\n/// the [json-schema-form](https://www.notion.so/remotecom/json-schema-form-Documentation-4f390236948b4b2e8b7350ebcd488ca6) tool.\n/// \n/// \nasync fn example_employments_post_create() -> anyhow::Result<()> {\n let client = remote_api::Client::new_from_env();\n let result: remote_api::types::EmploymentResponse = client\n .employments()\n .post_create(&remote_api::types::EmploymentBasicParams {\n company_id: \"some-string\".to_string(),\n country_code: Some(\"some-string\".to_string()),\n full_name: \"some-string\".to_string(),\n job_title: \"some-string\".to_string(),\n personal_email: \"email@example.com\".to_string(),\n provisional_start_date: Some(chrono::Utc::now().date_naive()),\n type_: remote_api::types::EmploymentBasicParamsType::Contractor,\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", + "example": "/// Create employment\n/// \n/// Creates an employment. We support creating employees and contractors.\n/// \n/// This endpoint requires and returns country-specific data. The exact required and returned fields will\n/// vary depending on which country the employment is in. To see the list of parameters for each country,\n/// see the **Show form schema** endpoint under the [Countries](#tag/Countries) category.\n/// \n/// Please note that the compliance requirements for each country are subject to change, which will result\n/// in required and optional parameters being added and deleted without notice.\n/// \n/// If you are using this endpoint to build an integration, make sure you are dynamically collecting or\n/// displaying the latest parameters for each country by querying the _\"Show form schema\"_ endpoint.\n/// \n/// For more information on JSON Schemas, see the **How JSON Schemas work** documentation.\n/// \n/// To learn how you can dynamically generate forms to display in your UI, see the documentation for\n/// the [json-schema-form](https://www.notion.so/remotecom/json-schema-form-Documentation-4f390236948b4b2e8b7350ebcd488ca6) tool.\n/// \n/// \nasync fn example_employments_post_create() -> anyhow::Result<()> {\n let client = remote_api::Client::new_from_env();\n let result: remote_api::types::EmploymentResponse = client\n .employments()\n .post_create(&remote_api::types::EmploymentBasicParams {\n company_id: \"some-string\".to_string(),\n country_code: Some(\"some-string\".to_string()),\n full_name: \"some-string\".to_string(),\n job_title: Some(\"some-string\".to_string()),\n personal_email: \"email@example.com\".to_string(),\n provisional_start_date: Some(chrono::Utc::now().date_naive()),\n type_: remote_api::types::EmploymentBasicParamsType::Contractor,\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", "libDocsLink": "https://docs.rs/remote-api/latest/remote-api/employments/struct.Employments.html#method.post_create" } }, diff --git a/remote/src/employments.rs b/remote/src/employments.rs index 4b0b1c3..1349321 100644 --- a/remote/src/employments.rs +++ b/remote/src/employments.rs @@ -58,7 +58,7 @@ impl Employments { } } - #[doc = "Create employment\n\nCreates an employment. We support creating employees and contractors.\n\nThis endpoint requires and returns country-specific data. The exact required and returned fields will\nvary depending on which country the employment is in. To see the list of parameters for each country,\nsee the **Show form schema** endpoint under the [Countries](#tag/Countries) category.\n\nPlease note that the compliance requirements for each country are subject to change, which will result\nin required and optional parameters being added and deleted without notice.\n\nIf you are using this endpoint to build an integration, make sure you are dynamically collecting or\ndisplaying the latest parameters for each country by querying the _\"Show form schema\"_ endpoint.\n\nFor more information on JSON Schemas, see the **How JSON Schemas work** documentation.\n\nTo learn how you can dynamically generate forms to display in your UI, see the documentation for\nthe [json-schema-form](https://www.notion.so/remotecom/json-schema-form-Documentation-4f390236948b4b2e8b7350ebcd488ca6) tool.\n\n\n\n```rust,no_run\nasync fn example_employments_post_create() -> anyhow::Result<()> {\n let client = remote_api::Client::new_from_env();\n let result: remote_api::types::EmploymentResponse = client\n .employments()\n .post_create(&remote_api::types::EmploymentBasicParams {\n company_id: \"some-string\".to_string(),\n country_code: Some(\"some-string\".to_string()),\n full_name: \"some-string\".to_string(),\n job_title: \"some-string\".to_string(),\n personal_email: \"email@example.com\".to_string(),\n provisional_start_date: Some(chrono::Utc::now().date_naive()),\n type_: remote_api::types::EmploymentBasicParamsType::Contractor,\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"] + #[doc = "Create employment\n\nCreates an employment. We support creating employees and contractors.\n\nThis endpoint requires and returns country-specific data. The exact required and returned fields will\nvary depending on which country the employment is in. To see the list of parameters for each country,\nsee the **Show form schema** endpoint under the [Countries](#tag/Countries) category.\n\nPlease note that the compliance requirements for each country are subject to change, which will result\nin required and optional parameters being added and deleted without notice.\n\nIf you are using this endpoint to build an integration, make sure you are dynamically collecting or\ndisplaying the latest parameters for each country by querying the _\"Show form schema\"_ endpoint.\n\nFor more information on JSON Schemas, see the **How JSON Schemas work** documentation.\n\nTo learn how you can dynamically generate forms to display in your UI, see the documentation for\nthe [json-schema-form](https://www.notion.so/remotecom/json-schema-form-Documentation-4f390236948b4b2e8b7350ebcd488ca6) tool.\n\n\n\n```rust,no_run\nasync fn example_employments_post_create() -> anyhow::Result<()> {\n let client = remote_api::Client::new_from_env();\n let result: remote_api::types::EmploymentResponse = client\n .employments()\n .post_create(&remote_api::types::EmploymentBasicParams {\n company_id: \"some-string\".to_string(),\n country_code: Some(\"some-string\".to_string()),\n full_name: \"some-string\".to_string(),\n job_title: Some(\"some-string\".to_string()),\n personal_email: \"email@example.com\".to_string(),\n provisional_start_date: Some(chrono::Utc::now().date_naive()),\n type_: remote_api::types::EmploymentBasicParamsType::Contractor,\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"] #[tracing::instrument] pub async fn post_create<'a>( &'a self, diff --git a/remote/src/types.rs b/remote/src/types.rs index 089c2aa..e27451f 100644 --- a/remote/src/types.rs +++ b/remote/src/types.rs @@ -1645,7 +1645,8 @@ pub struct EmploymentBasicParams { #[serde(default, skip_serializing_if = "Option::is_none")] pub country_code: Option, pub full_name: String, - pub job_title: String, + #[serde(default, skip_serializing_if = "Option::is_none")] + pub job_title: Option, pub personal_email: String, #[doc = "Required for employees, optional for contractors"] #[serde(default, skip_serializing_if = "Option::is_none")] @@ -1672,7 +1673,7 @@ impl tabled::Tabled for EmploymentBasicParams { self.company_id.clone().into(), format!("{:?}", self.country_code).into(), self.full_name.clone().into(), - self.job_title.clone().into(), + format!("{:?}", self.job_title).into(), self.personal_email.clone().into(), if let Some(provisional_start_date) = &self.provisional_start_date { format!("{:?}", provisional_start_date).into() diff --git a/specs/remote.json b/specs/remote.json index 9cb571c..1b367df 100644 --- a/specs/remote.json +++ b/specs/remote.json @@ -882,7 +882,8 @@ "job_title": { "type": "string", "x-struct": null, - "x-validate": null + "x-validate": null, + "nullable": true }, "personal_email": { "format": "email",