Skip to content

Commit 380cba4

Browse files
pattisdrgalvanaeastandwestwind
authored andcommitted
Fides Pydantic V2 Upgrade (#5020)
Pydantic v1 -> Pydantic v2 upgrade Co-authored-by: Adrian Galvan <[email protected]> Co-authored-by: eastandwestwind <[email protected]>
1 parent 23c8382 commit 380cba4

File tree

577 files changed

+3862
-3483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

577 files changed

+3862
-3483
lines changed

.github/workflows/backend_checks.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
strategy:
4444
matrix:
4545
# NOTE: These are the currently supported/tested Python Versions
46-
python_version: ["3.8.18", "3.9.18", "3.10.13"]
46+
python_version: ["3.9.18", "3.10.13"]
4747
runs-on: ubuntu-latest
4848
steps:
4949
- name: Checkout
@@ -223,7 +223,7 @@ jobs:
223223
needs: Check-Container-Startup
224224
strategy:
225225
matrix:
226-
python_version: ["3.8.18", "3.9.18", "3.10.13"]
226+
python_version: ["3.9.18", "3.10.13"]
227227
test_selection:
228228
- "ctl-not-external"
229229
- "ops-unit-api"
@@ -275,7 +275,7 @@ jobs:
275275
strategy:
276276
max-parallel: 1 # This prevents collisions in shared external resources
277277
matrix:
278-
python_version: ["3.8.18", "3.9.18", "3.10.13"]
278+
python_version: ["3.9.18", "3.10.13"]
279279
runs-on: ubuntu-latest
280280
timeout-minutes: 20
281281
# In PRs run with the "unsafe" label, or run on a "push" event to main
@@ -315,7 +315,7 @@ jobs:
315315
strategy:
316316
max-parallel: 1 # This prevents collisions in shared external resources
317317
matrix:
318-
python_version: ["3.8.18", "3.9.18", "3.10.13"]
318+
python_version: ["3.9.18", "3.10.13"]
319319
runs-on: ubuntu-latest
320320
timeout-minutes: 20
321321
# In PRs run with the "unsafe" label, or run on a "push" event to main
@@ -381,7 +381,7 @@ jobs:
381381
strategy:
382382
max-parallel: 1 # This prevents collisions in shared external resources
383383
matrix:
384-
python_version: ["3.8.18", "3.9.18", "3.10.13"]
384+
python_version: ["3.9.18", "3.10.13"]
385385
steps:
386386
- name: Download container
387387
uses: actions/download-artifact@v4

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ The types of changes are:
1717

1818
## [Unreleased](https://github.com/ethyca/fides/compare/2.43.0...main)
1919

20+
### Added
21+
- Pydantic v1 -> Pydantic v2 upgrade [#5020](https://github.com/ethyca/fides/pull/5020)
22+
2023
### Fixed
2124
- Ignore `404` errors on Oracle Responsys deletions [#5203](https://github.com/ethyca/fides/pull/5203)
2225
- Fix white screen issue when privacy request has null value for daysLeft [#5213](https://github.com/ethyca/fides/pull/5213)

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ In order to get started quickly with Fides, a sample project is bundled within t
2525
#### Minimum requirements (for all platforms)
2626

2727
* [Docker](https://www.docker.com/products/docker-desktop) (version 20.10.11 or later)
28-
* [Python](https://www.python.org/downloads/) (version 3.8 through 3.10)
28+
* [Python](https://www.python.org/downloads/) (version 3.9 through 3.10)
2929

3030
#### Download and install Fides
3131

clients/admin-ui/src/features/common/ConnectedCircle.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Box, BoxProps } from "fidesui";
33
const ConnectedCircle = ({
44
connected,
55
...other
6-
}: { connected?: boolean } & BoxProps) => {
6+
}: { connected?: boolean | null } & BoxProps) => {
77
let color = "red.500";
88
if (connected == null) {
99
color = "gray.300";

clients/admin-ui/src/features/common/SystemsCheckboxTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export const SystemTableCell = ({
5454
whiteSpace="nowrap"
5555
overflow="hidden"
5656
textOverflow="ellipsis"
57-
title={system.fidesctl_meta?.resource_id}
57+
title={system.fidesctl_meta?.resource_id || ""}
5858
>
5959
{system.fidesctl_meta?.resource_id}
6060
</Box>

clients/admin-ui/src/features/common/form/inputs.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type Variant = "inline" | "stacked" | "block";
6464
export interface CustomInputProps {
6565
disabled?: boolean;
6666
label?: string;
67-
tooltip?: string;
67+
tooltip?: string | null;
6868
variant?: Variant;
6969
isRequired?: boolean;
7070
textColor?: string;
@@ -172,7 +172,7 @@ const ClearIndicator = () => null;
172172
export interface Option {
173173
value: string;
174174
label: string;
175-
description?: string;
175+
description?: string | null;
176176
tooltip?: string;
177177
}
178178

@@ -204,8 +204,8 @@ export interface SelectProps {
204204
label?: string;
205205
labelProps?: FormLabelProps;
206206
placeholder?: string;
207-
tooltip?: string;
208-
options: Option[];
207+
tooltip?: string | null;
208+
options?: Option[] | [];
209209
isDisabled?: boolean;
210210
isSearchable?: boolean;
211211
isClearable?: boolean;
@@ -247,7 +247,7 @@ export const SELECT_STYLES: ChakraStylesConfig<
247247
};
248248

249249
export const SelectInput = ({
250-
options,
250+
options = [],
251251
fieldName,
252252
placeholder,
253253
size,
@@ -399,7 +399,7 @@ interface CreatableSelectProps extends SelectProps {
399399
disableMenu?: boolean;
400400
}
401401
const CreatableSelectInput = ({
402-
options,
402+
options = [],
403403
placeholder,
404404
fieldName,
405405
size,

clients/admin-ui/src/features/common/hooks/usePicker.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ interface UsePaginatedPickerProps {
5151
initialSelected: string[];
5252
initialExcluded: string[];
5353
initialAllSelected?: boolean;
54-
itemCount: number;
54+
itemCount: number | null;
5555
}
5656

5757
export const usePaginatedPicker = ({

clients/admin-ui/src/features/common/hooks/useTaxonomies.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ const useTaxonomies = () => {
3535
fidesLangKey: string,
3636
getDataFunction: (fidesLangKey: string) =>
3737
| {
38-
parent_key?: string;
39-
name?: string;
38+
parent_key?: string | null;
39+
name?: string | null;
4040
}
4141
| undefined,
4242
primaryLevel = 1,

clients/admin-ui/src/features/common/system-data-flow/DataFlowAccordion.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Accordion } from "fidesui";
22
import React from "react";
33

4-
import { System } from "~/types/api/models/System";
4+
import { System } from "~/types/api";
55

66
import { DataFlowAccordionForm } from "./DataFlowAccordionForm";
77

clients/admin-ui/src/features/common/table/v2/PaginationBar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const useServerSidePagination = () => {
4545
const defaultPageIndex = 1;
4646
const [pageSize, setPageSize] = useState(PAGE_SIZES[0]);
4747
const [pageIndex, setPageIndex] = useState<number>(defaultPageIndex);
48-
const [totalPages, setTotalPages] = useState<number>();
48+
const [totalPages, setTotalPages] = useState<number | null>();
4949
const onPreviousPageClick = useCallback(() => {
5050
setPageIndex((prev) => prev - 1);
5151
}, [setPageIndex]);

clients/admin-ui/src/features/common/table/v2/cells.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { RTKResult } from "~/types/errors";
2727
export const DefaultCell = ({
2828
value,
2929
}: {
30-
value: string | undefined | number | boolean;
30+
value: string | undefined | number | null | boolean;
3131
}) => (
3232
<Flex alignItems="center" height="100%">
3333
<Text
@@ -60,7 +60,7 @@ const FidesBadge = ({ children, ...props }: BadgeProps) => (
6060
export const RelativeTimestampCell = ({
6161
time,
6262
}: {
63-
time?: string | number | Date;
63+
time?: string | number | Date | null;
6464
}) => {
6565
if (!time) {
6666
return <DefaultCell value="N/A" />;

clients/admin-ui/src/features/configure-consent/AddVendor.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ const AddVendor = ({
171171
handleCloseModal();
172172
};
173173

174-
const handleVendorSelected = (vendorId?: string) => {
174+
const handleVendorSelected = (vendorId?: string | null) => {
175175
if (!dictionaryService) {
176176
return;
177177
}

clients/admin-ui/src/features/configure-consent/ConsentManagementTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ export const ConsentManagementTable = () => {
295295
</TableActionBar>
296296
<FidesTableV2 tableInstance={tableInstance} onRowClick={onRowClick} />
297297
<PaginationBar
298-
totalRows={totalRows}
298+
totalRows={totalRows || 0}
299299
pageSizes={PAGE_SIZES}
300300
setPageSize={setPageSize}
301301
onPreviousPageClick={onPreviousPageClick}

clients/admin-ui/src/features/consent-settings/GppConfiguration.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,14 @@ const GppConfiguration = () => {
7676
name="gpp.mspa_service_provider_mode"
7777
variant="switchFirst"
7878
tooltip="Enable service provider mode if you do not engage in any sales or sharing of personal information."
79-
isDisabled={values.gpp.mspa_opt_out_option_mode}
79+
isDisabled={Boolean(values.gpp.mspa_opt_out_option_mode)}
8080
/>
8181
<CustomSwitch
8282
label="Enable MSPA opt-out option mode"
8383
name="gpp.mspa_opt_out_option_mode"
8484
variant="switchFirst"
8585
tooltip="Enable opt-out option mode if you engage or may engage in the sales or sharing of personal information, or process any information for the purpose of targeted advertising."
86-
isDisabled={values.gpp.mspa_service_provider_mode}
86+
isDisabled={Boolean(values.gpp.mspa_service_provider_mode)}
8787
/>
8888
</Section>
8989
) : null}

clients/admin-ui/src/features/data-discovery-and-detection/tables/ActivityTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ const ActivityTable = ({
197197
emptyTableNotice={<EmptyTableNotice />}
198198
/>
199199
<PaginationBar
200-
totalRows={totalRows}
200+
totalRows={totalRows || 0}
201201
pageSizes={PAGE_SIZES}
202202
setPageSize={setPageSize}
203203
onPreviousPageClick={onPreviousPageClick}

clients/admin-ui/src/features/data-discovery-and-detection/tables/DetectionResultTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ const DetectionResultTable = ({ resourceUrn }: MonitorResultTableProps) => {
195195
emptyTableNotice={<EmptyTableNotice />}
196196
/>
197197
<PaginationBar
198-
totalRows={totalRows}
198+
totalRows={totalRows || 0}
199199
pageSizes={PAGE_SIZES}
200200
setPageSize={setPageSize}
201201
onPreviousPageClick={onPreviousPageClick}

clients/admin-ui/src/features/data-discovery-and-detection/tables/DiscoveryResultTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ const DiscoveryResultTable = ({ resourceUrn }: MonitorResultTableProps) => {
179179
emptyTableNotice={<EmptyTableNotice />}
180180
/>
181181
<PaginationBar
182-
totalRows={totalRows}
182+
totalRows={totalRows || 0}
183183
pageSizes={PAGE_SIZES}
184184
setPageSize={setPageSize}
185185
onPreviousPageClick={onPreviousPageClick}

clients/admin-ui/src/features/data-discovery-and-detection/types/DiscoveryMonitorItem.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ import { Field, StagedResourceAPIResponse } from "~/types/api";
33
/**
44
* Utility class for a staged resource of unknown type
55
*/
6-
export type DiscoveryMonitorItem = StagedResourceAPIResponse & Partial<Field>;
6+
export type DiscoveryMonitorItem = StagedResourceAPIResponse &
7+
Omit<Partial<Field>, "schema_name" | "parent_table_urn" | "table_name"> & {
8+
schema_name?: string | null;
9+
parent_table_urn?: string | null;
10+
table_name?: string | null;
11+
};

clients/admin-ui/src/features/datamap/reporting/DatamapReportTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1172,7 +1172,7 @@ export const DatamapReportTable = () => {
11721172

11731173
<FidesTableV2<DatamapReport> tableInstance={tableInstance} />
11741174
<PaginationBar
1175-
totalRows={totalRows}
1175+
totalRows={totalRows || 0}
11761176
pageSizes={PAGE_SIZES}
11771177
setPageSize={setPageSize}
11781178
onPreviousPageClick={onPreviousPageClick}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { DataCategory } from "~/types/api";
22

33
export interface DataCategoryWithConfidence extends DataCategory {
4-
confidence?: number;
4+
confidence?: number | null;
55
}

clients/admin-ui/src/features/datastore-connections/TestData.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import ConnectedCircle from "../common/ConnectedCircle";
44
import { formatDate } from "../common/utils";
55

66
type TestDataProps = {
7-
succeeded?: boolean;
7+
succeeded?: boolean | null;
88
timestamp: string | number;
99
};
1010

clients/admin-ui/src/features/datastore-connections/system_portal_config/ConnectionForm.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type ConnectionOption = {
2727
};
2828

2929
type Props = {
30-
connectionConfig?: ConnectionConfigurationResponse;
30+
connectionConfig?: ConnectionConfigurationResponse | null;
3131
systemFidesKey: string;
3232
};
3333

@@ -69,7 +69,7 @@ const ConnectionForm = ({ connectionConfig, systemFidesKey }: Props) => {
6969
label="Integration type"
7070
selectedValue={selectedConnectionOption}
7171
onChange={setSelectedConnectionOption}
72-
disabled={connectionConfig && connectionConfig !== null}
72+
disabled={Boolean(connectionConfig && connectionConfig !== null)}
7373
/>
7474
{!connectionConfig && orphanedConnectionConfigs.length > 0 ? (
7575
<OrphanedConnectionModal

clients/admin-ui/src/features/datastore-connections/system_portal_config/ConnectionListDropdown.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ type SelectDropdownProps = {
7676
};
7777

7878
type UseConnectionListDropDown = {
79-
connectionConfig?: ConnectionConfigurationResponse;
79+
connectionConfig?: ConnectionConfigurationResponse | null;
8080
};
8181

8282
export const useConnectionListDropDown = ({

clients/admin-ui/src/features/datastore-connections/system_portal_config/ConsentAutomationForm.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
selectPageSize as selectNoticePageSize,
3131
useGetAllPrivacyNoticesQuery,
3232
} from "~/features/privacy-notices/privacy-notices.slice";
33-
import { ConsentableItem } from "~/types/api/models/ConsentableItem";
33+
import { ConsentableItem } from "~/types/api";
3434
import { isErrorResult } from "~/types/errors";
3535

3636
interface ConsentableItemFieldProps {

clients/admin-ui/src/features/datastore-connections/system_portal_config/forms/ConnectorParameters.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ type ConnectorParametersProps = {
190190
setSelectedConnectionOption: (
191191
option: ConnectionSystemTypeMap | undefined,
192192
) => void;
193-
connectionConfig?: ConnectionConfigurationResponse;
193+
connectionConfig?: ConnectionConfigurationResponse | null;
194194
};
195195

196196
export const useConnectorForm = ({
@@ -241,7 +241,7 @@ export const useConnectorForm = ({
241241
const { plus: isPlusEnabled } = useFeatures();
242242

243243
const originalSecrets = useMemo(
244-
() => (connectionConfig ? { ...connectionConfig.secrets } : {}),
244+
() => connectionConfig?.secrets ?? {},
245245
[connectionConfig],
246246
);
247247
const activeSystem = useAppSelector(selectActiveSystem) as SystemResponse;

clients/admin-ui/src/features/datastore-connections/system_portal_config/forms/ConnectorParametersForm.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type ConnectorParametersFormProps = {
7171
* Parent callback when Authorize Connection is clicked
7272
*/
7373
onAuthorizeConnectionClick: (values: ConnectionConfigFormValues) => void;
74-
connectionConfig?: ConnectionConfigurationResponse;
74+
connectionConfig?: ConnectionConfigurationResponse | null;
7575
connectionOption: ConnectionSystemTypeMap;
7676
isCreatingConnectionConfig: boolean;
7777
datasetDropdownOptions: Option[];
@@ -236,7 +236,7 @@ export const ConnectorParametersForm = ({
236236
).map((action) => action.toString());
237237

238238
// @ts-ignore
239-
initialValues.secrets = { ...connectionConfig.secrets };
239+
initialValues.secrets = connectionConfig.secrets ?? {};
240240

241241
// check if we need we need to pre-process any secrets values
242242
// we currently only need to do this for Fides dataset references

clients/admin-ui/src/features/datastore-connections/system_portal_config/forms/DSRCustomizationForm/DSRCustomizationModal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import DSRCustomizationForm from "./DSRCustomizationForm";
3131
import { Field } from "./types";
3232

3333
type Props = {
34-
connectionConfig?: ConnectionConfigurationResponse;
34+
connectionConfig?: ConnectionConfigurationResponse | null;
3535
};
3636

3737
const DSRCustomizationModal = ({ connectionConfig }: Props) => {

clients/admin-ui/src/features/datastore-connections/system_portal_config/forms/fields/DatasetConfigField/DatasetConfigField.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export const DatasetSelect = ({
116116
};
117117

118118
type UseDatasetConfigField = {
119-
connectionConfig?: ConnectionConfigurationResponse;
119+
connectionConfig?: ConnectionConfigurationResponse | null;
120120
};
121121
export const useDatasetConfigField = ({
122122
connectionConfig,
@@ -230,7 +230,7 @@ export const useDatasetConfigField = ({
230230

231231
type Props = {
232232
dropdownOptions: Option[];
233-
connectionConfig?: ConnectionConfigurationResponse;
233+
connectionConfig?: ConnectionConfigurationResponse | null;
234234
};
235235

236236
const DatasetConfigField = ({ dropdownOptions, connectionConfig }: Props) => {

clients/admin-ui/src/features/datastore-connections/useTestConnection.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const useTestConnection = (
4242
: integration?.last_test_timestamp,
4343
succeeded: data
4444
? data.test_status === "succeeded"
45-
: integration?.last_test_succeeded,
45+
: Boolean(integration?.last_test_succeeded),
4646
};
4747

4848
const isLoading = queryIsLoading || isFetching;

clients/admin-ui/src/features/integrations/ConnectionStatusNotice.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CheckCircleIcon, Flex, Text, WarningTwoIcon } from "fidesui";
33
import { formatDate } from "~/features/common/utils";
44

55
export type ConnectionStatusData = {
6-
timestamp?: string;
6+
timestamp?: string | null;
77
succeeded?: boolean;
88
};
99

0 commit comments

Comments
 (0)