Repository: mirumee/ariadne-codegen (language: python)

Issue:
[bug] Fix scalar data issue in plugin settings
For some reason when loading the config during plugin execution, `ScalarData` has already been converted which causes this code to throw an error.  I added a check to take the `ScalarData` as is if it has already been converted.

Update: this seems to only happen when using `ariadne_codegen.contrib.extract_operations.ExtractOperationsPlugin`


Discussion / hints:
@mat-sop updated!
Thank you!

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c7e3622..fca48a85 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
 ## 0.12.0 (UNRELEASED)
 
 - Fixed `graphql-transport-ws` protocol implementation not waiting for the `connection_ack` message on new connection.
+- Fixed `get_client_settings` mutating `config_dict` instance.
 - Added support to `graphqlschema` for saving schema as a GraphQL file.
 
 


Test patch:
diff --git a/tests/test_config.py b/tests/test_config.py
index b728af64..2157fe02 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -112,6 +112,16 @@ def test_get_client_settings_returns_client_settings_object(tmp_path):
         )
     }
 
+    # Regression test for #256: don't mutate config_dict's scalars
+    assert config_dict["tool"]["ariadne-codegen"]["scalars"] == {
+        "ID": {
+            "type": "str",
+            "parse": "parse_id",
+            "serialize": "serialize_id",
+            "import": ".custom_scalars",
+        },
+    }
+
 
 def test_get_client_settings_without_section_raises_missing_configuration_exception():
     config_dict = {"invalid-section": {"schema_path": "."}}