Skip to content

Conversation

@fern-api
Copy link

@fern-api fern-api bot commented Jan 27, 2026

This PR regenerates code to match the latest API Definition.

@fern-api fern-api bot requested a review from a team as a code owner January 27, 2026 13:43
json_encoders = {dt.datetime: serialize_datetime}

@pydantic.root_validator(pre=True)
def _coerce_field_names_to_aliases(cls, values: Any) -> Any:

Check notice

Code scanning / CodeQL

First parameter of a method is not named 'self' Note

Normal methods should have 'self', rather than 'cls', as their first parameter.

Copilot Autofix

AI about 15 hours ago

In general, to fix this issue you either (a) make the method a proper classmethod and keep cls as the first parameter, or (b) leave it as an instance method and rename the first parameter to self (and adjust its internal usage accordingly). Since this validator logically operates on the class (cls) and not on an instance, the best fix without changing functionality is to convert it to a classmethod.

Concretely, in src/auth0/management/core/pydantic_utilities.py, within the else: branch of class UniversalBaseModel(pydantic.BaseModel):, we should add the @classmethod decorator immediately above the existing @pydantic.root_validator(pre=True) decorator. The method signature can remain def _coerce_field_names_to_aliases(cls, values: Any) -> Any: because once @classmethod is applied, cls is the correct conventional name. The body of the method does not need any changes, since it already refers to cls correctly and uses values as the second argument.

No new imports or additional definitions are required; classmethod is built in and already available.

Suggested changeset 1
src/auth0/management/core/pydantic_utilities.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/auth0/management/core/pydantic_utilities.py b/src/auth0/management/core/pydantic_utilities.py
--- a/src/auth0/management/core/pydantic_utilities.py
+++ b/src/auth0/management/core/pydantic_utilities.py
@@ -138,6 +138,7 @@
             smart_union = True
             json_encoders = {dt.datetime: serialize_datetime}
 
+        @classmethod
         @pydantic.root_validator(pre=True)
         def _coerce_field_names_to_aliases(cls, values: Any) -> Any:
             """
EOF
@@ -138,6 +138,7 @@
smart_union = True
json_encoders = {dt.datetime: serialize_datetime}

@classmethod
@pydantic.root_validator(pre=True)
def _coerce_field_names_to_aliases(cls, values: Any) -> Any:
"""
Copilot is powered by AI and may make mistakes. Always verify output.
"""Gets the dynamically assigned port for the WireMock container."""
compose_file = _compose_file()
project = _project_name()
try:

Check notice

Code scanning / CodeQL

Unused global variable Note test

The global variable '_STARTED' is not used.

Copilot Autofix

AI about 15 hours ago

In general, to fix an unused global variable you either (1) remove it if it truly adds no behavior, (2) rename it to an “unused” style name if it is intentionally unused, or (3) actually use it in logic if it was meant to be used. Here, _STARTED is only meaningful inside _start_wiremock and is not exposed outside the module; we can avoid the global state entirely and instead infer whether WireMock has already been started from an observable side effect we already rely on: the WIREMOCK_PORT environment variable.

Best fix without changing external functionality:

  • Remove the module-level _STARTED declaration.
  • Stop using _STARTED as a guard in _start_wiremock.
  • Use os.environ.get("WIREMOCK_PORT") as the “started” flag: if it is set, we consider WireMock already started and return immediately. This maintains the “start once per process” behavior while removing the unused global.
  • Because the code already sets os.environ["WIREMOCK_PORT"] after starting WireMock, no additional imports are needed.

Concretely in tests/conftest.py:

  1. Delete line 17 (_STARTED: bool = False).
  2. In _start_wiremock, remove _STARTED from the global statement.
  3. Replace the if _STARTED: guard with an environment-based guard.
  4. Remove the assignment _STARTED = True after a successful start.

No other files need to be touched.

Suggested changeset 1
tests/conftest.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/conftest.py b/tests/conftest.py
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -14,7 +14,6 @@
 
 import pytest
 
-_STARTED: bool = False
 _WIREMOCK_PORT: str = "8080"  # Default, will be updated after container starts
 
 
@@ -58,8 +57,9 @@
 
 def _start_wiremock() -> None:
     """Starts the WireMock container using docker-compose."""
-    global _STARTED, _WIREMOCK_PORT
-    if _STARTED:
+    global _WIREMOCK_PORT
+    # If the environment variable is already set, assume WireMock has been started.
+    if os.environ.get("WIREMOCK_PORT"):
         return
 
     compose_file = _compose_file()
@@ -75,7 +75,6 @@
         _WIREMOCK_PORT = _get_wiremock_port()
         os.environ["WIREMOCK_PORT"] = _WIREMOCK_PORT
         print(f"WireMock container is ready on port {_WIREMOCK_PORT}")
-        _STARTED = True
     except subprocess.CalledProcessError as e:
         print(f"Failed to start WireMock: {e.stderr}")
         raise
EOF
@@ -14,7 +14,6 @@

import pytest

_STARTED: bool = False
_WIREMOCK_PORT: str = "8080" # Default, will be updated after container starts


@@ -58,8 +57,9 @@

def _start_wiremock() -> None:
"""Starts the WireMock container using docker-compose."""
global _STARTED, _WIREMOCK_PORT
if _STARTED:
global _WIREMOCK_PORT
# If the environment variable is already set, assume WireMock has been started.
if os.environ.get("WIREMOCK_PORT"):
return

compose_file = _compose_file()
@@ -75,7 +75,6 @@
_WIREMOCK_PORT = _get_wiremock_port()
os.environ["WIREMOCK_PORT"] = _WIREMOCK_PORT
print(f"WireMock container is ready on port {_WIREMOCK_PORT}")
_STARTED = True
except subprocess.CalledProcessError as e:
print(f"Failed to start WireMock: {e.stderr}")
raise
Copilot is powered by AI and may make mistakes. Always verify output.
headers=test_headers,
token="test_token",
)
except (TypeError, ValueError):

Check notice

Code scanning / CodeQL

Empty except Note test

'except' clause does nothing but pass and there is no explanatory comment.

Copilot Autofix

AI about 15 hours ago

In general, an empty except should either be removed (letting the exception propagate), narrowed to only the expected error type, or augmented to log and/or document why the exception is being ignored. For feature-detection patterns like this (trying one API shape and falling back to another), the best fix is to keep the fallback behavior but add a clear comment and minimal logging of the exception so it’s not entirely silent.

For this specific code in tests/wire/conftest.py, we should:

  • Keep the try/except and the fallback construction using httpx.Client, so existing test behavior is unchanged.
  • Add a short explanatory comment in the except block stating that this is a compatibility fallback for different Auth0 constructor signatures.
  • Optionally (and still lightweight), log the exception to pytest’s internal logging or to standard output, but since we should avoid changing imports too much and keep tests quiet, a simple comment is enough to satisfy both CodeQL and clarity; however, to meaningfully “handle” the exception, the minimal change is to add a comment plus an explicit no-op statement like # ... plus return or just leave the fallback; in Python, a comment alone doesn’t count as code, but CodeQL’s rule is mainly about explanation. To be safe we can add a comment explaining the swallow, leaving pass as the explicit no-op.

The smallest change within the shown snippet is to replace the bare pass with a comment explaining the intentional ignore plus pass. No imports or new methods are required.

Suggested changeset 1
tests/wire/conftest.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/tests/wire/conftest.py b/tests/wire/conftest.py
--- a/tests/wire/conftest.py
+++ b/tests/wire/conftest.py
@@ -46,6 +46,7 @@
                 token="test_token",
             )
     except (TypeError, ValueError):
+        # Fallback for environments where Auth0 signature or constructor does not accept 'headers'.
         pass
 
     import httpx
EOF
@@ -46,6 +46,7 @@
token="test_token",
)
except (TypeError, ValueError):
# Fallback for environments where Auth0 signature or constructor does not accept 'headers'.
pass

import httpx
Copilot is powered by AI and may make mistakes. Always verify output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants