diff --git a/jest.config.js b/jest.config.js index 8a5ee13d..db674ccf 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,6 +6,10 @@ module.exports = { // To deal with annoying css imports that breaks tests "\\.(css|less)$": "/__mocks__/styleMock.js", // "@theme-original/(.*)": "/node_modules/@docusaurus/theme-classic/lib/theme/$1/index.js" + + // https://huafu.github.io/ts-jest/user/config/#paths-mapping + // If you use “baseUrl” and “paths” options in your tsconfig file, you should make sure the “moduleNameMapper” option in your Jest config is setup accordingly. + "^@theme/(.*)$": "/src/theme/$1", }, collectCoverageFrom: ["src/theme/JSONSchemaViewer/**/*.{js,ts,jsx,tsx}"], coveragePathIgnorePatterns: ["!*.d.ts"], diff --git a/src/theme-json-schema.d.ts b/src/theme-json-schema.d.ts index 219b7b6f..e2159518 100644 --- a/src/theme-json-schema.d.ts +++ b/src/theme-json-schema.d.ts @@ -1,7 +1,7 @@ // Plugin config declare module "docusaurus-json-schema-plugin" { import type { Plugin } from "@docusaurus/types" - import type { PluginOptions } from "docusaurus-json-schema-plugin/src/index" + import type { PluginOptions } from "docusaurus-json-schema-plugin/src" export default function themeJSONSchema( options: PluginOptions @@ -10,28 +10,25 @@ declare module "docusaurus-json-schema-plugin" { // Viewer component declare module "@theme/JSONSchemaViewer" { - import type { Props } from "docusaurus-json-schema-plugin/src/theme/JSONSchemaViewer/index" + import type { Props } from "@theme/JSONSchemaViewer" export default function JSONSchemaViewer(props: Props): JSX.Element } // Editor component declare module "@theme/JSONSchemaEditor" { - import type { Props } from "docusaurus-json-schema-plugin/src/theme/JSONSchemaEditor/index" + import type { Props } from "@theme/JSONSchemaEditor" export default function JSONSchemaEditor(props: Props): JSX.Element } // MonacoEditor component declare module "@theme/MonacoEditor" { - import type { Props } from "docusaurus-json-schema-plugin/src/theme/MonacoEditor/index" + import type { Props } from "@theme/MonacoEditor" export default function MonacoEditor(props: Props): JSX.Element - export type { - MonacoEditorTypes, - Props, - } from "docusaurus-json-schema-plugin/src/theme/MonacoEditor/index" + export type { MonacoEditorTypes, Props } from "@theme/MonacoEditor" // Re-export Monaco own interface, in case people want to add custom validation, ... export * as monaco from "monaco-editor/esm/vs/editor/editor.api" diff --git a/src/theme/JSONSchemaEditor/index.tsx b/src/theme/JSONSchemaEditor/index.tsx index aac565f0..813ee5cc 100644 --- a/src/theme/JSONSchemaEditor/index.tsx +++ b/src/theme/JSONSchemaEditor/index.tsx @@ -6,7 +6,7 @@ import ErrorBoundary from "@docusaurus/ErrorBoundary" import { LoadingLabel, ErrorOccurredLabel, -} from "../JSONSchemaViewer/labels/index" +} from "@theme/JSONSchemaViewer/labels" import type { JSONSchema as Draft_07 } from "json-schema-typed/draft-07" import type { EditorWillMount, MonacoEditorProps } from "react-monaco-editor" diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysInvalid.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysInvalid.tsx index 47ea9fe0..068221fc 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysInvalid.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysInvalid.tsx @@ -1,7 +1,7 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { TypeLabel, FalseLabel } from "../labels/index" +import { TypeLabel, FalseLabel } from "@theme/JSONSchemaViewer/labels" // When schema has the value "true", it means that it is ALWAYS valid export default function CreateAlwaysValid(): JSX.Element { diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysValid.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysValid.tsx index 2672438d..8a427c93 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysValid.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysValid.tsx @@ -1,12 +1,12 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { TypeLabel, TrueLabel } from "../labels/index" -import { useJSVOptionsContext } from "../contexts/index" -import { QualifierMessages } from "../utils/index" -import { CreateDescription } from "./index" +import { TypeLabel, TrueLabel } from "@theme/JSONSchemaViewer/labels" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" +import { QualifierMessages } from "@theme/JSONSchemaViewer/utils" +import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchema } from "../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateBoolean.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateBoolean.tsx index 88f6d7da..15ad36af 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateBoolean.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateBoolean.tsx @@ -1,14 +1,14 @@ import React from "react" -import { QualifierMessages } from "../utils/index" +import { QualifierMessages } from "@theme/JSONSchemaViewer/utils" -import { useJSVOptionsContext } from "../contexts/index" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" -import { TypeLabel, BooleanLabel } from "../labels/index" +import { TypeLabel, BooleanLabel } from "@theme/JSONSchemaViewer/labels" -import { CreateDescription } from "./index" +import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchemaNS } from "../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateDescription.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateDescription.tsx index 08726494..bec48c29 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateDescription.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateDescription.tsx @@ -1,6 +1,6 @@ import React from "react" -import { useJSVOptionsContext } from "../contexts/index" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" type Props = { description: string diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateInteger.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateInteger.tsx index 9e0ee63f..ff81d8b1 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateInteger.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateInteger.tsx @@ -1,14 +1,14 @@ import React from "react" -import { QualifierMessages } from "../utils/index" +import { QualifierMessages } from "@theme/JSONSchemaViewer/utils" -import { useJSVOptionsContext } from "../contexts/index" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" -import { TypeLabel, IntegerLabel } from "../labels/index" +import { TypeLabel, IntegerLabel } from "@theme/JSONSchemaViewer/labels" -import { CreateDescription } from "./index" +import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchemaNS } from "../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNull.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNull.tsx index cba17774..94a18ad4 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNull.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNull.tsx @@ -1,14 +1,14 @@ import React from "react" -import { QualifierMessages } from "../utils/index" +import { QualifierMessages } from "@theme/JSONSchemaViewer/utils" -import { useJSVOptionsContext } from "../contexts/index" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" -import { TypeLabel, NullLabel } from "../labels/index" +import { TypeLabel, NullLabel } from "@theme/JSONSchemaViewer/labels" -import { CreateDescription } from "./index" +import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchemaNS } from "../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNumber.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNumber.tsx index 698380d3..441fd110 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNumber.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateNumber.tsx @@ -1,14 +1,14 @@ import React from "react" -import { QualifierMessages } from "../utils/index" +import { QualifierMessages } from "@theme/JSONSchemaViewer/utils" -import { useJSVOptionsContext } from "../contexts/index" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" -import { TypeLabel, NumberLabel } from "../labels/index" +import { TypeLabel, NumberLabel } from "@theme/JSONSchemaViewer/labels" -import { CreateDescription } from "./index" +import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchemaNS } from "../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateString.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateString.tsx index 9fedbcc0..e0d2f21e 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateString.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/CreateString.tsx @@ -1,14 +1,14 @@ import React from "react" -import { QualifierMessages } from "../utils/index" +import { QualifierMessages } from "@theme/JSONSchemaViewer/utils" -import { useJSVOptionsContext } from "../contexts/index" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" -import { TypeLabel, StringLabel } from "../labels/index" +import { TypeLabel, StringLabel } from "@theme/JSONSchemaViewer/labels" -import { CreateDescription } from "./index" +import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchemaNS } from "../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependencies.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependencies.tsx index df9619d5..04030346 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependencies.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependencies.tsx @@ -1,8 +1,11 @@ import React from "react" -import { DependentRequired, DependentSchemas } from "./index" +import { + DependentRequired, + DependentSchemas, +} from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentRequired.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentRequired.tsx index a59615e4..8f9b5b8e 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentRequired.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentRequired.tsx @@ -1,8 +1,8 @@ import React from "react" -import { AllOfSchema } from "../schemaComposition/index" +import { AllOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition" -import type { JSONSchema, JSONSchemaNS } from "../../types" +import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentSchemas.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentSchemas.tsx index baf649d8..53ba5934 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentSchemas.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentSchemas.tsx @@ -1,8 +1,8 @@ import React from "react" -import { AllOfSchema } from "../schemaComposition/index" +import { AllOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition" -import type { JSONSchema, JSONSchemaNS } from "../../types" +import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/if-else-then.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/if-else-then.tsx index 9157df17..3c35b366 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/if-else-then.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/if-else-then.tsx @@ -3,11 +3,11 @@ import React from "react" import TabItem from "@theme-original/TabItem" import Tabs from "@theme-original/Tabs" -import { CreateNodes } from "../../components/index" +import { CreateNodes } from "@theme/JSONSchemaViewer/components" -import { IfLabel, ThenLabel, ElseLabel } from "../../labels/index" +import { IfLabel, ThenLabel, ElseLabel } from "@theme/JSONSchemaViewer/labels" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/index.ts b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/index.ts index cde71a6d..e4376560 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/index.ts +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/index.ts @@ -1,10 +1,10 @@ -export { default as IfElseThen } from "./if-else-then" +export { default as IfElseThen } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/if-else-then" -export { default as DependentRequired } from "./dependentRequired" +export { default as DependentRequired } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentRequired" -export { default as DependentSchemas } from "./dependentSchemas" +export { default as DependentSchemas } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependentSchemas" -export { default as Dependencies } from "./dependencies" +export { default as Dependencies } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/dependencies" // main entry point -export { default as SchemaConditional } from "./schemaConditional" +export { default as SchemaConditional } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/schemaConditional" diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/schemaConditional.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/schemaConditional.tsx index 3dd6007f..db351161 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/schemaConditional.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional/schemaConditional.tsx @@ -7,10 +7,10 @@ import { DependentRequired, DependentSchemas, Dependencies, -} from "./index" -import { Collapsible } from "../../components/index" +} from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional" +import { Collapsible } from "@theme/JSONSchemaViewer/components" -import type { JSONSchema, JSONSchemaNS } from "../../types" +import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/AdditionalItems.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/AdditionalItems.tsx index 2ed7968d..b4aa4c28 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/AdditionalItems.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/AdditionalItems.tsx @@ -1,9 +1,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/Contains.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/Contains.tsx index 2486da54..0e48ae45 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/Contains.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/Contains.tsx @@ -1,9 +1,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/CreateArray.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/CreateArray.tsx index 5ab73c1c..b3651996 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/CreateArray.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/CreateArray.tsx @@ -1,20 +1,20 @@ import React from "react" -import Items from "./Items" -import Contains from "./Contains" -import PrefixItems from "./PrefixItems" -import AdditionalItems from "./AdditionalItems" -import UnevaluatedItems from "./UnevaluatedItems" +import Items from "@theme/JSONSchemaViewer/JSONSchemaElements/array/Items" +import Contains from "@theme/JSONSchemaViewer/JSONSchemaElements/array/Contains" +import PrefixItems from "@theme/JSONSchemaViewer/JSONSchemaElements/array/PrefixItems" +import AdditionalItems from "@theme/JSONSchemaViewer/JSONSchemaElements/array/AdditionalItems" +import UnevaluatedItems from "@theme/JSONSchemaViewer/JSONSchemaElements/array/UnevaluatedItems" -import { QualifierMessages } from "../../utils/index" +import { QualifierMessages } from "@theme/JSONSchemaViewer/utils" -import { useJSVOptionsContext } from "../../contexts/index" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" -import { ArrayLabel, TypeLabel } from "../../labels/index" +import { ArrayLabel, TypeLabel } from "@theme/JSONSchemaViewer/labels" -import { CreateDescription } from "../index" +import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.Array diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/Items.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/Items.tsx index 028ba2d5..a5103cbc 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/Items.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/Items.tsx @@ -1,9 +1,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/PrefixItems.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/PrefixItems.tsx index a0e49a18..fdd4ac34 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/PrefixItems.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/PrefixItems.tsx @@ -1,9 +1,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchema, JSONSchemaNS } from "../../types" +import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/UnevaluatedItems.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/UnevaluatedItems.tsx index d2859a33..85fcc200 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/UnevaluatedItems.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/UnevaluatedItems.tsx @@ -1,9 +1,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/index.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/index.tsx index edc9e4f1..8c7f4fd9 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/array/index.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/array/index.tsx @@ -1,2 +1,2 @@ // The main function that will be imported -export { default as CreateArray } from "./CreateArray" +export { default as CreateArray } from "@theme/JSONSchemaViewer/JSONSchemaElements/array/CreateArray" diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/index.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/index.tsx index bf80a928..37c46082 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/index.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/index.tsx @@ -1,35 +1,35 @@ // Component to deal with oneOf / anyOf / allOf / not -export { SchemaComposition } from "./schemaComposition/index" +export { SchemaComposition } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition" // Component to deal with if-then-else , dependentRequired , dependentSchemas , dependencies -export { SchemaConditional } from "./SchemaConditional/index" +export { SchemaConditional } from "@theme/JSONSchemaViewer/JSONSchemaElements/SchemaConditional" // Component to deal with Object -export { CreateObject } from "./object/index" +export { CreateObject } from "@theme/JSONSchemaViewer/JSONSchemaElements/object" // Component to deal with Array -export { CreateArray } from "./array/index" +export { CreateArray } from "@theme/JSONSchemaViewer/JSONSchemaElements/array" // Component to deal with String -export { default as CreateString } from "./CreateString" +export { default as CreateString } from "@theme/JSONSchemaViewer/JSONSchemaElements/CreateString" // Component to deal with Boolean -export { default as CreateBoolean } from "./CreateBoolean" +export { default as CreateBoolean } from "@theme/JSONSchemaViewer/JSONSchemaElements/CreateBoolean" // Component to deal with Number -export { default as CreateNumber } from "./CreateNumber" +export { default as CreateNumber } from "@theme/JSONSchemaViewer/JSONSchemaElements/CreateNumber" // Component to deal with Integer -export { default as CreateInteger } from "./CreateInteger" +export { default as CreateInteger } from "@theme/JSONSchemaViewer/JSONSchemaElements/CreateInteger" // Component to deal with null -export { default as CreateNull } from "./CreateNull" +export { default as CreateNull } from "@theme/JSONSchemaViewer/JSONSchemaElements/CreateNull" // Component to deal with schema defined as "true" -export { default as CreateAlwaysValid } from "./CreateAlwaysValid" +export { default as CreateAlwaysValid } from "@theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysValid" // Component to deal with schema defined as "false" -export { default as CreateAlwaysInvalid } from "./CreateAlwaysInvalid" +export { default as CreateAlwaysInvalid } from "@theme/JSONSchemaViewer/JSONSchemaElements/CreateAlwaysInvalid" // Component to deal with description -export { default as CreateDescription } from "./CreateDescription" +export { default as CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements/CreateDescription" diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/AdditionalProperties.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/AdditionalProperties.tsx index 2dfd4f81..600b6070 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/AdditionalProperties.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/AdditionalProperties.tsx @@ -1,9 +1,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.Object diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/CreateObject.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/CreateObject.tsx index 9b10222a..c8d386b7 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/CreateObject.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/CreateObject.tsx @@ -1,20 +1,20 @@ import React from "react" -import AdditionalProperties from "./AdditionalProperties" -import Properties from "./Properties" -import PatternProperties from "./PatternProperties" -import PropertyNames from "./PropertyNames" -import UnlistedProperties from "./UnlistedRequiredProperties" -import UnevaluatedProperties from "./UnevaluatedProperties" +import AdditionalProperties from "@theme/JSONSchemaViewer/JSONSchemaElements/object/AdditionalProperties" +import Properties from "@theme/JSONSchemaViewer/JSONSchemaElements/object/Properties" +import PatternProperties from "@theme/JSONSchemaViewer/JSONSchemaElements/object/PatternProperties" +import PropertyNames from "@theme/JSONSchemaViewer/JSONSchemaElements/object/PropertyNames" +import UnlistedProperties from "@theme/JSONSchemaViewer/JSONSchemaElements/object/UnlistedRequiredProperties" +import UnevaluatedProperties from "@theme/JSONSchemaViewer/JSONSchemaElements/object/UnevaluatedProperties" -import { QualifierMessages } from "../../utils/index" -import { useJSVOptionsContext } from "../../contexts/index" +import { QualifierMessages } from "@theme/JSONSchemaViewer/utils" +import { useJSVOptionsContext } from "@theme/JSONSchemaViewer/contexts" -import { ObjectLabel, TypeLabel } from "../../labels/index" +import { ObjectLabel, TypeLabel } from "@theme/JSONSchemaViewer/labels" -import { CreateDescription } from "../index" +import { CreateDescription } from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.Object diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/PatternProperties.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/PatternProperties.tsx index 1c90e786..7e6f210d 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/PatternProperties.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/PatternProperties.tsx @@ -1,8 +1,8 @@ import React from "react" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.Object diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/Properties.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/Properties.tsx index cdf00ca7..939e5457 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/Properties.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/Properties.tsx @@ -1,8 +1,8 @@ import React from "react" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.Object diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/PropertyNames.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/PropertyNames.tsx index e53f1f0a..cc2f4294 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/PropertyNames.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/PropertyNames.tsx @@ -1,8 +1,8 @@ import React from "react" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.Object diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/UnevaluatedProperties.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/UnevaluatedProperties.tsx index 1a168d59..109d9053 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/UnevaluatedProperties.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/UnevaluatedProperties.tsx @@ -1,9 +1,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.Object diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/UnlistedRequiredProperties.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/UnlistedRequiredProperties.tsx index 646ebd87..2e091777 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/UnlistedRequiredProperties.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/UnlistedRequiredProperties.tsx @@ -1,8 +1,8 @@ import React from "react" -import { CreateEdge } from "../../components/index" +import { CreateEdge } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.Object diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/index.ts b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/index.ts index e80922f5..9d7703d5 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/object/index.ts +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/object/index.ts @@ -1,2 +1,2 @@ // The main function that will be imported -export { default as CreateObject } from "./CreateObject" +export { default as CreateObject } from "@theme/JSONSchemaViewer/JSONSchemaElements/object/CreateObject" diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/allOfSchema.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/allOfSchema.tsx index be323021..857ae977 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/allOfSchema.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/allOfSchema.tsx @@ -4,11 +4,11 @@ import React from "react" import TabItem from "@theme-original/TabItem" import Tabs from "@theme-original/Tabs" -import { CreateNodes } from "../../components/index" +import { CreateNodes } from "@theme/JSONSchemaViewer/components" -import { GenerateFriendlyName } from "../../utils/index" +import { GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/anyOfSchema.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/anyOfSchema.tsx index a7cda4be..22b38f2e 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/anyOfSchema.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/anyOfSchema.tsx @@ -4,11 +4,11 @@ import React from "react" import TabItem from "@theme-original/TabItem" import Tabs from "@theme-original/Tabs" -import { CreateNodes } from "../../components/index" +import { CreateNodes } from "@theme/JSONSchemaViewer/components" -import { GenerateFriendlyName } from "../../utils/index" +import { GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/index.ts b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/index.ts index c393776a..e9a3920a 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/index.ts +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/index.ts @@ -1,14 +1,14 @@ // allOf -export { default as AllOfSchema } from "./allOfSchema" +export { default as AllOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/allOfSchema" // anyOf -export { default as AnyOfSchema } from "./anyOfSchema" +export { default as AnyOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/anyOfSchema" // oneOf -export { default as OneOfSchema } from "./oneOfSchema" +export { default as OneOfSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/oneOfSchema" // not -export { default as NotSchema } from "./notSchema" +export { default as NotSchema } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/notSchema" // main entry point -export { default as SchemaComposition } from "./schemaComposition" +export { default as SchemaComposition } from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/schemaComposition" diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/notSchema.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/notSchema.tsx index 87b3fb5e..3b72813f 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/notSchema.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/notSchema.tsx @@ -1,8 +1,8 @@ import React from "react" -import { CreateNodes } from "../../components/index" +import { CreateNodes } from "@theme/JSONSchemaViewer/components" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/oneOfSchema.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/oneOfSchema.tsx index aa832330..887abc36 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/oneOfSchema.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/oneOfSchema.tsx @@ -4,11 +4,11 @@ import React from "react" import TabItem from "@theme-original/TabItem" import Tabs from "@theme-original/Tabs" -import { CreateNodes } from "../../components/index" +import { CreateNodes } from "@theme/JSONSchemaViewer/components" -import { GenerateFriendlyName } from "../../utils/index" +import { GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/schemaComposition.tsx b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/schemaComposition.tsx index 2253b390..ff050879 100644 --- a/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/schemaComposition.tsx +++ b/src/theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition/schemaComposition.tsx @@ -1,8 +1,13 @@ import React from "react" -import { AllOfSchema, AnyOfSchema, NotSchema, OneOfSchema } from "./index" +import { + AllOfSchema, + AnyOfSchema, + NotSchema, + OneOfSchema, +} from "@theme/JSONSchemaViewer/JSONSchemaElements/schemaComposition" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/components/CreateEdge.tsx b/src/theme/JSONSchemaViewer/components/CreateEdge.tsx index 02ac7297..5c47c613 100644 --- a/src/theme/JSONSchemaViewer/components/CreateEdge.tsx +++ b/src/theme/JSONSchemaViewer/components/CreateEdge.tsx @@ -1,8 +1,8 @@ import React, { ReactNode } from "react" -import { SchemaItem } from "./index" +import { SchemaItem } from "@theme/JSONSchemaViewer/components" -import type { JSONSchema } from "../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" // Creates the edge or "leave" of a schema tree. Edge can branch into sub-nodes. type EdgeProps = { diff --git a/src/theme/JSONSchemaViewer/components/CreateNodes.tsx b/src/theme/JSONSchemaViewer/components/CreateNodes.tsx index ee903a86..fab29f5c 100644 --- a/src/theme/JSONSchemaViewer/components/CreateNodes.tsx +++ b/src/theme/JSONSchemaViewer/components/CreateNodes.tsx @@ -1,17 +1,20 @@ import React from "react" -import { CreateTypes } from "./index" +import { CreateTypes } from "@theme/JSONSchemaViewer/components" import { SchemaComposition, SchemaConditional, -} from "../JSONSchemaElements/index" +} from "@theme/JSONSchemaViewer/JSONSchemaElements" -import { CreateValidOrInvalid } from "./index" +import { CreateValidOrInvalid } from "@theme/JSONSchemaViewer/components" -import { isSchemaComposition, isSchemaConditional } from "../utils/index" +import { + isSchemaComposition, + isSchemaConditional, +} from "@theme/JSONSchemaViewer/utils" -import type { JSONSchema } from "../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/components/CreateTypes.tsx b/src/theme/JSONSchemaViewer/components/CreateTypes.tsx index 639563b3..e4af81b5 100644 --- a/src/theme/JSONSchemaViewer/components/CreateTypes.tsx +++ b/src/theme/JSONSchemaViewer/components/CreateTypes.tsx @@ -7,11 +7,14 @@ import { TypeLabelSwitch, RenderProvidedType, CreateValidOrInvalid, -} from "./index" +} from "@theme/JSONSchemaViewer/components" -import { isSchemaComposition, detectedTypes } from "../utils/index" +import { + isSchemaComposition, + detectedTypes, +} from "@theme/JSONSchemaViewer/utils" -import type { JSONSchema, TypeValues } from "../types" +import type { JSONSchema, TypeValues } from "@theme/JSONSchemaViewer/types" // Render a single type type SingleTypeProps = { diff --git a/src/theme/JSONSchemaViewer/components/CreateValidOrInvalid.tsx b/src/theme/JSONSchemaViewer/components/CreateValidOrInvalid.tsx index 0367243e..09efb6b6 100644 --- a/src/theme/JSONSchemaViewer/components/CreateValidOrInvalid.tsx +++ b/src/theme/JSONSchemaViewer/components/CreateValidOrInvalid.tsx @@ -3,9 +3,9 @@ import React from "react" import { CreateAlwaysInvalid, CreateAlwaysValid, -} from "../JSONSchemaElements/index" +} from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchema } from "../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { [x: string]: any diff --git a/src/theme/JSONSchemaViewer/components/RenderProvidedType.tsx b/src/theme/JSONSchemaViewer/components/RenderProvidedType.tsx index 01358386..d933614c 100644 --- a/src/theme/JSONSchemaViewer/components/RenderProvidedType.tsx +++ b/src/theme/JSONSchemaViewer/components/RenderProvidedType.tsx @@ -8,9 +8,13 @@ import { CreateNumber, CreateInteger, CreateNull, -} from "../JSONSchemaElements/index" +} from "@theme/JSONSchemaViewer/JSONSchemaElements" -import type { JSONSchema, JSONSchemaNS, TypeValues } from "../types" +import type { + JSONSchema, + JSONSchemaNS, + TypeValues, +} from "@theme/JSONSchemaViewer/types" // Utily function to render a specific type type RenderProvidedTypeProps = { diff --git a/src/theme/JSONSchemaViewer/components/SchemaItem/SchemaItem.tsx b/src/theme/JSONSchemaViewer/components/SchemaItem/SchemaItem.tsx index 6d79f337..202dfb8a 100644 --- a/src/theme/JSONSchemaViewer/components/SchemaItem/SchemaItem.tsx +++ b/src/theme/JSONSchemaViewer/components/SchemaItem/SchemaItem.tsx @@ -1,19 +1,22 @@ import React, { ReactNode } from "react" -import { Collapsible, CreateNodes } from "../index" +import { Collapsible, CreateNodes } from "@theme/JSONSchemaViewer/components" import { RequiredLabel, DeprecatedLabel, WriteOnlyLabel, ReadOnlyLabel, -} from "../../labels/index" +} from "@theme/JSONSchemaViewer/labels" -import { GenerateFriendlyName } from "../../utils/index" +import { GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils" import styles from "./styles.module.css" -import type { JSONSchema, JSONSchema_Draft_2019_09 } from "../../types" +import type { + JSONSchema, + JSONSchema_Draft_2019_09, +} from "@theme/JSONSchemaViewer/types" type SchemaItemProps = { // name of the item (with styles when needed) diff --git a/src/theme/JSONSchemaViewer/components/TypeLabelSwitch.tsx b/src/theme/JSONSchemaViewer/components/TypeLabelSwitch.tsx index 2d0b8542..38c2b757 100644 --- a/src/theme/JSONSchemaViewer/components/TypeLabelSwitch.tsx +++ b/src/theme/JSONSchemaViewer/components/TypeLabelSwitch.tsx @@ -10,9 +10,9 @@ import { NullLabel, TrueLabel, FalseLabel, -} from "../labels/index" +} from "@theme/JSONSchemaViewer/labels" -import type { TypeValues } from "../types" +import type { TypeValues } from "@theme/JSONSchemaViewer/types" type Props = { // To cover unknown types, as well "any" or "none" diff --git a/src/theme/JSONSchemaViewer/components/index.ts b/src/theme/JSONSchemaViewer/components/index.ts index 1050fb2c..6ff5f6ed 100644 --- a/src/theme/JSONSchemaViewer/components/index.ts +++ b/src/theme/JSONSchemaViewer/components/index.ts @@ -1,17 +1,17 @@ // To avoid circular dependancies issue, let's have a single place for exports and imports -export { default as Collapsible } from "./Collapsible" +export { default as Collapsible } from "@theme/JSONSchemaViewer/components/Collapsible" -export { default as CreateNodes } from "./CreateNodes" +export { default as CreateNodes } from "@theme/JSONSchemaViewer/components/CreateNodes" -export { default as CreateEdge } from "./CreateEdge" +export { default as CreateEdge } from "@theme/JSONSchemaViewer/components/CreateEdge" -export { default as CreateValidOrInvalid } from "./CreateValidOrInvalid" +export { default as CreateValidOrInvalid } from "@theme/JSONSchemaViewer/components/CreateValidOrInvalid" -export { default as CreateTypes } from "./CreateTypes" +export { default as CreateTypes } from "@theme/JSONSchemaViewer/components/CreateTypes" -export { default as TypeLabelSwitch } from "./TypeLabelSwitch" +export { default as TypeLabelSwitch } from "@theme/JSONSchemaViewer/components/TypeLabelSwitch" -export { default as RenderProvidedType } from "./RenderProvidedType" +export { default as RenderProvidedType } from "@theme/JSONSchemaViewer/components/RenderProvidedType" -export { default as SchemaItem } from "./SchemaItem/SchemaItem" +export { default as SchemaItem } from "@theme/JSONSchemaViewer/components/SchemaItem/SchemaItem" diff --git a/src/theme/JSONSchemaViewer/contexts/index.tsx b/src/theme/JSONSchemaViewer/contexts/index.tsx index 26cb7e9b..6e3422b1 100644 --- a/src/theme/JSONSchemaViewer/contexts/index.tsx +++ b/src/theme/JSONSchemaViewer/contexts/index.tsx @@ -1 +1 @@ -export * from "./jsvOptions" +export * from "@theme/JSONSchemaViewer/contexts/jsvOptions" diff --git a/src/theme/JSONSchemaViewer/contexts/jsvOptions.tsx b/src/theme/JSONSchemaViewer/contexts/jsvOptions.tsx index 4a8ec27d..f218787d 100644 --- a/src/theme/JSONSchemaViewer/contexts/jsvOptions.tsx +++ b/src/theme/JSONSchemaViewer/contexts/jsvOptions.tsx @@ -1,7 +1,7 @@ import { useContext, createContext } from "react" -import type { JSONSchema } from "../types" -import type { CheckKey } from "../utils/QualifierMessages/index" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" +import type { CheckKey } from "@theme/JSONSchemaViewer/utils/QualifierMessages" export type JSVOptions = { // Full schema, useful for some specifics $ref cases (recursive / anchors / ...) diff --git a/src/theme/JSONSchemaViewer/index.tsx b/src/theme/JSONSchemaViewer/index.tsx index 6df8ab15..d9ccceb1 100644 --- a/src/theme/JSONSchemaViewer/index.tsx +++ b/src/theme/JSONSchemaViewer/index.tsx @@ -1,12 +1,15 @@ import React, { useState, useEffect } from "react" import { Resolver } from "@stoplight/json-ref-resolver" -import { CreateNodes, Collapsible } from "./components/index" -import { JSVOptionsContextProvider } from "./contexts/index" +import { CreateNodes, Collapsible } from "@theme/JSONSchemaViewer/components" +import { JSVOptionsContextProvider } from "@theme/JSONSchemaViewer/contexts" -import type { JSONSchema } from "./types" -import type { JSVOptions } from "./contexts/index" -import { LoadingLabel, ErrorOccurredLabel } from "./labels/index" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" +import type { JSVOptions } from "@theme/JSONSchemaViewer/contexts" +import { + LoadingLabel, + ErrorOccurredLabel, +} from "@theme/JSONSchemaViewer/labels" import type { IResolveOpts } from "@stoplight/json-ref-resolver/types" export type Props = { diff --git a/src/theme/JSONSchemaViewer/labels/index.ts b/src/theme/JSONSchemaViewer/labels/index.ts index 0074c903..0522de29 100644 --- a/src/theme/JSONSchemaViewer/labels/index.ts +++ b/src/theme/JSONSchemaViewer/labels/index.ts @@ -1,24 +1,24 @@ // Re-export labels -export { default as ObjectLabel } from "./Object" -export { default as ArrayLabel } from "./Array" -export { default as TypeLabel } from "./Type" -export { default as IfLabel } from "./If" -export { default as ThenLabel } from "./Then" -export { default as ElseLabel } from "./Else" -export { default as LoadingLabel } from "./Loading" -export { default as ErrorOccurredLabel } from "./ErrorOccurred" -export { default as RequiredLabel } from "./Required/Required" -export { default as DeprecatedLabel } from "./Deprecated/Deprecated" -export { default as ReadOnlyLabel } from "./ReadOnly/ReadOnly" -export { default as WriteOnlyLabel } from "./WriteOnly/WriteOnly" -export { default as TrueLabel } from "./True" -export { default as FalseLabel } from "./False" -export { default as StringLabel } from "./String" -export { default as BooleanLabel } from "./Boolean" -export { default as NumberLabel } from "./Number" -export { default as IntegerLabel } from "./Integer" -export { default as NullLabel } from "./Null" -export { default as AndLabel } from "./And" -export { default as OrLabel } from "./Or" -export { default as NotLabel } from "./Not" -export { default as XorLabel } from "./Xor" +export { default as ObjectLabel } from "@theme/JSONSchemaViewer/labels/Object" +export { default as ArrayLabel } from "@theme/JSONSchemaViewer/labels/Array" +export { default as TypeLabel } from "@theme/JSONSchemaViewer/labels/Type" +export { default as IfLabel } from "@theme/JSONSchemaViewer/labels/If" +export { default as ThenLabel } from "@theme/JSONSchemaViewer/labels/Then" +export { default as ElseLabel } from "@theme/JSONSchemaViewer/labels/Else" +export { default as LoadingLabel } from "@theme/JSONSchemaViewer/labels/Loading" +export { default as ErrorOccurredLabel } from "@theme/JSONSchemaViewer/labels/ErrorOccurred" +export { default as RequiredLabel } from "@theme/JSONSchemaViewer/labels/Required/Required" +export { default as DeprecatedLabel } from "@theme/JSONSchemaViewer/labels/Deprecated/Deprecated" +export { default as ReadOnlyLabel } from "@theme/JSONSchemaViewer/labels/ReadOnly/ReadOnly" +export { default as WriteOnlyLabel } from "@theme/JSONSchemaViewer/labels/WriteOnly/WriteOnly" +export { default as TrueLabel } from "@theme/JSONSchemaViewer/labels/True" +export { default as FalseLabel } from "@theme/JSONSchemaViewer/labels/False" +export { default as StringLabel } from "@theme/JSONSchemaViewer/labels/String" +export { default as BooleanLabel } from "@theme/JSONSchemaViewer/labels/Boolean" +export { default as NumberLabel } from "@theme/JSONSchemaViewer/labels/Number" +export { default as IntegerLabel } from "@theme/JSONSchemaViewer/labels/Integer" +export { default as NullLabel } from "@theme/JSONSchemaViewer/labels/Null" +export { default as AndLabel } from "@theme/JSONSchemaViewer/labels/And" +export { default as OrLabel } from "@theme/JSONSchemaViewer/labels/Or" +export { default as NotLabel } from "@theme/JSONSchemaViewer/labels/Not" +export { default as XorLabel } from "@theme/JSONSchemaViewer/labels/Xor" diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ArrayContainsNumber.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ArrayContainsNumber.tsx index eae153c0..5693c6db 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ArrayContainsNumber.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ArrayContainsNumber.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { AndLabel } from "../../labels/index" +import { AndLabel } from "@theme/JSONSchemaViewer/labels" -import type { JSONSchema, JSONSchemaNS } from "../../types" +import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ArrayNumberOfItems.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ArrayNumberOfItems.tsx index f5d33f08..1063d01b 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ArrayNumberOfItems.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ArrayNumberOfItems.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { AndLabel } from "../../labels/index" +import { AndLabel } from "@theme/JSONSchemaViewer/labels" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/Constant.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/Constant.tsx index 8c967d77..256df203 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/Constant.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/Constant.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { printSchemaType } from "./index" +import { printSchemaType } from "@theme/JSONSchemaViewer/utils/QualifierMessages" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentEncoding.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentEncoding.tsx index 679a7189..08d12888 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentEncoding.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentEncoding.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { printSchemaType } from "./index" +import { printSchemaType } from "@theme/JSONSchemaViewer/utils/QualifierMessages" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentMediaType.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentMediaType.tsx index 01ea2cdc..484109ca 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentMediaType.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentMediaType.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { printSchemaType } from "./index" +import { printSchemaType } from "@theme/JSONSchemaViewer/utils/QualifierMessages" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentSchema.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentSchema.tsx index 509ecb69..55655849 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentSchema.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ContentSchema.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { Collapsible, CreateNodes } from "../../components/index" +import { Collapsible, CreateNodes } from "@theme/JSONSchemaViewer/components" -import type { JSONSchemaNS } from "../../types" +import type { JSONSchemaNS } from "@theme/JSONSchemaViewer/types" type Props = { schema: JSONSchemaNS.String diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/DefaultValue.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/DefaultValue.tsx index 21ef12bd..08cc7dc2 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/DefaultValue.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/DefaultValue.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { printSchemaType } from "./index" +import { printSchemaType } from "@theme/JSONSchemaViewer/utils/QualifierMessages" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/Enum.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/Enum.tsx index 0d884621..42601b31 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/Enum.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/Enum.tsx @@ -2,8 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import type { JSONSchema } from "../../types" -import { printSchemaType } from "./index" +import { printSchemaType } from "@theme/JSONSchemaViewer/utils/QualifierMessages" + +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/Examples.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/Examples.tsx index 0924f175..fdcbb688 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/Examples.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/Examples.tsx @@ -5,8 +5,9 @@ import Translate from "@docusaurus/Translate" import TabItem from "@theme-original/TabItem" import Tabs from "@theme-original/Tabs" -import type { JSONSchema } from "../../types" -import { printSchemaType } from "./index" +import { printSchemaType } from "@theme/JSONSchemaViewer/utils/QualifierMessages" + +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/NumberBounds.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/NumberBounds.tsx index 67fcdda6..7b9afe53 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/NumberBounds.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/NumberBounds.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { AndLabel } from "../../labels/index" +import { AndLabel } from "@theme/JSONSchemaViewer/labels" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/NumberMultipleOf.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/NumberMultipleOf.tsx index e70c2625..43b4d571 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/NumberMultipleOf.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/NumberMultipleOf.tsx @@ -2,7 +2,7 @@ import React from "react" import Translate from "@docusaurus/Translate" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ObjectProperties.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ObjectProperties.tsx index d6bdd2db..23019a7d 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/ObjectProperties.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/ObjectProperties.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { AndLabel } from "../../labels/index" +import { AndLabel } from "@theme/JSONSchemaViewer/labels" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/Pattern.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/Pattern.tsx index cca6f43e..e6706226 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/Pattern.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/Pattern.tsx @@ -2,7 +2,7 @@ import React from "react" import Translate from "@docusaurus/Translate" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/QualifierMessagesMap.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/QualifierMessagesMap.tsx index 624802ae..cb9cbd64 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/QualifierMessagesMap.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/QualifierMessagesMap.tsx @@ -1,9 +1,9 @@ import React from "react" -import * as QMS from "./index" +import * as QMS from "@theme/JSONSchemaViewer/utils/QualifierMessages" -import type { JSONSchema, JSONSchemaNS } from "../../types" -import type { JSVOptions } from "../../contexts/index" +import type { JSONSchema, JSONSchemaNS } from "@theme/JSONSchemaViewer/types" +import type { JSVOptions } from "@theme/JSONSchemaViewer/contexts" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/StringLength.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/StringLength.tsx index 9649a560..f5d58120 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/StringLength.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/StringLength.tsx @@ -2,9 +2,9 @@ import React from "react" import Translate from "@docusaurus/Translate" -import { AndLabel } from "../../labels/index" +import { AndLabel } from "@theme/JSONSchemaViewer/labels" -import type { JSONSchema } from "../../types" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/QualifierMessages/index.tsx b/src/theme/JSONSchemaViewer/utils/QualifierMessages/index.tsx index e76f8756..2a366f8d 100644 --- a/src/theme/JSONSchemaViewer/utils/QualifierMessages/index.tsx +++ b/src/theme/JSONSchemaViewer/utils/QualifierMessages/index.tsx @@ -14,30 +14,30 @@ export function printSchemaType(obj: unknown): JSX.Element { } // Inner functions -export { default as EnumQM } from "./Enum" -export { default as StringLengthQM } from "./StringLength" -export { default as ObjectPropertiesQM } from "./ObjectProperties" -export { default as NoExtraPropertiesQM } from "./NoExtraProperties" -export { default as ArrayNumberOfItemsQM } from "./ArrayNumberOfItems" -export { default as ArrayContainsNumberQM } from "./ArrayContainsNumber" -export { default as NoExtraItemsQM } from "./NoExtraItems" -export { default as NumberBoundsQM } from "./NumberBounds" -export { default as PatternQM } from "./Pattern" -export { default as MultipleOfQM } from "./NumberMultipleOf" -export { default as ArrayUniqueItemsQM } from "./ArrayUniqueItems" -export { default as DefaultValueQM } from "./DefaultValue" -export { default as ConstantQM } from "./Constant" -export { default as ExamplesQM } from "./Examples" -export { default as DeprecatedQM } from "./Deprecated" -export { default as ReadOnlyQM } from "./ReadOnly" -export { default as WriteOnlyQM } from "./WriteOnly" -export { default as NullableQM } from "./Nullable" -export { default as ContentMediaTypeQM } from "./ContentMediaType" -export { default as ContentEncodingQM } from "./ContentEncoding" -export { default as ContentSchemaQM } from "./ContentSchema" +export { default as EnumQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/Enum" +export { default as StringLengthQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/StringLength" +export { default as ObjectPropertiesQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/ObjectProperties" +export { default as NoExtraPropertiesQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/NoExtraProperties" +export { default as ArrayNumberOfItemsQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/ArrayNumberOfItems" +export { default as ArrayContainsNumberQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/ArrayContainsNumber" +export { default as NoExtraItemsQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/NoExtraItems" +export { default as NumberBoundsQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/NumberBounds" +export { default as PatternQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/Pattern" +export { default as MultipleOfQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/NumberMultipleOf" +export { default as ArrayUniqueItemsQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/ArrayUniqueItems" +export { default as DefaultValueQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/DefaultValue" +export { default as ConstantQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/Constant" +export { default as ExamplesQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/Examples" +export { default as DeprecatedQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/Deprecated" +export { default as ReadOnlyQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/ReadOnly" +export { default as WriteOnlyQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/WriteOnly" +export { default as NullableQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/Nullable" +export { default as ContentMediaTypeQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/ContentMediaType" +export { default as ContentEncodingQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/ContentEncoding" +export { default as ContentSchemaQM } from "@theme/JSONSchemaViewer/utils/QualifierMessages/ContentSchema" export { CHECKS_MAP as QUALIFIERS_MAP, DEFAULT_ORDER as QUALIFIERS_DEFAULT_ORDER, -} from "./QualifierMessagesMap" +} from "@theme/JSONSchemaViewer/utils/QualifierMessages/QualifierMessagesMap" -export type { CheckKey } from "./QualifierMessagesMap" +export type { CheckKey } from "@theme/JSONSchemaViewer/utils/QualifierMessages/QualifierMessagesMap" diff --git a/src/theme/JSONSchemaViewer/utils/detectTypes.ts b/src/theme/JSONSchemaViewer/utils/detectTypes.ts index ed83d73e..04fd7a13 100644 --- a/src/theme/JSONSchemaViewer/utils/detectTypes.ts +++ b/src/theme/JSONSchemaViewer/utils/detectTypes.ts @@ -1,4 +1,8 @@ -import type { JSONSchema, JSONSchemaNS, TypeValues } from "../types" +import type { + JSONSchema, + JSONSchemaNS, + TypeValues, +} from "@theme/JSONSchemaViewer/types" // Utility functions to know which case we have export const isObjectType = (schema: JSONSchema) => diff --git a/src/theme/JSONSchemaViewer/utils/generateFriendlyName.tsx b/src/theme/JSONSchemaViewer/utils/generateFriendlyName.tsx index ed10999c..e705f2f8 100644 --- a/src/theme/JSONSchemaViewer/utils/generateFriendlyName.tsx +++ b/src/theme/JSONSchemaViewer/utils/generateFriendlyName.tsx @@ -1,13 +1,22 @@ import React from "react" // Utility functions to know which case we have -import { detectedTypes } from "./index" - -import { TypeLabelSwitch } from "../components/index" - -import { AndLabel, NotLabel, OrLabel, XorLabel } from "../labels/index" - -import type { JSONSchema, JSONSchemaNS, TypeValues } from "../types" +import { detectedTypes } from "@theme/JSONSchemaViewer/utils" + +import { TypeLabelSwitch } from "@theme/JSONSchemaViewer/components" + +import { + AndLabel, + NotLabel, + OrLabel, + XorLabel, +} from "@theme/JSONSchemaViewer/labels" + +import type { + JSONSchema, + JSONSchemaNS, + TypeValues, +} from "@theme/JSONSchemaViewer/types" // common function I need below function shouldAddSeparator(idx: number, length: number): boolean { diff --git a/src/theme/JSONSchemaViewer/utils/getQualifierMessages.tsx b/src/theme/JSONSchemaViewer/utils/getQualifierMessages.tsx index 83652665..fb55cbdd 100644 --- a/src/theme/JSONSchemaViewer/utils/getQualifierMessages.tsx +++ b/src/theme/JSONSchemaViewer/utils/getQualifierMessages.tsx @@ -3,10 +3,10 @@ import React from "react" import { QUALIFIERS_MAP, QUALIFIERS_DEFAULT_ORDER, -} from "./QualifierMessages/index" +} from "@theme/JSONSchemaViewer/utils/QualifierMessages" -import type { JSONSchema } from "../types" -import type { JSVOptions } from "../contexts/index" +import type { JSONSchema } from "@theme/JSONSchemaViewer/types" +import type { JSVOptions } from "@theme/JSONSchemaViewer/contexts" type Props = { schema: Exclude diff --git a/src/theme/JSONSchemaViewer/utils/index.tsx b/src/theme/JSONSchemaViewer/utils/index.tsx index 69eb4625..0dfe2c2e 100644 --- a/src/theme/JSONSchemaViewer/utils/index.tsx +++ b/src/theme/JSONSchemaViewer/utils/index.tsx @@ -1,10 +1,10 @@ // To keep my mind happy, let's have a place where I can import stuff without knowing their final place in internal structure // Re export generateFriendlyName function -export { default as GenerateFriendlyName } from "./generateFriendlyName" +export { default as GenerateFriendlyName } from "@theme/JSONSchemaViewer/utils/generateFriendlyName" // Re export QualifierMessages function -export { default as QualifierMessages } from "./getQualifierMessages" +export { default as QualifierMessages } from "@theme/JSONSchemaViewer/utils/getQualifierMessages" // Re export detectTypes functions -export * from "./detectTypes" +export * from "@theme/JSONSchemaViewer/utils/detectTypes" diff --git a/src/theme/MonacoEditor/index.tsx b/src/theme/MonacoEditor/index.tsx index 66faa4a1..12827369 100644 --- a/src/theme/MonacoEditor/index.tsx +++ b/src/theme/MonacoEditor/index.tsx @@ -7,7 +7,7 @@ import ErrorBoundary from "@docusaurus/ErrorBoundary" import { LoadingLabel, ErrorOccurredLabel, -} from "../JSONSchemaViewer/labels/index" +} from "@theme/JSONSchemaViewer/labels" import type { Props as ErrorProps } from "@theme/Error" import type { MonacoEditorProps } from "react-monaco-editor" diff --git a/testsite/docs/quick-start.mdx b/testsite/docs/quick-start.mdx index e7be232e..49c75b39 100644 --- a/testsite/docs/quick-start.mdx +++ b/testsite/docs/quick-start.mdx @@ -95,6 +95,9 @@ Suppose you have the following asset defined : Which you can use in your MDX pages as : + + + ```tsx title="/docs/example.mdx" import CodeBlock from '@theme/CodeBlock'; import Schema from "@site/static/schemas/mySuperSchema.json"; @@ -111,10 +114,36 @@ import JSONSchemaViewer from "@theme/JSONSchemaViewer"; + + +```jsx title="/docs/example.mdx" +import CodeBlock from '@theme/CodeBlock'; +import Schema from "@site/static/schemas/mySuperSchema.json"; +// In JS only projects, you can't enjoy nice imports for 3rd libs without @docusaurus/module-type-aliases +import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer" + +# My super Schema + + + +# Source : + +{JSON.stringify(Schema, null, 2)} +``` + + + + + + + Suppose your specifications are available somewhere ( [Github Gists](https://gist.github.com/) / [Bitbucket Snippets](https://bitbucket.org/snippets/new) / ... ) + + + ```tsx title="/src/pages/API.tsx" import React from "react" import Layout from "@theme/Layout" @@ -151,6 +180,50 @@ export default function ExamplePage(): JSX.Element { } ``` + + + + +```jsx title="/src/pages/API.jsx" +import React from "react" +import Layout from "@theme/Layout" +// In JS only projects, you can't enjoy nice imports for 3rd libs without @docusaurus/module-type-aliases +import JSONSchemaViewer from "docusaurus-json-schema-plugin/lib/theme/JSONSchemaViewer" + +export default function ExamplePage() { + const [schema, setSchema] = React.useState(undefined); + + React.useEffect( () => { + fetch( + // TODO Your link here + "https://gist.githubusercontent.com/jy95/...", + { + headers: { + 'Accept': 'application/json', + } + } + ) + .then((response) => response.json()) + .then((data) => setSchema(data)) + .catch( (err) => setSchema(err) ) + }, [schema]) + + return ( + + {schema === undefined &&
Loading ...
} + {schema !== undefined && schema instanceof Error &&
Houston we have a problem : {schema.message}
} + {schema !== undefined && !(schema instanceof Error) && } +
+ ) +} +``` + +
+
+ Which you can see by access related page (e.g. `/API` in that case )
diff --git a/tsconfig.json b/tsconfig.json index 8f326093..e6225837 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -55,6 +55,10 @@ "docusaurus-json-schema-plugin/*": [ "./*", "node_modules/docusaurus-json-schema-plugin/*" + ], + "@theme/*": [ + "./src/theme/*", + "node_modules/docusaurus-json-schema-plugin/src/theme/*" ] }, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */