Skip to content

Commit

Permalink
Fides Pydantic V2 Upgrade (#5020)
Browse files Browse the repository at this point in the history
Pydantic v1 -> Pydantic v2 upgrade

Co-authored-by: Adrian Galvan <[email protected]>
Co-authored-by: eastandwestwind <[email protected]>
  • Loading branch information
3 people authored and Roger-Ethyca committed Aug 20, 2024
1 parent 23c8382 commit 380cba4
Show file tree
Hide file tree
Showing 577 changed files with 3,862 additions and 3,483 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/backend_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
strategy:
matrix:
# NOTE: These are the currently supported/tested Python Versions
python_version: ["3.8.18", "3.9.18", "3.10.13"]
python_version: ["3.9.18", "3.10.13"]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -223,7 +223,7 @@ jobs:
needs: Check-Container-Startup
strategy:
matrix:
python_version: ["3.8.18", "3.9.18", "3.10.13"]
python_version: ["3.9.18", "3.10.13"]
test_selection:
- "ctl-not-external"
- "ops-unit-api"
Expand Down Expand Up @@ -275,7 +275,7 @@ jobs:
strategy:
max-parallel: 1 # This prevents collisions in shared external resources
matrix:
python_version: ["3.8.18", "3.9.18", "3.10.13"]
python_version: ["3.9.18", "3.10.13"]
runs-on: ubuntu-latest
timeout-minutes: 20
# In PRs run with the "unsafe" label, or run on a "push" event to main
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
strategy:
max-parallel: 1 # This prevents collisions in shared external resources
matrix:
python_version: ["3.8.18", "3.9.18", "3.10.13"]
python_version: ["3.9.18", "3.10.13"]
runs-on: ubuntu-latest
timeout-minutes: 20
# In PRs run with the "unsafe" label, or run on a "push" event to main
Expand Down Expand Up @@ -381,7 +381,7 @@ jobs:
strategy:
max-parallel: 1 # This prevents collisions in shared external resources
matrix:
python_version: ["3.8.18", "3.9.18", "3.10.13"]
python_version: ["3.9.18", "3.10.13"]
steps:
- name: Download container
uses: actions/download-artifact@v4
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ The types of changes are:

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

### Added
- Pydantic v1 -> Pydantic v2 upgrade [#5020](https://github.com/ethyca/fides/pull/5020)

### Fixed
- Ignore `404` errors on Oracle Responsys deletions [#5203](https://github.com/ethyca/fides/pull/5203)
- Fix white screen issue when privacy request has null value for daysLeft [#5213](https://github.com/ethyca/fides/pull/5213)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ In order to get started quickly with Fides, a sample project is bundled within t
#### Minimum requirements (for all platforms)

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

#### Download and install Fides

Expand Down
2 changes: 1 addition & 1 deletion clients/admin-ui/src/features/common/ConnectedCircle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Box, BoxProps } from "fidesui";
const ConnectedCircle = ({
connected,
...other
}: { connected?: boolean } & BoxProps) => {
}: { connected?: boolean | null } & BoxProps) => {
let color = "red.500";
if (connected == null) {
color = "gray.300";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const SystemTableCell = ({
whiteSpace="nowrap"
overflow="hidden"
textOverflow="ellipsis"
title={system.fidesctl_meta?.resource_id}
title={system.fidesctl_meta?.resource_id || ""}
>
{system.fidesctl_meta?.resource_id}
</Box>
Expand Down
12 changes: 6 additions & 6 deletions clients/admin-ui/src/features/common/form/inputs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type Variant = "inline" | "stacked" | "block";
export interface CustomInputProps {
disabled?: boolean;
label?: string;
tooltip?: string;
tooltip?: string | null;
variant?: Variant;
isRequired?: boolean;
textColor?: string;
Expand Down Expand Up @@ -172,7 +172,7 @@ const ClearIndicator = () => null;
export interface Option {
value: string;
label: string;
description?: string;
description?: string | null;
tooltip?: string;
}

Expand Down Expand Up @@ -204,8 +204,8 @@ export interface SelectProps {
label?: string;
labelProps?: FormLabelProps;
placeholder?: string;
tooltip?: string;
options: Option[];
tooltip?: string | null;
options?: Option[] | [];
isDisabled?: boolean;
isSearchable?: boolean;
isClearable?: boolean;
Expand Down Expand Up @@ -247,7 +247,7 @@ export const SELECT_STYLES: ChakraStylesConfig<
};

export const SelectInput = ({
options,
options = [],
fieldName,
placeholder,
size,
Expand Down Expand Up @@ -399,7 +399,7 @@ interface CreatableSelectProps extends SelectProps {
disableMenu?: boolean;
}
const CreatableSelectInput = ({
options,
options = [],
placeholder,
fieldName,
size,
Expand Down
2 changes: 1 addition & 1 deletion clients/admin-ui/src/features/common/hooks/usePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ interface UsePaginatedPickerProps {
initialSelected: string[];
initialExcluded: string[];
initialAllSelected?: boolean;
itemCount: number;
itemCount: number | null;
}

export const usePaginatedPicker = ({
Expand Down
4 changes: 2 additions & 2 deletions clients/admin-ui/src/features/common/hooks/useTaxonomies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const useTaxonomies = () => {
fidesLangKey: string,
getDataFunction: (fidesLangKey: string) =>
| {
parent_key?: string;
name?: string;
parent_key?: string | null;
name?: string | null;
}
| undefined,
primaryLevel = 1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Accordion } from "fidesui";
import React from "react";

import { System } from "~/types/api/models/System";
import { System } from "~/types/api";

import { DataFlowAccordionForm } from "./DataFlowAccordionForm";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useServerSidePagination = () => {
const defaultPageIndex = 1;
const [pageSize, setPageSize] = useState(PAGE_SIZES[0]);
const [pageIndex, setPageIndex] = useState<number>(defaultPageIndex);
const [totalPages, setTotalPages] = useState<number>();
const [totalPages, setTotalPages] = useState<number | null>();
const onPreviousPageClick = useCallback(() => {
setPageIndex((prev) => prev - 1);
}, [setPageIndex]);
Expand Down
4 changes: 2 additions & 2 deletions clients/admin-ui/src/features/common/table/v2/cells.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { RTKResult } from "~/types/errors";
export const DefaultCell = ({
value,
}: {
value: string | undefined | number | boolean;
value: string | undefined | number | null | boolean;
}) => (
<Flex alignItems="center" height="100%">
<Text
Expand Down Expand Up @@ -60,7 +60,7 @@ const FidesBadge = ({ children, ...props }: BadgeProps) => (
export const RelativeTimestampCell = ({
time,
}: {
time?: string | number | Date;
time?: string | number | Date | null;
}) => {
if (!time) {
return <DefaultCell value="N/A" />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const AddVendor = ({
handleCloseModal();
};

const handleVendorSelected = (vendorId?: string) => {
const handleVendorSelected = (vendorId?: string | null) => {
if (!dictionaryService) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export const ConsentManagementTable = () => {
</TableActionBar>
<FidesTableV2 tableInstance={tableInstance} onRowClick={onRowClick} />
<PaginationBar
totalRows={totalRows}
totalRows={totalRows || 0}
pageSizes={PAGE_SIZES}
setPageSize={setPageSize}
onPreviousPageClick={onPreviousPageClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ const GppConfiguration = () => {
name="gpp.mspa_service_provider_mode"
variant="switchFirst"
tooltip="Enable service provider mode if you do not engage in any sales or sharing of personal information."
isDisabled={values.gpp.mspa_opt_out_option_mode}
isDisabled={Boolean(values.gpp.mspa_opt_out_option_mode)}
/>
<CustomSwitch
label="Enable MSPA opt-out option mode"
name="gpp.mspa_opt_out_option_mode"
variant="switchFirst"
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."
isDisabled={values.gpp.mspa_service_provider_mode}
isDisabled={Boolean(values.gpp.mspa_service_provider_mode)}
/>
</Section>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ const ActivityTable = ({
emptyTableNotice={<EmptyTableNotice />}
/>
<PaginationBar
totalRows={totalRows}
totalRows={totalRows || 0}
pageSizes={PAGE_SIZES}
setPageSize={setPageSize}
onPreviousPageClick={onPreviousPageClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ const DetectionResultTable = ({ resourceUrn }: MonitorResultTableProps) => {
emptyTableNotice={<EmptyTableNotice />}
/>
<PaginationBar
totalRows={totalRows}
totalRows={totalRows || 0}
pageSizes={PAGE_SIZES}
setPageSize={setPageSize}
onPreviousPageClick={onPreviousPageClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const DiscoveryResultTable = ({ resourceUrn }: MonitorResultTableProps) => {
emptyTableNotice={<EmptyTableNotice />}
/>
<PaginationBar
totalRows={totalRows}
totalRows={totalRows || 0}
pageSizes={PAGE_SIZES}
setPageSize={setPageSize}
onPreviousPageClick={onPreviousPageClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ import { Field, StagedResourceAPIResponse } from "~/types/api";
/**
* Utility class for a staged resource of unknown type
*/
export type DiscoveryMonitorItem = StagedResourceAPIResponse & Partial<Field>;
export type DiscoveryMonitorItem = StagedResourceAPIResponse &
Omit<Partial<Field>, "schema_name" | "parent_table_urn" | "table_name"> & {
schema_name?: string | null;
parent_table_urn?: string | null;
table_name?: string | null;
};
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ export const DatamapReportTable = () => {

<FidesTableV2<DatamapReport> tableInstance={tableInstance} />
<PaginationBar
totalRows={totalRows}
totalRows={totalRows || 0}
pageSizes={PAGE_SIZES}
setPageSize={setPageSize}
onPreviousPageClick={onPreviousPageClick}
Expand Down
2 changes: 1 addition & 1 deletion clients/admin-ui/src/features/dataset/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DataCategory } from "~/types/api";

export interface DataCategoryWithConfidence extends DataCategory {
confidence?: number;
confidence?: number | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ConnectedCircle from "../common/ConnectedCircle";
import { formatDate } from "../common/utils";

type TestDataProps = {
succeeded?: boolean;
succeeded?: boolean | null;
timestamp: string | number;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type ConnectionOption = {
};

type Props = {
connectionConfig?: ConnectionConfigurationResponse;
connectionConfig?: ConnectionConfigurationResponse | null;
systemFidesKey: string;
};

Expand Down Expand Up @@ -69,7 +69,7 @@ const ConnectionForm = ({ connectionConfig, systemFidesKey }: Props) => {
label="Integration type"
selectedValue={selectedConnectionOption}
onChange={setSelectedConnectionOption}
disabled={connectionConfig && connectionConfig !== null}
disabled={Boolean(connectionConfig && connectionConfig !== null)}
/>
{!connectionConfig && orphanedConnectionConfigs.length > 0 ? (
<OrphanedConnectionModal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type SelectDropdownProps = {
};

type UseConnectionListDropDown = {
connectionConfig?: ConnectionConfigurationResponse;
connectionConfig?: ConnectionConfigurationResponse | null;
};

export const useConnectionListDropDown = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
selectPageSize as selectNoticePageSize,
useGetAllPrivacyNoticesQuery,
} from "~/features/privacy-notices/privacy-notices.slice";
import { ConsentableItem } from "~/types/api/models/ConsentableItem";
import { ConsentableItem } from "~/types/api";
import { isErrorResult } from "~/types/errors";

interface ConsentableItemFieldProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ type ConnectorParametersProps = {
setSelectedConnectionOption: (
option: ConnectionSystemTypeMap | undefined,
) => void;
connectionConfig?: ConnectionConfigurationResponse;
connectionConfig?: ConnectionConfigurationResponse | null;
};

export const useConnectorForm = ({
Expand Down Expand Up @@ -241,7 +241,7 @@ export const useConnectorForm = ({
const { plus: isPlusEnabled } = useFeatures();

const originalSecrets = useMemo(
() => (connectionConfig ? { ...connectionConfig.secrets } : {}),
() => connectionConfig?.secrets ?? {},
[connectionConfig],
);
const activeSystem = useAppSelector(selectActiveSystem) as SystemResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type ConnectorParametersFormProps = {
* Parent callback when Authorize Connection is clicked
*/
onAuthorizeConnectionClick: (values: ConnectionConfigFormValues) => void;
connectionConfig?: ConnectionConfigurationResponse;
connectionConfig?: ConnectionConfigurationResponse | null;
connectionOption: ConnectionSystemTypeMap;
isCreatingConnectionConfig: boolean;
datasetDropdownOptions: Option[];
Expand Down Expand Up @@ -236,7 +236,7 @@ export const ConnectorParametersForm = ({
).map((action) => action.toString());

// @ts-ignore
initialValues.secrets = { ...connectionConfig.secrets };
initialValues.secrets = connectionConfig.secrets ?? {};

// check if we need we need to pre-process any secrets values
// we currently only need to do this for Fides dataset references
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import DSRCustomizationForm from "./DSRCustomizationForm";
import { Field } from "./types";

type Props = {
connectionConfig?: ConnectionConfigurationResponse;
connectionConfig?: ConnectionConfigurationResponse | null;
};

const DSRCustomizationModal = ({ connectionConfig }: Props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const DatasetSelect = ({
};

type UseDatasetConfigField = {
connectionConfig?: ConnectionConfigurationResponse;
connectionConfig?: ConnectionConfigurationResponse | null;
};
export const useDatasetConfigField = ({
connectionConfig,
Expand Down Expand Up @@ -230,7 +230,7 @@ export const useDatasetConfigField = ({

type Props = {
dropdownOptions: Option[];
connectionConfig?: ConnectionConfigurationResponse;
connectionConfig?: ConnectionConfigurationResponse | null;
};

const DatasetConfigField = ({ dropdownOptions, connectionConfig }: Props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const useTestConnection = (
: integration?.last_test_timestamp,
succeeded: data
? data.test_status === "succeeded"
: integration?.last_test_succeeded,
: Boolean(integration?.last_test_succeeded),
};

const isLoading = queryIsLoading || isFetching;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CheckCircleIcon, Flex, Text, WarningTwoIcon } from "fidesui";
import { formatDate } from "~/features/common/utils";

export type ConnectionStatusData = {
timestamp?: string;
timestamp?: string | null;
succeeded?: boolean;
};

Expand Down
Loading

0 comments on commit 380cba4

Please sign in to comment.