From 9b406733c6f1aa3224b5a8f736b403fc74d1768c Mon Sep 17 00:00:00 2001 From: Brighton Cox Date: Thu, 12 Jun 2025 15:10:32 -0600 Subject: [PATCH 1/2] Updated lookup to skip country serialization if it's none --- .envrc | 7 ++ .gitignore | 11 ++- devenv.lock | 103 ++++++++++++++++++++ devenv.nix | 5 + devenv.yaml | 15 +++ smarty-rust-sdk/src/us_street_api/lookup.rs | 18 ++-- 6 files changed, 150 insertions(+), 9 deletions(-) create mode 100644 .envrc create mode 100644 devenv.lock create mode 100644 devenv.nix create mode 100644 devenv.yaml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..e3c2943 --- /dev/null +++ b/.envrc @@ -0,0 +1,7 @@ +export DIRENV_WARN_TIMEOUT=20s + +eval "$(devenv direnvrc)" + +# The use_devenv function supports passing flags to the devenv command +# For example: use devenv --impure --option services.postgres.enable:bool true +use devenv diff --git a/.gitignore b/.gitignore index 94b60f7..2df0665 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,13 @@ *DS_Store* *.swp *.iml -__MACOSX \ No newline at end of file +__MACOSX +# Devenv +.devenv* +devenv.local.nix + +# direnv +.direnv + +# pre-commit +.pre-commit-config.yaml diff --git a/devenv.lock b/devenv.lock new file mode 100644 index 0000000..b5b04f8 --- /dev/null +++ b/devenv.lock @@ -0,0 +1,103 @@ +{ + "nodes": { + "devenv": { + "locked": { + "dir": "src/modules", + "lastModified": 1749743313, + "owner": "cachix", + "repo": "devenv", + "rev": "7d2fab8f90ff435ec0ca656da2cbae4cb1a324de", + "type": "github" + }, + "original": { + "dir": "src/modules", + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "git-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1749636823, + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "623c56286de5a3193aa38891a6991b28f9bab056", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "git-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1746807397, + "owner": "cachix", + "repo": "devenv-nixpkgs", + "rev": "c5208b594838ea8e6cca5997fbf784b7cca1ca90", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "rolling", + "repo": "devenv-nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": "devenv", + "git-hooks": "git-hooks", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": [ + "git-hooks" + ] + } + } + }, + "root": "root", + "version": 7 +} diff --git a/devenv.nix b/devenv.nix new file mode 100644 index 0000000..7013cfa --- /dev/null +++ b/devenv.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: { + packages = [pkgs.openssl]; + + languages.rust.enable = true; +} diff --git a/devenv.yaml b/devenv.yaml new file mode 100644 index 0000000..116a2ad --- /dev/null +++ b/devenv.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json +inputs: + nixpkgs: + url: github:cachix/devenv-nixpkgs/rolling + +# If you're using non-OSS software, you can set allowUnfree to true. +# allowUnfree: true + +# If you're willing to use a package that's vulnerable +# permittedInsecurePackages: +# - "openssl-1.1.1w" + +# If you have more than one devenv you can merge them +#imports: +# - ./backend diff --git a/smarty-rust-sdk/src/us_street_api/lookup.rs b/smarty-rust-sdk/src/us_street_api/lookup.rs index 3b53b34..bc34709 100644 --- a/smarty-rust-sdk/src/us_street_api/lookup.rs +++ b/smarty-rust-sdk/src/us_street_api/lookup.rs @@ -38,7 +38,7 @@ pub struct Lookup { #[serde(rename = "format")] pub format_output: OutputFormat, - pub county_source: CountySource, + pub county_source: Option, #[serde(skip_serializing)] pub results: Candidates, @@ -79,7 +79,7 @@ impl Lookup { max_candidates_string = 5.to_string(); } - vec![ + let mut res = vec![ has_param("street".to_string(), self.street), has_param("street2".to_string(), self.street2), has_param("secondary".to_string(), self.secondary), @@ -93,11 +93,13 @@ impl Lookup { has_param("candidates".to_string(), max_candidates_string), has_param("match".to_string(), self.match_strategy.to_string()), has_param("format".to_string(), self.format_output.to_string()), - has_param("county_source".to_string(), self.county_source.to_string()), - ] - .iter() - .filter_map(Option::clone) - .collect::>() + ]; + + if let Some(source) = self.county_source { + res.push(Some(("country_source".to_string(), source.to_string()))); + } + + res.iter().filter_map(Option::clone).collect::>() } } @@ -165,4 +167,4 @@ impl Display for CountySource { } } } -} \ No newline at end of file +} From 6ce8f5a2f7d6bc7ca4e9ba64b9add845cc3d401a Mon Sep 17 00:00:00 2001 From: Brighton Cox Date: Thu, 12 Jun 2025 15:25:13 -0600 Subject: [PATCH 2/2] Removed devenv tooling --- .envrc | 7 ---- .gitignore | 9 ----- devenv.lock | 103 ---------------------------------------------------- devenv.nix | 5 --- devenv.yaml | 15 -------- 5 files changed, 139 deletions(-) delete mode 100644 .envrc delete mode 100644 devenv.lock delete mode 100644 devenv.nix delete mode 100644 devenv.yaml diff --git a/.envrc b/.envrc deleted file mode 100644 index e3c2943..0000000 --- a/.envrc +++ /dev/null @@ -1,7 +0,0 @@ -export DIRENV_WARN_TIMEOUT=20s - -eval "$(devenv direnvrc)" - -# The use_devenv function supports passing flags to the devenv command -# For example: use devenv --impure --option services.postgres.enable:bool true -use devenv diff --git a/.gitignore b/.gitignore index 2df0665..4af2394 100644 --- a/.gitignore +++ b/.gitignore @@ -14,12 +14,3 @@ *.swp *.iml __MACOSX -# Devenv -.devenv* -devenv.local.nix - -# direnv -.direnv - -# pre-commit -.pre-commit-config.yaml diff --git a/devenv.lock b/devenv.lock deleted file mode 100644 index b5b04f8..0000000 --- a/devenv.lock +++ /dev/null @@ -1,103 +0,0 @@ -{ - "nodes": { - "devenv": { - "locked": { - "dir": "src/modules", - "lastModified": 1749743313, - "owner": "cachix", - "repo": "devenv", - "rev": "7d2fab8f90ff435ec0ca656da2cbae4cb1a324de", - "type": "github" - }, - "original": { - "dir": "src/modules", - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1747046372, - "owner": "edolstra", - "repo": "flake-compat", - "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "git-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1749636823, - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "623c56286de5a3193aa38891a6991b28f9bab056", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1746807397, - "owner": "cachix", - "repo": "devenv-nixpkgs", - "rev": "c5208b594838ea8e6cca5997fbf784b7cca1ca90", - "type": "github" - }, - "original": { - "owner": "cachix", - "ref": "rolling", - "repo": "devenv-nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "devenv": "devenv", - "git-hooks": "git-hooks", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": [ - "git-hooks" - ] - } - } - }, - "root": "root", - "version": 7 -} diff --git a/devenv.nix b/devenv.nix deleted file mode 100644 index 7013cfa..0000000 --- a/devenv.nix +++ /dev/null @@ -1,5 +0,0 @@ -{pkgs, ...}: { - packages = [pkgs.openssl]; - - languages.rust.enable = true; -} diff --git a/devenv.yaml b/devenv.yaml deleted file mode 100644 index 116a2ad..0000000 --- a/devenv.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json -inputs: - nixpkgs: - url: github:cachix/devenv-nixpkgs/rolling - -# If you're using non-OSS software, you can set allowUnfree to true. -# allowUnfree: true - -# If you're willing to use a package that's vulnerable -# permittedInsecurePackages: -# - "openssl-1.1.1w" - -# If you have more than one devenv you can merge them -#imports: -# - ./backend