docs: added note in API reference clarifying what schemas are (#11116)

* docs: added note in API reference clarifying what schemas are

* add yarn lock
This commit is contained in:
Shahed Nasser
2025-01-23 17:02:25 +02:00
committed by GitHub
parent 4eecda5466
commit c4eb36b837
5 changed files with 79 additions and 63 deletions
@@ -7,6 +7,8 @@ import {
Badge,
CodeBlock,
isElmWindow,
Link,
Note,
useIsBrowser,
useScrollController,
useSidebar,
@@ -20,6 +22,7 @@ import { InView } from "react-intersection-observer"
import checkElementInViewport from "../../../../utils/check-element-in-viewport"
import { singular } from "pluralize"
import clsx from "clsx"
import { useArea } from "../../../../providers/area"
export type TagSectionSchemaProps = {
schema: SchemaObject
@@ -29,6 +32,7 @@ export type TagSectionSchemaProps = {
const TagSectionSchema = ({ schema, tagName }: TagSectionSchemaProps) => {
const paramsRef = useRef<HTMLDivElement>(null)
const { addItems, setActivePath, activePath } = useSidebar()
const { displayedArea } = useArea()
const tagSlugName = useMemo(() => getSectionId([tagName]), [tagName])
const formattedName = useMemo(
() => singular(tagName).replaceAll(" ", ""),
@@ -129,6 +133,16 @@ const TagSectionSchema = ({ schema, tagName }: TagSectionSchemaProps) => {
mainContent={
<div>
<h2>{formattedName} Object</h2>
<Note>
This object&apos;s schema is as returned by Medusa&apos;s{" "}
{displayedArea} API routes. However, the related model in the
Medusa application may support more fields and relations. To
view the models in the Medusa application and their relations,
visit the{" "}
<Link href="https://docs.medusajs.com/resources/commerce-modules">
Commerce Modules Documentation
</Link>
</Note>
<h4 className="border-medusa-border-base border-b py-1.5 mt-2">
Fields
</h4>