Skip to content

Commit

Permalink
Move client schema package into api/schema
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed Oct 13, 2023
1 parent 26eba22 commit cd17116
Show file tree
Hide file tree
Showing 86 changed files with 113 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ area/toolshed:
- lib/toolshed/**/*
- templates/webapps/tool_shed/**/*
area/UI-UX:
- all: ["client/src/**/*", "!client/src/schema/schema.ts"]
- all: ["client/src/**/*", "!client/src/api/schema/schema.ts"]
any: ["templates/**/*"]
area/util:
- lib/galaxy/util/**/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint_openapi_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Check for changes
run: |
if [[ `git status --porcelain` ]]; then
echo "Rebuilding client/src/schema/schema.ts resulted in changes, run 'make update-client-api-schema' and commit results"
echo "Rebuilding client/src/api/schema/schema.ts resulted in changes, run 'make update-client-api-schema' and commit results"
exit 1
fi
working-directory: 'galaxy root'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ remove-api-schema:
rm _shed_schema.yaml

update-client-api-schema: client-node-deps build-api-schema
$(IN_VENV) cd client && node openapi_to_schema.mjs ../_schema.yaml > src/schema/schema.ts && npx prettier --write src/schema/schema.ts
$(IN_VENV) cd client && node openapi_to_schema.mjs ../_schema.yaml > src/api/schema/schema.ts && npx prettier --write src/api/schema/schema.ts
$(IN_VENV) cd client && node openapi_to_schema.mjs ../_shed_schema.yaml > ../lib/tool_shed/webapp/frontend/src/schema/schema.ts && npx prettier --write ../lib/tool_shed/webapp/frontend/src/schema/schema.ts
$(MAKE) remove-api-schema

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { paths } from "@/schema";
import type { paths } from "@/api/schema";

jest.mock("@/schema", () => ({
jest.mock("@/api/schema", () => ({
fetcher: mockFetcher,
}));

jest.mock("@/schema/fetcher", () => ({
jest.mock("@/api/schema/fetcher", () => ({
fetcher: mockFetcher,
}));

Expand Down Expand Up @@ -60,9 +60,9 @@ function setMockReturn(path: Path | RegExp, method: Method, value: any) {
}

/**
* Mock implementation for the fetcher found in `@/schema/fetcher`
* Mock implementation for the fetcher found in `@/api/schema/fetcher`
*
* You need to call `jest.mock("@/schema")` and/or `jest.mock("@/schema/fetcher")`
* You need to call `jest.mock("@/api/schema")` and/or `jest.mock("@/api/schema/fetcher")`
* (depending on what module the file you are testing imported)
* in order for this mock to take effect.
*
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fetcher } from "@/schema";
import { fetcher } from "@/api/schema";

import { mockFetcher } from "./__mocks__/fetcher";

jest.mock("@/schema");
jest.mock("@/api/schema");

mockFetcher.path("/api/configuration").method("get").mock("CONFIGURATION");

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions client/src/components/Common/ExportRDMForm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { getLocalVue } from "@tests/jest/helpers";
import { mount, Wrapper } from "@vue/test-utils";
import flushPromises from "flush-promises";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";

import { CreatedEntry } from "../FilesDialog/services";

import ExportRDMForm from "./ExportRDMForm.vue";
import FilesInput from "@/components/FilesDialog/FilesInput.vue";

jest.mock("@/schema");
jest.mock("@/api/schema");

const localVue = getLocalVue(true);

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Common/models/exportRecordModel.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { formatDistanceToNow, parseISO } from "date-fns";

import type { components } from "@/schema";
import type { components } from "@/api/schema";

type ExportObjectRequestMetadata = components["schemas"]["ExportObjectRequestMetadata"];

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Common/models/testData/exportData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExportRecordModel } from "@/components/Common/models/exportRecordModel";
import type { components } from "@/schema";
import type { components } from "@/api/schema";

type ObjectExportTaskResponse = components["schemas"]["ObjectExportTaskResponse"];
type ExportObjectRequestMetadata = components["schemas"]["ExportObjectRequestMetadata"];
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Dataset/services.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { FetchArgType } from "openapi-typescript-fetch";

import { fetcher } from "@/schema";
import { fetcher } from "@/api/schema";
import { withPrefix } from "@/utils/redirect";

const _getDatasets = fetcher.path("/api/datasets").method("get").create();
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Datatypes/model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { components } from "@/schema";
import type { components } from "@/api/schema";

export type DatatypesCombinedMap = components["schemas"]["DatatypesCombinedMap"];

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Datatypes/services.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fetcher } from "@/schema/fetcher";
import { fetcher } from "@/api/schema/fetcher";

const getTypesAndMappings = fetcher.path("/api/datatypes/types_and_mapping").method("get").create();

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/FilesDialog/FilesDialog.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createLocalVue, shallowMount, Wrapper } from "@vue/test-utils";
import flushPromises from "flush-promises";

import { mockFetcher } from "@/api/schema/__mocks__";
import { selectionStates } from "@/components/SelectionDialog/selectionStates";
import { mockFetcher } from "@/schema/__mocks__";

import { BaseRecordItem } from "./model";
import {
Expand All @@ -26,7 +26,7 @@ import DataDialogTable from "@/components/SelectionDialog/DataDialogTable.vue";
import SelectionDialog from "@/components/SelectionDialog/SelectionDialog.vue";

jest.mock("app");
jest.mock("@/schema");
jest.mock("@/api/schema");

jest.mock("@/composables/config", () => ({
useConfig: jest.fn(() => ({
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/FilesDialog/services.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { components } from "@/schema";
import { fetcher } from "@/schema/fetcher";
import type { components } from "@/api/schema";
import { fetcher } from "@/api/schema/fetcher";

/** The browsing mode:
* - `file` - allows to select files or directories contained in a source (default)
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Form/Elements/FormDirectory.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import flushPromises from "flush-promises";
import { createPinia } from "pinia";
import { getLocalVue } from "tests/jest/helpers";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";

import FormDirectory from "./FormDirectory";

const localVue = getLocalVue();
jest.mock("app");
jest.mock("@/schema");
jest.mock("@/api/schema");

describe("DirectoryPathEditableBreadcrumb", () => {
let wrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import { BFormCheckbox } from "bootstrap-vue";
import flushPromises from "flush-promises";
import { getLocalVue } from "tests/jest/helpers";

import { mockFetcher } from "@/api/schema/__mocks__";
import {
FAILED_FILE_SOURCE_STORE_RESPONSE,
FILE_SOURCE_STORE_RESPONSE,
IN_PROGRESS_FILE_SOURCE_STORE_RESPONSE,
RECENT_FILE_SOURCE_STORE_RESPONSE,
RECENT_STS_DOWNLOAD_RESPONSE,
} from "@/components/Common/models/testData/exportData";
import { mockFetcher } from "@/schema/__mocks__";
import type { HistorySummary } from "@/stores/historyStore";

import HistoryArchiveExportSelector from "./HistoryArchiveExportSelector.vue";

jest.mock("@/schema");
jest.mock("@/api/schema");

const localVue = getLocalVue(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import flushPromises from "flush-promises";
import { setActivePinia } from "pinia";
import { getLocalVue } from "tests/jest/helpers";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";
import { type HistorySummary, useHistoryStore } from "@/stores/historyStore";

import HistoryArchiveWizard from "./HistoryArchiveWizard.vue";

jest.mock("@/schema");
jest.mock("@/api/schema");

jest.mock("@/composables/config", () => ({
useConfig: jest.fn(() => ({
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/History/Content/GenericElement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import type { PropType } from "vue";
import Vue, { ref } from "vue";
import type { components } from "@/schema";
import type { components } from "@/api/schema";
import ContentItem from "./ContentItem.vue";
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/History/Content/model/states.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { components } from "@/schema";
import { components } from "@/api/schema";

type DatasetState = components["schemas"]["DatasetState"];
// The 'failed' state is for the collection job state summary, not a dataset state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import flushPromises from "flush-promises";
import { createPinia } from "pinia";
import { getLocalVue } from "tests/jest/helpers";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";

import SelectionOperations from "./SelectionOperations.vue";

jest.mock("@/schema");
jest.mock("@/api/schema");

const localVue = getLocalVue();

Expand Down
6 changes: 3 additions & 3 deletions client/src/components/History/Export/HistoryExport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import { shallowMount } from "@vue/test-utils";
import flushPromises from "flush-promises";
import { setActivePinia } from "pinia";

import type { components } from "@/api/schema";
import { mockFetcher } from "@/api/schema/__mocks__";
import {
EXPIRED_STS_DOWNLOAD_RECORD,
FILE_SOURCE_STORE_RECORD,
RECENT_STS_DOWNLOAD_RECORD,
} from "@/components/Common/models/testData/exportData";
import type { components } from "@/schema";
import { mockFetcher } from "@/schema/__mocks__";
import { type HistorySummary, useHistoryStore } from "@/stores/historyStore";

import { getExportRecords } from "./services";
Expand All @@ -19,7 +19,7 @@ import HistoryExport from "./HistoryExport.vue";

const localVue = getLocalVue(true);

jest.mock("@/schema");
jest.mock("@/api/schema");
jest.mock("./services");
const mockGetExportRecords = getExportRecords as jest.MockedFunction<typeof getExportRecords>;
mockGetExportRecords.mockResolvedValue([]);
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/History/Export/services.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ObjectExportTaskResponse } from "@/components/Common/models/exportRecordModel";
import { ExportRecordModel } from "@/components/Common/models/exportRecordModel";
import { DEFAULT_EXPORT_PARAMS } from "@/composables/shortTermStorage";
import type { components } from "@/schema";
import { fetcher } from "@/schema";
import type { components } from "@/api/schema";
import { fetcher } from "@/api/schema";

type ModelStoreFormat = components["schemas"]["ModelStoreFormat"];

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/History/Modals/SelectorModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { storeToRefs } from "pinia";
import { computed, onMounted, onUnmounted, type PropType, type Ref, ref, watch } from "vue";
import { useRouter } from "vue-router/composables";
import type { components } from "@/schema";
import type { components } from "@/api/schema";
import { useHistoryStore } from "@/stores/historyStore";
import { useUserStore } from "@/stores/userStore";
import Filtering, { contains, expandNameTag } from "@/utils/filtering";
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/HistoryExport/Index.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { shallowMount } from "@vue/test-utils";
import { getLocalVue } from "tests/jest/helpers";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";

import Index from "./Index.vue";

jest.mock("@/schema");
jest.mock("@/api/schema");

const localVue = getLocalVue();

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/HistoryImport.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { waitOnJob } from "components/JobStates/wait";
import flushPromises from "flush-promises";
import { getLocalVue, wait } from "tests/jest/helpers";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";

import HistoryImport from "./HistoryImport.vue";

Expand All @@ -15,7 +15,7 @@ const TEST_HISTORY_URI = "/api/histories";
const TEST_SOURCE_URL = "http://galaxy.example/import";
const TEST_PLUGINS_URL = "/api/remote_files/plugins";

jest.mock("@/schema");
jest.mock("@/api/schema");
jest.mock("components/JobStates/wait");

describe("HistoryImport.vue", () => {
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Masthead/Masthead.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { PiniaVuePlugin, setActivePinia } from "pinia";
import { useEntryPointStore } from "stores/entryPointStore";
import { getLocalVue } from "tests/jest/helpers";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";

import { loadWebhookMenuItems } from "./_webhooks";
import { getActiveTab } from "./utilities";
Expand All @@ -17,7 +17,7 @@ jest.mock("./_webhooks");
jest.mock("vue-router/composables", () => ({
useRoute: jest.fn(() => ({ name: "Home" })),
}));
jest.mock("@/schema");
jest.mock("@/api/schema");

describe("Masthead.vue", () => {
let wrapper;
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/Masthead/QuotaMeter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { mount } from "@vue/test-utils";
import flushPromises from "flush-promises";
import { getLocalVue } from "tests/jest/helpers";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";
import { useUserStore } from "@/stores/userStore";

import QuotaMeter from "./QuotaMeter.vue";

jest.mock("@/schema");
jest.mock("@/api/schema");

const localVue = getLocalVue();

Expand Down
4 changes: 2 additions & 2 deletions client/src/components/NewUserWelcome/NewUserWelcome.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mount } from "@vue/test-utils";
import { createPinia } from "pinia";
import { getLocalVue } from "tests/jest/helpers";

import { mockFetcher } from "@/schema/__mocks__";
import { mockFetcher } from "@/api/schema/__mocks__";

import { getResource } from "./getResource";
import testData from "./testData.json";
Expand All @@ -11,7 +11,7 @@ import NewUserWelcome from "./NewUserWelcome.vue";

const localVue = getLocalVue();

jest.mock("@/schema");
jest.mock("@/api/schema");
jest.mock("./getResource");

// mock resource connector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { storeToRefs } from "pinia";
import { computed } from "vue";
import { useRouter } from "vue-router/composables";
import { type components } from "@/api/schema";
import { useMarkdown } from "@/composables/markdown";
import { type components } from "@/schema";
import { type BroadcastNotification, useBroadcastsStore } from "@/stores/broadcastsStore";
import Heading from "@/components/Common/Heading.vue";
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Notifications/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type components } from "@/schema";
import { type components } from "@/api/schema";

export type BaseUserNotification = components["schemas"]["UserNotificationResponse"];

Expand Down
2 changes: 1 addition & 1 deletion client/src/components/Notifications/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MessageNotification, SharedItemNotification, UserNotification } from "@/components/Notifications/index";
import type { components } from "@/schema";
import type { components } from "@/api/schema";

type NotificationVariants = components["schemas"]["NotificationVariant"];
type NewSharedItemNotificationContentItemType = components["schemas"]["NewSharedItemNotificationContent"]["item_type"];
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ObjectStore/ObjectStoreBadge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "./badgeIcons";
import { FontAwesomeIcon, FontAwesomeLayers } from "@fortawesome/vue-fontawesome";
import { computed } from "vue";
import type { components } from "@/schema";
import type { components } from "@/api/schema";
import ConfigurationMarkdown from "./ConfigurationMarkdown.vue";
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ObjectStore/ObjectStoreBadges.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import type { components } from "@/schema";
import type { components } from "@/api/schema";
import ObjectStoreBadge from "./ObjectStoreBadge.vue";
Expand Down
Loading

0 comments on commit cd17116

Please sign in to comment.