@scalar/blocks 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/code-example/components/CodeExample.vue.d.ts.map +1 -1
- package/dist/code-example/components/CodeExample.vue.js +1 -1
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/code-example/components/CodeExample.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/code-example/helpers/operation-to-har/process-parameters.js +131 -158
- package/dist/code-example/helpers/operation-to-har/process-parameters.js.map +1 -1
- package/dist/code-example/mount.d.ts +1 -1
- package/dist/code-example/mount.d.ts.map +1 -1
- package/dist/code-example/mount.js +49 -39
- package/dist/code-example/mount.js.map +1 -1
- package/dist/constants.js +1 -1
- package/dist/schema/Schema.vue.d.ts.map +1 -1
- package/dist/schema/Schema.vue.js +1 -1
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js +40 -39
- package/dist/schema/Schema.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaObjectProperties.vue.d.ts.map +1 -1
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js +30 -22
- package/dist/schema/SchemaObjectProperties.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaProperty.vue.d.ts +5 -0
- package/dist/schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/schema/SchemaProperty.vue.js +1 -1
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/schema/SchemaProperty.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.d.ts +6 -4
- package/dist/schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/schema/SchemaPropertyHeading.vue.js +1 -1
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js +155 -132
- package/dist/schema/SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/schema/helpers/dynamic-scope.d.ts +3 -1
- package/dist/schema/helpers/dynamic-scope.d.ts.map +1 -1
- package/dist/schema/helpers/dynamic-scope.js +19 -4
- package/dist/schema/helpers/dynamic-scope.js.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.d.ts.map +1 -1
- package/dist/schema/helpers/get-compositions-to-render.js +24 -24
- package/dist/schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/schema/helpers/index.d.ts +1 -0
- package/dist/schema/helpers/index.d.ts.map +1 -1
- package/dist/schema/helpers/index.js +14 -13
- package/dist/schema/helpers/optimize-value-for-display.d.ts.map +1 -1
- package/dist/schema/helpers/optimize-value-for-display.js +11 -11
- package/dist/schema/helpers/optimize-value-for-display.js.map +1 -1
- package/dist/schema/helpers/partition-all-of-compositions.d.ts.map +1 -1
- package/dist/schema/helpers/partition-all-of-compositions.js +24 -14
- package/dist/schema/helpers/partition-all-of-compositions.js.map +1 -1
- package/dist/schema/helpers/should-render-array-item-composition.d.ts +2 -0
- package/dist/schema/helpers/should-render-array-item-composition.d.ts.map +1 -1
- package/dist/schema/helpers/should-render-array-item-composition.js +2 -6
- package/dist/schema/helpers/should-render-array-item-composition.js.map +1 -1
- package/dist/style.css +67 -42
- package/dist/vue-styles.css +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createElementBlock","_normalizeClass","_renderSlot","_createBlock","_unref","_withCtx","_createElementVNode","_toDisplayString","_Fragment","SchemaPropertyDetail","_renderList","_createTextVNode","_createVNode","Badge","RenderString","SchemaPropertyDefault","SchemaPropertyPattern","SchemaPropertyExamples","Badge_default","RenderString_default","SchemaPropertyDefault_default","SchemaPropertyDetail_default","SchemaPropertyExamples_default","SchemaPropertyPattern_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default","props","__props","useLocalization","fieldNumber","computed","protobufFieldNumber","recursiveTarget","schemaRecursiveTarget","presence","protobufPresence","presenceDescription","valueRef","toRef","constValue","schema","isArraySchema","items","resolve","isDefined","getLeafConstraints","properties","isStringSchema","translate","isNumberSchema","validationProperties","modelLink","getModelNameWithArray","modelLinkable","isModelLinkable","signatureTokens","getDisplayTypeSignatureTokens","shouldShowType","propertyNamesDetail","parts","getSchemaType","detail","exampleValue","itemsSchema","hasExampleContent","examples","patternValue","openBlock","createElementBlock","_ctx","normalizeClass","renderSlot","createCommentVNode","createBlock","unref","ScalarTooltip","withCtx","createElementVNode","toDisplayString","Fragment","_cache","renderList","index","createTextVNode","token","property","createSlots","createVNode"],"sources":["../../src/schema/SchemaPropertyHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarTooltip } from '@scalar/components/tooltip'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n isArraySchema,\n isNumberSchema,\n isStringSchema,\n} from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, toRef } from 'vue'\n\nimport Badge from '../shared/Badge.vue'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { getDisplayTypeSignatureTokens } from './helpers/get-type-signature-tokens'\nimport {\n isModelLinkable,\n type ModelLinkOptions,\n} from './helpers/is-model-linkable'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport {\n protobufFieldNumber,\n protobufPresence,\n type ProtobufSchema,\n} from './protobuf-metadata'\nimport {\n schemaRecursiveTarget,\n type RecursiveSchema,\n} from './recursive-metadata'\nimport RenderString from './RenderString.vue'\nimport SchemaPropertyDefault from './SchemaPropertyDefault.vue'\nimport SchemaPropertyDetail from './SchemaPropertyDetail.vue'\nimport SchemaPropertyExamples from './SchemaPropertyExamples.vue'\nimport SchemaPropertyPattern from './SchemaPropertyPattern.vue'\n\nconst props = withDefaults(\n defineProps<{\n value: SchemaObject | undefined\n enum?: boolean\n isDiscriminator?: boolean\n /** Effective AsyncAPI variant value, separate from const/enum constraints. */\n discriminatorValue?: string\n required?: boolean\n additional?: boolean\n withExamples?: boolean\n hideModelNames?: boolean\n /**\n * Config for deciding whether a model name links to the models section. When the section or\n * the referenced model is hidden there is nothing to scroll to, so the name renders as plain text.\n */\n modelLinkOptions?: ModelLinkOptions\n /** When the schema was resolved from a $ref, pass the ref name so it displays as e.g. \"Data\" instead of \"object\". */\n modelName?: string | null\n /** Resolved propertyNames schema, used to surface key constraints like `format` for additional properties. */\n propertyNames?: SchemaObject\n eventBus?: WorkspaceEventBus | null\n /**\n * The row's name is a stand-in for keys the caller chooses\n * (`additionalProperties`) or keys matching a regex (`patternProperties`),\n * not a literal property. The heading says so in the signature line, where\n * the tree already describes shapes, instead of styling the name itself.\n */\n keyKind?: 'additional' | 'pattern'\n /**\n * The name of the schema this row loops back to. A cut cycle is a leaf, so\n * the signature line says why it does not expand; the model link beside it\n * already names the schema the loop returns to.\n */\n recursiveTo?: string\n }>(),\n {\n isDiscriminator: false,\n required: false,\n withExamples: true,\n hideModelNames: false,\n eventBus: null,\n },\n)\nconst { translate } = useLocalization()\n\n// Convert to reactive refs for composables\nconst fieldNumber = computed(\n () => (props.value as ProtobufSchema | undefined)?.[protobufFieldNumber],\n)\n\nconst recursiveTarget = computed(\n () =>\n props.recursiveTo ??\n (props.value as RecursiveSchema | undefined)?.[schemaRecursiveTarget],\n)\n\nconst presence = computed(\n () => (props.value as ProtobufSchema | undefined)?.[protobufPresence],\n)\nconst presenceDescription = computed(() =>\n presence.value === 'explicit'\n ? 'Explicit presence: Protobuf distinguishes an unset field from one set to its default value.'\n : 'Implicit presence: Protobuf does not distinguish an unset field from one set to its default value.',\n)\n\nconst valueRef = toRef(props, 'value')\n\nconst constValue = computed(() => {\n if (!valueRef.value) {\n return undefined\n }\n\n const schema = valueRef.value\n\n // Direct const value\n if (schema.const !== undefined) {\n return schema.const\n }\n\n // Single-item enum acts as const\n if (schema.enum?.length === 1) {\n return schema.enum[0]\n }\n\n // Check items for const values (for arrays)\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n\n if (isDefined(items.const)) {\n return items.const\n }\n\n if (items.enum?.length === 1) {\n return items.enum[0]\n }\n }\n\n return undefined\n})\n\ntype ValidationProperty = {\n key: string\n value: string | number\n prefix?: string\n code?: boolean\n truncate?: boolean\n}\n\n/**\n * Constraints that live on a leaf (string or number) schema: length, pattern,\n * format and numeric ranges. Extracted so they can be surfaced for a primitive\n * schema as well as for a primitive array's items, which are not rendered on\n * their own. See https://github.com/scalar/scalar/issues/9690\n */\nconst getLeafConstraints = (schema: SchemaObject) => {\n const properties: ValidationProperty[] = []\n\n if (isStringSchema(schema)) {\n if (isDefined(schema.minLength)) {\n properties.push({\n key: 'min-length',\n prefix: `${translate('schema.minLength')}: `,\n value: schema.minLength,\n })\n }\n\n if (isDefined(schema.maxLength)) {\n properties.push({\n key: 'max-length',\n prefix: `${translate('schema.maxLength')}: `,\n value: schema.maxLength,\n })\n }\n\n // pattern is rendered via SchemaPropertyPattern (hover dropdown), skip here\n }\n\n if ((isStringSchema(schema) || isNumberSchema(schema)) && schema.format) {\n properties.push({\n key: 'format',\n value: schema.format,\n truncate: true,\n })\n }\n\n if (isNumberSchema(schema)) {\n if (isDefined(schema.exclusiveMinimum)) {\n properties.push({\n key: 'exclusive-minimum',\n prefix: `${translate('schema.greaterThan')}: `,\n value: schema.exclusiveMinimum,\n })\n }\n\n if (isDefined(schema.minimum)) {\n properties.push({\n key: 'minimum',\n prefix: `${translate('schema.min')}: `,\n value: schema.minimum,\n })\n }\n\n if (isDefined(schema.exclusiveMaximum)) {\n properties.push({\n key: 'exclusive-maximum',\n prefix: `${translate('schema.lessThan')}: `,\n value: schema.exclusiveMaximum,\n })\n }\n\n if (isDefined(schema.maximum)) {\n properties.push({\n key: 'maximum',\n prefix: `${translate('schema.max')}: `,\n value: schema.maximum,\n })\n }\n\n if (isDefined(schema.multipleOf)) {\n properties.push({\n key: 'multiple-of',\n prefix: `${translate('schema.multipleOf')}: `,\n value: schema.multipleOf,\n })\n }\n }\n\n return properties\n}\n\nconst validationProperties = computed(() => {\n if (!valueRef.value) {\n return []\n }\n\n const schema = valueRef.value\n const properties: ValidationProperty[] = []\n\n // Array validation properties\n if (isArraySchema(schema)) {\n if (isDefined(schema.minItems) || isDefined(schema.maxItems)) {\n properties.push({\n key: 'array-range',\n value: `${schema.minItems ?? ''}…${schema.maxItems ?? ''}`,\n })\n }\n\n // Unique items\n if (schema.uniqueItems) {\n properties.push({\n key: 'unique-items',\n value: `${translate('schema.unique')}!`,\n })\n }\n }\n\n properties.push(...getLeafConstraints(schema))\n\n // Primitive array items carry their own constraints (e.g. an array of `uuid`\n // strings) but are not rendered separately, so surface them here.\n if (isArraySchema(schema) && schema.items) {\n properties.push(...getLeafConstraints(resolve.schema(schema.items)))\n }\n\n return properties\n})\n\n/** Link data for navigating to the referenced model in the sidebar. */\nconst modelLink = computed(() => {\n if (!props.value) {\n return null\n }\n\n if (props.hideModelNames) {\n return null\n }\n\n if (props.modelName) {\n return { schemaKey: props.modelName, label: props.modelName }\n }\n\n return getModelNameWithArray(props.value)\n})\n\n/** Whether the model name links to the models section, or renders as plain text. */\nconst modelLinkable = computed(() =>\n isModelLinkable(modelLink.value?.schemaKey, props.modelLinkOptions ?? {}),\n)\n\n/**\n * The type as a run of tokens rather than a single string — identifiers in\n * the code face, English words like `array of` in the sans face, and a muted\n * `|` so `string | null` reads as one type with an alternative.\n *\n * The token run and the screen-reader label are written straight into the\n * template instead of being their own components: the tree mounts one per\n * typed row, and a component instance costs more to create than the span it\n * renders. On a flat object the type cells would be most of the instance\n * count. The linked and the plain copy of the token markup below must stay\n * identical.\n */\nconst signatureTokens = computed(() =>\n getDisplayTypeSignatureTokens(props.value, {\n hideModelNames: props.hideModelNames,\n modelName: modelLink.value?.label,\n }),\n)\n\n/** Check if we should show the type information */\nconst shouldShowType = computed(() => {\n if (!props.value || !('type' in props.value)) {\n return false\n }\n\n // Always show type for arrays, even when items have const values\n if (props.value.type === 'array') {\n return true\n }\n\n // For non-arrays, only show if no const value at the schema level\n return !constValue.value\n})\n\n/**\n * Type and format of the property keys, derived from the propertyNames schema.\n *\n * For a map keyed by UUIDs this renders e.g. \"string · uuid\" so the key\n * constraints are not lost. Returns undefined when there is nothing to show.\n */\nconst propertyNamesDetail = computed(() => {\n const schema = props.propertyNames\n if (!schema) {\n return undefined\n }\n\n const parts = [getSchemaType(schema)]\n if ('format' in schema && typeof schema.format === 'string') {\n parts.push(schema.format)\n }\n\n const detail = parts.filter(Boolean).join(' · ')\n return detail.length > 0 ? detail : undefined\n})\n\nconst exampleValue = computed(() => {\n // Treat only `undefined` as \"not set\" — `null` is a valid example value on a nullable schema.\n if (\n props.value &&\n 'example' in props.value &&\n props.value.example !== undefined\n ) {\n return props.value.example\n }\n\n // An array's own examples take precedence over the fallback from its items.\n if (\n props.value &&\n isArraySchema(props.value) &&\n !props.value.examples?.length\n ) {\n const itemsSchema = resolve.schema(props.value.items)\n if (\n itemsSchema &&\n 'example' in itemsSchema &&\n itemsSchema.example !== undefined\n ) {\n return itemsSchema.example\n }\n }\n\n return undefined\n})\n\n/**\n * Whether the examples chip has anything to render.\n *\n * `SchemaPropertyExamples` already renders nothing without an example, but it\n * still mounts, and mounting is what installs its popup's window-level click\n * and keydown listeners. `withExamples` defaults to true, so without this gate\n * every property row on the page — including a plain `{ type: 'string' }` —\n * pays for a popup it never opens. Mirrors the component's own two branches.\n */\nconst hasExampleContent = computed((): boolean => {\n if (exampleValue.value !== undefined) {\n return true\n }\n\n const examples = props.value?.examples\n\n return (\n !!examples &&\n typeof examples === 'object' &&\n Object.keys(examples).length > 0\n )\n})\n\n/**\n * The regex `pattern` to surface via the hover dropdown. It lives on a string\n * schema, or on the items of a primitive array (which is not rendered on its\n * own, so its constraints are surfaced on the array heading — see\n * https://github.com/scalar/scalar/issues/9690).\n */\nconst patternValue = computed(() => {\n const schema = valueRef.value\n if (!schema) {\n return undefined\n }\n\n if (isStringSchema(schema) && schema.pattern) {\n return schema.pattern\n }\n\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n if (isStringSchema(items) && items.pattern) {\n return items.pattern\n }\n }\n\n return undefined\n})\n</script>\n<template>\n <div\n class=\"property-heading [&>.property-detail:has(+.property-detail)]:mr-0\">\n <!-- `:has(+.property-detail)`: only a detail FOLLOWED BY another detail\n drops its right margin, because the `·` separator supplies the gap\n there. Not `:not(:last-of-type)`, which matches by element type: the\n collapsed preview and the trailing copy-link are spans as well, so it\n would strip the margin from the final detail and glue \"Addressrequired\"\n together on a collapsed row. -->\n <div\n v-if=\"$slots.name\"\n class=\"property-name\"\n :class=\"{ deprecated: props.value?.deprecated }\">\n <slot name=\"name\" />\n </div>\n <ScalarTooltip\n v-if=\"fieldNumber !== undefined\"\n content=\"Protobuf field number\">\n <span class=\"text-c-3 font-code mr-2 text-xs\">\n <span aria-hidden=\"true\">#{{ fieldNumber }}</span>\n <span class=\"sr-only\">Protobuf field number: {{ fieldNumber }}</span>\n </span>\n </ScalarTooltip>\n <div\n v-if=\"props.isDiscriminator\"\n class=\"property-discriminator\">\n {{ translate('schema.discriminator') }}\n </div>\n <template v-if=\"props.value\">\n <!-- A map key reads `additionalProperty · string`: the keyword leads the\n detail list in the accent colour, like a type word, so the name\n above it can look like every other name. -->\n <SchemaPropertyDetail\n v-if=\"props.keyKind\"\n class=\"property-key-kind\">\n <span class=\"font-code text-c-accent\">{{\n props.keyKind === 'pattern' ? 'patternProperty' : 'additionalProperty'\n }}</span>\n </SchemaPropertyDetail>\n <!-- Type information -->\n <SchemaPropertyDetail\n v-if=\"shouldShowType\"\n truncate>\n <!-- The type is a token run (`array of Planet`) and a $ref link IS the\n type, not an appended `· Account` -->\n <!-- Written across lines on purpose: Vue drops whitespace-only text\n between two elements, so a single-line label would read\n `Type:string`. -->\n <span class=\"screenreader-only\"> {{ translate('schema.type') }}: </span>\n <button\n v-if=\"props.eventBus && modelLink?.schemaKey && modelLinkable\"\n class=\"text-c-2 hover:text-c-1 underline\"\n type=\"button\"\n @click=\"\n props.eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n <span\n v-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </button>\n <span\n v-else-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </SchemaPropertyDetail>\n\n <!-- A cycle reads `array of Satellite · recursive`, a modifier like\n `nullable`; the full sentence rides the tooltip. -->\n <SchemaPropertyDetail\n v-if=\"recursiveTarget\"\n class=\"property-recursive\"\n :title=\"\n translate('schema.recursiveReference', { name: recursiveTarget })\n \">\n {{ translate('schema.recursive') }}\n </SchemaPropertyDetail>\n\n <ScalarTooltip\n v-if=\"presence\"\n :content=\"presenceDescription\">\n <span class=\"text-c-2 mr-2 text-xs\">\n <span aria-hidden=\"true\">optional</span>\n <span class=\"sr-only\"\n >Optional ({{ presence }} presence). {{ presenceDescription }}</span\n >\n </span>\n </ScalarTooltip>\n\n <!-- Key constraints from propertyNames (e.g. \"keys: string · uuid\") -->\n <SchemaPropertyDetail\n v-if=\"propertyNamesDetail\"\n truncate>\n <template #prefix>{{ translate('schema.keys') }}:</template>\n {{ propertyNamesDetail }}\n </SchemaPropertyDetail>\n\n <!-- Dynamic validation properties from composable -->\n <SchemaPropertyDetail\n v-for=\"property in validationProperties\"\n :key=\"property.key\"\n :code=\"property.code\"\n :truncate=\"property.truncate\">\n <span\n v-if=\"property.key === 'format'\"\n class=\"screenreader-only\">\n {{ translate('schema.format') }}:\n </span>\n <template\n v-if=\"property.prefix\"\n #prefix>\n {{ property.prefix }}\n </template>\n {{ property.value }}\n </SchemaPropertyDetail>\n\n <!-- Enum indicator -->\n <SchemaPropertyDetail v-if=\"props.enum\">\n {{ translate('schema.enum') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.additional\"\n class=\"property-additional\">\n <template v-if=\"props.value?.['x-additionalPropertiesName']\">\n {{ props.value['x-additionalPropertiesName'] }}\n </template>\n <template v-else>{{ translate('schema.additionalProperties') }}</template>\n </div>\n <div\n v-if=\"props.value?.deprecated\"\n class=\"property-deprecated\">\n <Badge>{{ translate('schema.deprecated') }}</Badge>\n </div>\n <span\n v-if=\"discriminatorValue !== undefined\"\n class=\"text-c-2\">\n {{ translate('schema.discriminatorValue') }}:\n <RenderString :value=\"discriminatorValue\" />\n </span>\n <!-- Don't use `isDefined` here, we want to show `const` when the value is `null` -->\n <div\n v-if=\"constValue !== undefined\"\n class=\"property-const\">\n <SchemaPropertyDetail truncate>\n <template #prefix>{{ translate('schema.const') }}: </template>\n <RenderString :value=\"constValue\" />\n </SchemaPropertyDetail>\n </div>\n <template v-else>\n <!-- Shows only when a composition is used (so props.value?.type is undefined) -->\n <SchemaPropertyDetail v-if=\"(props.value as any)?.nullable === true\">\n {{ translate('schema.nullable') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.value?.writeOnly\"\n class=\"property-write-only\">\n {{ translate('schema.writeOnly') }}\n </div>\n <div\n v-else-if=\"props.value?.readOnly\"\n class=\"property-read-only\">\n {{ translate('schema.readOnly') }}\n </div>\n <div\n v-if=\"props.required\"\n class=\"property-required\">\n {{ translate('schema.required') }}\n </div>\n <!-- Gated here, not only inside the component: each popup instance installs\n window-level click and keydown listeners for its dismissal, so mounting\n one per row costs the page a listener per row it never shows anything\n for. Same reason `SchemaPropertyPattern` below is gated. -->\n <SchemaPropertyDefault\n v-if=\"props.value?.default !== undefined\"\n :value=\"props.value?.default\" />\n <!--\n Pattern is a hover dropdown chip like Examples, not an inline constraint,\n so it sits beside the example. This keeps the real constraints (length,\n nullable, …) together in the dotted list. See #9966.\n -->\n <SchemaPropertyPattern\n v-if=\"patternValue\"\n :pattern=\"patternValue\" />\n <SchemaPropertyExamples\n v-if=\"props.withExamples && hasExampleContent\"\n :example=\"exampleValue\"\n :examples=\"props.value?.examples\" />\n <!-- The collapsed preview rides the end of the heading line -->\n <slot name=\"preview\" />\n <!-- Last so the tab order matches the visual order: the trailing copy-link\n is painted at the row's right edge, after every control to its left -->\n <slot name=\"trailing\" />\n </div>\n</template>\n<style scoped>\n.property-heading {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n row-gap: 9px;\n white-space: nowrap;\n}\n\n.property-heading:has(+ .children),\n.property-heading:has(+ .property-rule) {\n margin-bottom: 9px;\n}\n\n.property-heading > * {\n margin-right: 9px;\n}\n\n.property-heading:last-child {\n margin-right: 0;\n}\n\n.property-name {\n max-width: 100%;\n font-family: var(--scalar-font-code);\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n white-space: normal;\n overflow-wrap: break-word;\n}\n\n.property-additional {\n font-family: var(--scalar-font-code);\n}\n\n.property-required,\n.property-optional {\n color: var(--scalar-color-2);\n}\n\n.property-required {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-orange);\n}\n/*\n * Light-mode oranges are too bright on a light page for 13px text (the default\n * #ff5800 is 3.16:1), so blend the theme orange toward the text colour to reach\n * WCAG 1.4.3 (4.5:1) while keeping the hue and letting custom themes flow\n * through. Dark mode already passes (8.37:1) and keeps the plain token.\n */\n.light-mode .property-required {\n color: color-mix(\n in srgb,\n var(--scalar-color-orange),\n var(--scalar-color-1) 32%\n );\n}\n\n.property-read-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-blue);\n}\n\n.property-write-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-green);\n}\n\n.property-discriminator {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-purple);\n}\n\n.property-detail {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n display: flex;\n align-items: center;\n\n min-width: 0;\n}\n\n.property-const {\n color: var(--scalar-color-1);\n}\n\n.deprecated {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCA,IAAM8C,IAAQC,GA2CR,EAAE,iBAAcC,EAAgB,GAGhCC,IAAcC,QACXJ,EAAM,QAAuCK,GACtD,GAEMC,IAAkBF,QAEpBJ,EAAM,eACLA,EAAM,QAAwCO,GACnD,GAEMC,IAAWJ,QACRJ,EAAM,QAAuCS,GACtD,GACMC,IAAsBN,QAC1BI,EAAS,UAAU,aACf,gGACA,oGACN,GAEMG,IAAWC,GAAMZ,GAAO,OAAO,GAE/Ba,IAAaT,QAAe;GAChC,IAAI,CAACO,EAAS,OACZ;GAGF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EAHD,UAAA,GAAQ,GAAA;IACjB,QAAMJ,QAAgC,CAA5BM,EAAAJ,EAAAH,EAAA8D,CAAA,CAAS,CAAA,cAAA,CAAA,IAAmB,MAAE,CAAA,C;IACnD,SAAA7D,QAAoC,CAApCO,EAAoCE,GAAA,EAArB,OAAO2C,EAAA,MAAU,GAAA,MAAA,GAAA,CAAA,OAAA,CAAA,C;;;GAU5Bb,EAAM,OAAO,aADrB7C,EAAA,GAAAC,EAIM,OAJNwC,IAIMjC,EADDH,EAAA8D,CAAA,CAAS,CAAA,kBAAA,CAAA,GAAA,CAAA,KAGDtB,EAAM,OAAO,YAD1B7C,EAAA,GAAAC,EAIM,OAJNyC,IAIMlC,EADDH,EAAA8D,CAAA,CAAS,CAAA,iBAAA,CAAA,GAAA,CAAA,K;GAGNtB,EAAM,YADd7C,EAAA,GAAAC,EAIM,OAJN0C,IAIMnC,EADDH,EAAA8D,CAAA,CAAS,CAAA,iBAAA,CAAA,GAAA,CAAA,K;GAONtB,EAAM,OAAO,YAAY,KAAA,I,aADjC7C,EAAA,GAAAI,EAEkCY,IAAA;;IAA/B,OAAO6B,EAAM,OAAO;;GAOfwC,EAAA,SADRrF,EAAA,GAAAI,EAE4Ba,IAAA;;IAAzB,SAASoE,EAAA;;GAEJxC,EAAM,gBAAgBsC,GAAA,SAD9BnF,EAAA,GAAAI,EAGsCc,IAAA;;IADnC,SAAS+D,EAAA;IACT,UAAUpC,EAAM,OAAO;;GAE1B1C,EAAuBqF,EAAA,QAAA,WAAA,CAAA,GAAA,KAAA,GAAA,EAAA;GAGvBrF,EAAwBqF,EAAA,QAAA,YAAA,CAAA,GAAA,KAAA,GAAA,EAAA"}
|
|
1
|
+
{"version":3,"file":"SchemaPropertyHeading.vue_vue_type_script_setup_true_lang.js","names":["$slots","_openBlock","_createElementBlock","_Fragment","_renderList","_createBlock","Badge","_normalizeClass","_withCtx","_createTextVNode","_toDisplayString","_renderSlot","_unref","_createElementVNode","SchemaPropertyDetail","_createVNode","RenderString","SchemaPropertyDefault","SchemaPropertyPattern","SchemaPropertyExamples","Badge_default","RenderString_default","SchemaPropertyDefault_default","SchemaPropertyDetail_default","SchemaPropertyExamples_default","SchemaPropertyPattern_default","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","badgeClass","SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default","props","__props","useLocalization","fieldNumber","computed","protobufFieldNumber","recursiveTarget","schemaRecursiveTarget","presence","protobufPresence","presenceDescription","valueRef","toRef","positionedBadges","entries","badge","constValue","schema","isArraySchema","items","resolve","isDefined","getLeafConstraints","properties","isStringSchema","translate","isNumberSchema","validationProperties","modelLink","getModelNameWithArray","modelLinkable","isModelLinkable","signatureTokens","getDisplayTypeSignatureTokens","shouldShowType","propertyNamesDetail","parts","getSchemaType","detail","exampleValue","itemsSchema","hasExampleContent","examples","patternValue","openBlock","createElementBlock","Fragment","renderList","createBlock","index","normalizeClass","withCtx","createTextVNode","toDisplayString","_ctx","renderSlot","createCommentVNode","unref","ScalarTooltip","createElementVNode","_cache","token","property","createSlots","createVNode"],"sources":["../../src/schema/SchemaPropertyHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarTooltip } from '@scalar/components/tooltip'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { XBadge } from '@scalar/workspace-store/schemas/extensions/operation'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n isArraySchema,\n isNumberSchema,\n isStringSchema,\n} from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\nimport { computed, toRef } from 'vue'\n\nimport Badge from '../shared/Badge.vue'\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { getDisplayTypeSignatureTokens } from './helpers/get-type-signature-tokens'\nimport {\n isModelLinkable,\n type ModelLinkOptions,\n} from './helpers/is-model-linkable'\nimport { getModelNameWithArray } from './helpers/schema-name'\nimport { useLocalization } from './localization'\nimport {\n protobufFieldNumber,\n protobufPresence,\n type ProtobufSchema,\n} from './protobuf-metadata'\nimport {\n schemaRecursiveTarget,\n type RecursiveSchema,\n} from './recursive-metadata'\nimport RenderString from './RenderString.vue'\nimport SchemaPropertyDefault from './SchemaPropertyDefault.vue'\nimport SchemaPropertyDetail from './SchemaPropertyDetail.vue'\nimport SchemaPropertyExamples from './SchemaPropertyExamples.vue'\nimport SchemaPropertyPattern from './SchemaPropertyPattern.vue'\n\nconst props = withDefaults(\n defineProps<{\n value: SchemaObject | undefined\n badges?: XBadge[]\n enum?: boolean\n isDiscriminator?: boolean\n /** Effective AsyncAPI variant value, separate from const/enum constraints. */\n discriminatorValue?: string\n required?: boolean\n additional?: boolean\n withExamples?: boolean\n hideModelNames?: boolean\n /**\n * Config for deciding whether a model name links to the models section. When the section or\n * the referenced model is hidden there is nothing to scroll to, so the name renders as plain text.\n */\n modelLinkOptions?: ModelLinkOptions\n /** When the schema was resolved from a $ref, pass the ref name so it displays as e.g. \"Data\" instead of \"object\". */\n modelName?: string | null\n /** Resolved propertyNames schema, used to surface key constraints like `format` for additional properties. */\n propertyNames?: SchemaObject\n eventBus?: WorkspaceEventBus | null\n /**\n * The row's name is a stand-in for keys the caller chooses\n * (`additionalProperties`) or keys matching a regex (`patternProperties`),\n * not a literal property. The heading says so in the signature line, where\n * the tree already describes shapes, instead of styling the name itself.\n */\n keyKind?: 'additional' | 'pattern'\n /**\n * The name of the schema this row loops back to. A cut cycle is a leaf, so\n * the signature line says why it does not expand; the model link beside it\n * already names the schema the loop returns to.\n */\n recursiveTo?: string\n }>(),\n {\n isDiscriminator: false,\n required: false,\n withExamples: true,\n hideModelNames: false,\n eventBus: null,\n },\n)\nconst { translate } = useLocalization()\n\n// Convert to reactive refs for composables\nconst fieldNumber = computed(\n () => (props.value as ProtobufSchema | undefined)?.[protobufFieldNumber],\n)\n\nconst recursiveTarget = computed(\n () =>\n props.recursiveTo ??\n (props.value as RecursiveSchema | undefined)?.[schemaRecursiveTarget],\n)\n\nconst presence = computed(\n () => (props.value as ProtobufSchema | undefined)?.[protobufPresence],\n)\nconst presenceDescription = computed(() =>\n presence.value === 'explicit'\n ? 'Explicit presence: Protobuf distinguishes an unset field from one set to its default value.'\n : 'Implicit presence: Protobuf does not distinguish an unset field from one set to its default value.',\n)\n\nconst valueRef = toRef(props, 'value')\nconst badgeClass = 'min-w-0 wrap-anywhere whitespace-normal'\n\nconst positionedBadges = computed<\n { before: XBadge[]; after: XBadge[] } | undefined\n>(() => {\n const entries = props.badges\n if (!entries) {\n return undefined\n }\n\n return {\n before: entries.filter((badge) => badge.position === 'before'),\n after: entries.filter((badge) => badge.position !== 'before'),\n }\n})\n\nconst constValue = computed(() => {\n if (!valueRef.value) {\n return undefined\n }\n\n const schema = valueRef.value\n\n // Direct const value\n if (schema.const !== undefined) {\n return schema.const\n }\n\n // Single-item enum acts as const\n if (schema.enum?.length === 1) {\n return schema.enum[0]\n }\n\n // Check items for const values (for arrays)\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n\n if (isDefined(items.const)) {\n return items.const\n }\n\n if (items.enum?.length === 1) {\n return items.enum[0]\n }\n }\n\n return undefined\n})\n\ntype ValidationProperty = {\n key: string\n value: string | number\n prefix?: string\n code?: boolean\n truncate?: boolean\n}\n\n/**\n * Constraints that live on a leaf (string or number) schema: length, pattern,\n * format and numeric ranges. Extracted so they can be surfaced for a primitive\n * schema as well as for a primitive array's items, which are not rendered on\n * their own. See https://github.com/scalar/scalar/issues/9690\n */\nconst getLeafConstraints = (schema: SchemaObject) => {\n const properties: ValidationProperty[] = []\n\n if (isStringSchema(schema)) {\n if (isDefined(schema.minLength)) {\n properties.push({\n key: 'min-length',\n prefix: `${translate('schema.minLength')}: `,\n value: schema.minLength,\n })\n }\n\n if (isDefined(schema.maxLength)) {\n properties.push({\n key: 'max-length',\n prefix: `${translate('schema.maxLength')}: `,\n value: schema.maxLength,\n })\n }\n\n // pattern is rendered via SchemaPropertyPattern (hover dropdown), skip here\n }\n\n if ((isStringSchema(schema) || isNumberSchema(schema)) && schema.format) {\n properties.push({\n key: 'format',\n value: schema.format,\n truncate: true,\n })\n }\n\n if (isNumberSchema(schema)) {\n if (isDefined(schema.exclusiveMinimum)) {\n properties.push({\n key: 'exclusive-minimum',\n prefix: `${translate('schema.greaterThan')}: `,\n value: schema.exclusiveMinimum,\n })\n }\n\n if (isDefined(schema.minimum)) {\n properties.push({\n key: 'minimum',\n prefix: `${translate('schema.min')}: `,\n value: schema.minimum,\n })\n }\n\n if (isDefined(schema.exclusiveMaximum)) {\n properties.push({\n key: 'exclusive-maximum',\n prefix: `${translate('schema.lessThan')}: `,\n value: schema.exclusiveMaximum,\n })\n }\n\n if (isDefined(schema.maximum)) {\n properties.push({\n key: 'maximum',\n prefix: `${translate('schema.max')}: `,\n value: schema.maximum,\n })\n }\n\n if (isDefined(schema.multipleOf)) {\n properties.push({\n key: 'multiple-of',\n prefix: `${translate('schema.multipleOf')}: `,\n value: schema.multipleOf,\n })\n }\n }\n\n return properties\n}\n\nconst validationProperties = computed(() => {\n if (!valueRef.value) {\n return []\n }\n\n const schema = valueRef.value\n const properties: ValidationProperty[] = []\n\n // Array validation properties\n if (isArraySchema(schema)) {\n if (isDefined(schema.minItems) || isDefined(schema.maxItems)) {\n properties.push({\n key: 'array-range',\n value: `${schema.minItems ?? ''}…${schema.maxItems ?? ''}`,\n })\n }\n\n // Unique items\n if (schema.uniqueItems) {\n properties.push({\n key: 'unique-items',\n value: `${translate('schema.unique')}!`,\n })\n }\n }\n\n properties.push(...getLeafConstraints(schema))\n\n // Primitive array items carry their own constraints (e.g. an array of `uuid`\n // strings) but are not rendered separately, so surface them here.\n if (isArraySchema(schema) && schema.items) {\n properties.push(...getLeafConstraints(resolve.schema(schema.items)))\n }\n\n return properties\n})\n\n/** Link data for navigating to the referenced model in the sidebar. */\nconst modelLink = computed(() => {\n if (!props.value) {\n return null\n }\n\n if (props.hideModelNames) {\n return null\n }\n\n if (props.modelName) {\n return { schemaKey: props.modelName, label: props.modelName }\n }\n\n return getModelNameWithArray(props.value)\n})\n\n/** Whether the model name links to the models section, or renders as plain text. */\nconst modelLinkable = computed(() =>\n isModelLinkable(modelLink.value?.schemaKey, props.modelLinkOptions ?? {}),\n)\n\n/**\n * The type as a run of tokens rather than a single string — identifiers in\n * the code face, English words like `array of` in the sans face, and a muted\n * `|` so `string | null` reads as one type with an alternative.\n *\n * The token run and the screen-reader label are written straight into the\n * template instead of being their own components: the tree mounts one per\n * typed row, and a component instance costs more to create than the span it\n * renders. On a flat object the type cells would be most of the instance\n * count. The linked and the plain copy of the token markup below must stay\n * identical.\n */\nconst signatureTokens = computed(() =>\n getDisplayTypeSignatureTokens(props.value, {\n hideModelNames: props.hideModelNames,\n modelName: modelLink.value?.label,\n }),\n)\n\n/** Check if we should show the type information */\nconst shouldShowType = computed(() => {\n if (!props.value || !('type' in props.value)) {\n return false\n }\n\n // Always show type for arrays, even when items have const values\n if (props.value.type === 'array') {\n return true\n }\n\n // For non-arrays, only show if no const value at the schema level\n return !constValue.value\n})\n\n/**\n * Type and format of the property keys, derived from the propertyNames schema.\n *\n * For a map keyed by UUIDs this renders e.g. \"string · uuid\" so the key\n * constraints are not lost. Returns undefined when there is nothing to show.\n */\nconst propertyNamesDetail = computed(() => {\n const schema = props.propertyNames\n if (!schema) {\n return undefined\n }\n\n const parts = [getSchemaType(schema)]\n if ('format' in schema && typeof schema.format === 'string') {\n parts.push(schema.format)\n }\n\n const detail = parts.filter(Boolean).join(' · ')\n return detail.length > 0 ? detail : undefined\n})\n\nconst exampleValue = computed(() => {\n // Treat only `undefined` as \"not set\" — `null` is a valid example value on a nullable schema.\n if (\n props.value &&\n 'example' in props.value &&\n props.value.example !== undefined\n ) {\n return props.value.example\n }\n\n // An array's own examples take precedence over the fallback from its items.\n if (\n props.value &&\n isArraySchema(props.value) &&\n !props.value.examples?.length\n ) {\n const itemsSchema = resolve.schema(props.value.items)\n if (\n itemsSchema &&\n 'example' in itemsSchema &&\n itemsSchema.example !== undefined\n ) {\n return itemsSchema.example\n }\n }\n\n return undefined\n})\n\n/**\n * Whether the examples chip has anything to render.\n *\n * `SchemaPropertyExamples` already renders nothing without an example, but it\n * still mounts, and mounting is what installs its popup's window-level click\n * and keydown listeners. `withExamples` defaults to true, so without this gate\n * every property row on the page — including a plain `{ type: 'string' }` —\n * pays for a popup it never opens. Mirrors the component's own two branches.\n */\nconst hasExampleContent = computed((): boolean => {\n if (exampleValue.value !== undefined) {\n return true\n }\n\n const examples = props.value?.examples\n\n return (\n !!examples &&\n typeof examples === 'object' &&\n Object.keys(examples).length > 0\n )\n})\n\n/**\n * The regex `pattern` to surface via the hover dropdown. It lives on a string\n * schema, or on the items of a primitive array (which is not rendered on its\n * own, so its constraints are surfaced on the array heading — see\n * https://github.com/scalar/scalar/issues/9690).\n */\nconst patternValue = computed(() => {\n const schema = valueRef.value\n if (!schema) {\n return undefined\n }\n\n if (isStringSchema(schema) && schema.pattern) {\n return schema.pattern\n }\n\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n if (isStringSchema(items) && items.pattern) {\n return items.pattern\n }\n }\n\n return undefined\n})\n</script>\n<template>\n <div\n class=\"property-heading [&>.property-detail:has(+.property-detail)]:mr-0\">\n <!-- `:has(+.property-detail)`: only a detail FOLLOWED BY another detail\n drops its right margin, because the `·` separator supplies the gap\n there. Not `:not(:last-of-type)`, which matches by element type: the\n collapsed preview and the trailing copy-link are spans as well, so it\n would strip the margin from the final detail and glue \"Addressrequired\"\n together on a collapsed row. -->\n <Badge\n v-for=\"(badge, index) in positionedBadges?.before\"\n :key=\"index\"\n :class=\"badgeClass\"\n :color=\"badge.color\">\n {{ badge.name }}\n </Badge>\n <div\n v-if=\"$slots.name\"\n class=\"property-name\"\n :class=\"{ deprecated: props.value?.deprecated }\">\n <slot name=\"name\" />\n </div>\n <ScalarTooltip\n v-if=\"fieldNumber !== undefined\"\n content=\"Protobuf field number\">\n <span class=\"text-c-3 font-code mr-2 text-xs\">\n <span aria-hidden=\"true\">#{{ fieldNumber }}</span>\n <span class=\"sr-only\">Protobuf field number: {{ fieldNumber }}</span>\n </span>\n </ScalarTooltip>\n <div\n v-if=\"props.isDiscriminator\"\n class=\"property-discriminator\">\n {{ translate('schema.discriminator') }}\n </div>\n <template v-if=\"props.value\">\n <!-- A map key reads `additionalProperty · string`: the keyword leads the\n detail list in the accent colour, like a type word, so the name\n above it can look like every other name. -->\n <SchemaPropertyDetail\n v-if=\"props.keyKind\"\n class=\"property-key-kind\">\n <span class=\"font-code text-c-accent\">{{\n props.keyKind === 'pattern' ? 'patternProperty' : 'additionalProperty'\n }}</span>\n </SchemaPropertyDetail>\n <!-- Type information -->\n <SchemaPropertyDetail\n v-if=\"shouldShowType\"\n truncate>\n <!-- The type is a token run (`array of Planet`) and a $ref link IS the\n type, not an appended `· Account` -->\n <!-- Written across lines on purpose: Vue drops whitespace-only text\n between two elements, so a single-line label would read\n `Type:string`. -->\n <span class=\"screenreader-only\"> {{ translate('schema.type') }}: </span>\n <button\n v-if=\"props.eventBus && modelLink?.schemaKey && modelLinkable\"\n class=\"text-c-2 hover:text-c-1 underline\"\n type=\"button\"\n @click=\"\n props.eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n <span\n v-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </button>\n <span\n v-else-if=\"signatureTokens.length\"\n class=\"property-type-signature text-c-2 text-(length:--scalar-mini)\">\n <template\n v-for=\"(token, index) in signatureTokens\"\n :key=\"index\">\n {{ index > 0 ? ' ' : ''\n }}<span\n class=\"property-type-token\"\n :class=\"[\n `property-type-token--${token.kind}`,\n token.kind === 'word' ? 'font-sans' : '',\n token.kind === 'ident' || token.kind === 'literal'\n ? 'font-code'\n : '',\n token.kind === 'punctuation' ? 'text-c-2' : '',\n ]\"\n >{{ token.text }}</span\n >\n </template>\n </span>\n </SchemaPropertyDetail>\n\n <!-- A cycle reads `array of Satellite · recursive`, a modifier like\n `nullable`; the full sentence rides the tooltip. -->\n <SchemaPropertyDetail\n v-if=\"recursiveTarget\"\n class=\"property-recursive\"\n :title=\"\n translate('schema.recursiveReference', { name: recursiveTarget })\n \">\n {{ translate('schema.recursive') }}\n </SchemaPropertyDetail>\n\n <ScalarTooltip\n v-if=\"presence\"\n :content=\"presenceDescription\">\n <span class=\"text-c-2 mr-2 text-xs\">\n <span aria-hidden=\"true\">optional</span>\n <span class=\"sr-only\"\n >Optional ({{ presence }} presence). {{ presenceDescription }}</span\n >\n </span>\n </ScalarTooltip>\n\n <!-- Key constraints from propertyNames (e.g. \"keys: string · uuid\") -->\n <SchemaPropertyDetail\n v-if=\"propertyNamesDetail\"\n truncate>\n <template #prefix>{{ translate('schema.keys') }}:</template>\n {{ propertyNamesDetail }}\n </SchemaPropertyDetail>\n\n <!-- Dynamic validation properties from composable -->\n <SchemaPropertyDetail\n v-for=\"property in validationProperties\"\n :key=\"property.key\"\n :code=\"property.code\"\n :truncate=\"property.truncate\">\n <span\n v-if=\"property.key === 'format'\"\n class=\"screenreader-only\">\n {{ translate('schema.format') }}:\n </span>\n <template\n v-if=\"property.prefix\"\n #prefix>\n {{ property.prefix }}\n </template>\n {{ property.value }}\n </SchemaPropertyDetail>\n\n <!-- Enum indicator -->\n <SchemaPropertyDetail v-if=\"props.enum\">\n {{ translate('schema.enum') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.additional\"\n class=\"property-additional\">\n <template v-if=\"props.value?.['x-additionalPropertiesName']\">\n {{ props.value['x-additionalPropertiesName'] }}\n </template>\n <template v-else>{{ translate('schema.additionalProperties') }}</template>\n </div>\n <div\n v-if=\"props.value?.deprecated\"\n class=\"property-deprecated\">\n <Badge>{{ translate('schema.deprecated') }}</Badge>\n </div>\n <Badge\n v-for=\"(badge, index) in positionedBadges?.after\"\n :key=\"index\"\n :class=\"badgeClass\"\n :color=\"badge.color\">\n {{ badge.name }}\n </Badge>\n <span\n v-if=\"discriminatorValue !== undefined\"\n class=\"text-c-2\">\n {{ translate('schema.discriminatorValue') }}:\n <RenderString :value=\"discriminatorValue\" />\n </span>\n <!-- Don't use `isDefined` here, we want to show `const` when the value is `null` -->\n <div\n v-if=\"constValue !== undefined\"\n class=\"property-const\">\n <SchemaPropertyDetail truncate>\n <template #prefix>{{ translate('schema.const') }}: </template>\n <RenderString :value=\"constValue\" />\n </SchemaPropertyDetail>\n </div>\n <template v-else>\n <!-- Shows only when a composition is used (so props.value?.type is undefined) -->\n <SchemaPropertyDetail v-if=\"(props.value as any)?.nullable === true\">\n {{ translate('schema.nullable') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.value?.writeOnly\"\n class=\"property-write-only\">\n {{ translate('schema.writeOnly') }}\n </div>\n <div\n v-else-if=\"props.value?.readOnly\"\n class=\"property-read-only\">\n {{ translate('schema.readOnly') }}\n </div>\n <div\n v-if=\"props.required\"\n class=\"property-required\">\n {{ translate('schema.required') }}\n </div>\n <!-- Gated here, not only inside the component: each popup instance installs\n window-level click and keydown listeners for its dismissal, so mounting\n one per row costs the page a listener per row it never shows anything\n for. Same reason `SchemaPropertyPattern` below is gated. -->\n <SchemaPropertyDefault\n v-if=\"props.value?.default !== undefined\"\n :value=\"props.value?.default\" />\n <!--\n Pattern is a hover dropdown chip like Examples, not an inline constraint,\n so it sits beside the example. This keeps the real constraints (length,\n nullable, …) together in the dotted list. See #9966.\n -->\n <SchemaPropertyPattern\n v-if=\"patternValue\"\n :pattern=\"patternValue\" />\n <SchemaPropertyExamples\n v-if=\"props.withExamples && hasExampleContent\"\n :example=\"exampleValue\"\n :examples=\"props.value?.examples\" />\n <!-- The collapsed preview rides the end of the heading line -->\n <slot name=\"preview\" />\n <!-- Last so the tab order matches the visual order: the trailing copy-link\n is painted at the row's right edge, after every control to its left -->\n <slot name=\"trailing\" />\n </div>\n</template>\n<style scoped>\n.property-heading {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n row-gap: 9px;\n white-space: nowrap;\n}\n\n.property-heading:has(+ .children),\n.property-heading:has(+ .property-rule) {\n margin-bottom: 9px;\n}\n\n.property-heading > * {\n margin-right: 9px;\n}\n\n.property-heading:last-child {\n margin-right: 0;\n}\n\n.property-name {\n max-width: 100%;\n font-family: var(--scalar-font-code);\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n white-space: normal;\n overflow-wrap: break-word;\n}\n\n.property-additional {\n font-family: var(--scalar-font-code);\n}\n\n.property-required,\n.property-optional {\n color: var(--scalar-color-2);\n}\n\n.property-required {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-orange);\n}\n/*\n * Light-mode oranges are too bright on a light page for 13px text (the default\n * #ff5800 is 3.16:1), so blend the theme orange toward the text colour to reach\n * WCAG 1.4.3 (4.5:1) while keeping the hue and letting custom themes flow\n * through. Dark mode already passes (8.37:1) and keeps the plain token.\n */\n.light-mode .property-required {\n color: color-mix(\n in srgb,\n var(--scalar-color-orange),\n var(--scalar-color-1) 32%\n );\n}\n\n.property-read-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-blue);\n}\n\n.property-write-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-green);\n}\n\n.property-discriminator {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-purple);\n}\n\n.property-detail {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n display: flex;\n align-items: center;\n\n min-width: 0;\n}\n\n.property-const {\n color: var(--scalar-color-1);\n}\n\n.deprecated {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A,GAyGM6C,IAAa,2C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAnEnB,IAAME,IAAQC,GA4CR,EAAE,iBAAcC,GAAgB,GAGhCC,IAAcC,QACXJ,EAAM,QAAuCK,GACtD,GAEMC,IAAkBF,QAEpBJ,EAAM,eACLA,EAAM,QAAwCO,GACnD,GAEMC,IAAWJ,QACRJ,EAAM,QAAuCS,GACtD,GACMC,IAAsBN,QAC1BI,EAAS,UAAU,aACf,gGACA,oGACN,GAEMG,IAAWC,GAAMZ,GAAO,OAAO,GAG/Ba,IAAmBT,QAEjB;GACN,IAAMU,IAAUd,EAAM;GACtB,IAAKc,GAIL,OAAO;IACL,QAAQA,EAAQ,QAAQ,MAAUC,EAAM,aAAa,QAAQ;IAC7D,OAAOD,EAAQ,QAAQ,MAAUC,EAAM,aAAa,QAAQ;GAC9D;EACF,CAAC,GAEKC,IAAaZ,QAAe;GAChC,IAAI,CAACO,EAAS,OACZ;GAGF,IAAMM,IAASN,EAAS;GAGxB,IAAIM,EAAO,UAAU,KAAA,GACnB,OAAOA,EAAO;GAIhB,IAAIA,EAAO,MAAM,WAAW,GAC1B,OAAOA,EAAO,KAAK;GAIrB,IAAIC,EAAcD,CAAM,KAAKA,EAAO,OAAO;IACzC,IAAME,IAAQC,EAAQ,OAAOH,EAAO,KAAK;IAEzC,IAAII,EAAUF,EAAM,KAAK,GACvB,OAAOA,EAAM;IAGf,IAAIA,EAAM,MAAM,WAAW,GACzB,OAAOA,EAAM,KAAK;GAEtB;EAGF,CAAC,GAgBKG,KAAsB,MAAyB;GACnD,IAAMC,IAAmC,C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ReferenceType, SchemaObject, SchemaReferenceType } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document';
|
|
2
2
|
/**
|
|
3
3
|
* Resolving JSON Schema 2020-12 `$dynamicRef` while rendering a schema.
|
|
4
4
|
*
|
|
@@ -20,4 +20,6 @@ import type { SchemaObject, SchemaReferenceType } from '@scalar/workspace-store/
|
|
|
20
20
|
* unchanged, so rendering falls back to its prior behavior with no regression.
|
|
21
21
|
*/
|
|
22
22
|
export declare const resolveDynamicSchema: <T extends SchemaReferenceType<SchemaObject> | undefined>(schema: T) => T;
|
|
23
|
+
/** Read a media or parameter schema while preserving the scopes of its referenced properties. */
|
|
24
|
+
export declare const resolveDisplaySchema: (source: ReferenceType<SchemaObject> | null | undefined) => SchemaObject | undefined;
|
|
23
25
|
//# sourceMappingURL=dynamic-scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-scope.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/dynamic-scope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dynamic-scope.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/dynamic-scope.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,mBAAmB,EACpB,MAAM,8DAA8D,CAAA;AAErE;;;;;;;;;;;;GAYG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,mBAAmB,CAAC,YAAY,CAAC,GAAG,SAAS,EAAE,QAAQ,CAAC,KAAG,CAgBzG,CAAA;AAED,iGAAiG;AACjG,eAAO,MAAM,oBAAoB,GAC/B,QAAQ,aAAa,CAAC,YAAY,CAAC,GAAG,IAAI,GAAG,SAAS,KACrD,YAAY,GAAG,SAOjB,CAAA"}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getResolvedRef as e } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
|
+
import { DYNAMIC_REF_VALUE as t, resolve as n } from "@scalar/workspace-store/resolve";
|
|
3
|
+
import { isDynamicRef as r, normalizeDynamicRefTarget as i } from "@scalar/workspace-store/helpers/dynamic-ref";
|
|
3
4
|
// src/schema/helpers/dynamic-scope.ts
|
|
4
|
-
var
|
|
5
|
-
|
|
5
|
+
var a = (e) => {
|
|
6
|
+
if (!r(e)) return e;
|
|
7
|
+
let n = /* @__PURE__ */ new Set(), a = e;
|
|
8
|
+
for (; r(a) && !n.has(a);) {
|
|
9
|
+
n.add(a);
|
|
10
|
+
let e = i(Reflect.get(a, t));
|
|
11
|
+
if (!e) break;
|
|
12
|
+
a = e;
|
|
13
|
+
}
|
|
14
|
+
return a;
|
|
15
|
+
}, o = (t) => {
|
|
16
|
+
if (!t) return;
|
|
17
|
+
let r = e(t);
|
|
18
|
+
return a(r && typeof r == "object" && "$ref" in r ? n.schema(t) : r);
|
|
19
|
+
};
|
|
20
|
+
export { o as resolveDisplaySchema, a as resolveDynamicSchema };
|
|
6
21
|
|
|
7
22
|
//# sourceMappingURL=dynamic-scope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-scope.js","names":["resolveDynamicSchema","isDynamicRef","schema","DYNAMIC_REF_VALUE"],"sources":["../../../src/schema/helpers/dynamic-scope.ts"],"sourcesContent":["import { isDynamicRef } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport { DYNAMIC_REF_VALUE } from '@scalar/workspace-store/resolve'\nimport type {
|
|
1
|
+
{"version":3,"file":"dynamic-scope.js","names":["resolveDynamicSchema","isDynamicRef","schema","seen","current","target","normalizeDynamicRefTarget","DYNAMIC_REF_VALUE","resolveDisplaySchema","source","getResolvedRef","resolve"],"sources":["../../../src/schema/helpers/dynamic-scope.ts"],"sourcesContent":["import { isDynamicRef, normalizeDynamicRefTarget } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { DYNAMIC_REF_VALUE, resolve } from '@scalar/workspace-store/resolve'\nimport type {\n ReferenceType,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\n/**\n * Resolving JSON Schema 2020-12 `$dynamicRef` while rendering a schema.\n *\n * Unlike `$ref`, a `$dynamicRef` does not resolve to a fixed location: it binds to the active\n * `$dynamicAnchor` in the chain of schema resources entered to reach it, so the same\n * `{ \"$dynamicRef\": \"#itemType\" }` inside a shared generic template resolves to a different concrete\n * type depending on the path taken (e.g. `User` via a user page, `Group` via a group page).\n *\n * Resolution is owned by the workspace-store magic proxy, not by these components: the proxy threads the\n * dynamic scope as the document is walked and exposes the bound schema through the virtual\n * `$dynamicRef-value` property (mirroring `$ref-value`). Rendering simply reads that property, so the\n * scope never has to be assembled here. See https://github.com/scalar/scalar/issues/9414.\n */\n\n/**\n * Resolve a schema that may be a `$dynamicRef` to its bound concrete type.\n *\n * Returns the schema the proxy binds through `$dynamicRef-value`. When the reference cannot be resolved\n * — the schema is not a `$dynamicRef`, or has been detached from the proxy — the input is returned\n * unchanged, so rendering falls back to its prior behavior with no regression.\n */\nexport const resolveDynamicSchema = <T extends SchemaReferenceType<SchemaObject> | undefined>(schema: T): T => {\n if (!isDynamicRef(schema)) {\n return schema\n }\n\n const seen = new Set<object>()\n let current: unknown = schema\n while (isDynamicRef(current) && !seen.has(current)) {\n seen.add(current)\n const target = normalizeDynamicRefTarget(Reflect.get(current, DYNAMIC_REF_VALUE))\n if (!target) {\n break\n }\n current = target\n }\n return current as T\n}\n\n/** Read a media or parameter schema while preserving the scopes of its referenced properties. */\nexport const resolveDisplaySchema = (\n source: ReferenceType<SchemaObject> | null | undefined,\n): SchemaObject | undefined => {\n if (!source) {\n return undefined\n }\n const target = getResolvedRef<SchemaObject>(source)\n const schema = target && typeof target === 'object' && '$ref' in target ? resolve.schema(source) : target\n return resolveDynamicSchema(schema)\n}\n"],"mappings":";;;;AA8BA,IAAaA,KAAiF,MAAiB;CAC7G,IAAI,CAACC,EAAaC,CAAM,GACtB,OAAOA;CAGT,IAAMC,oBAAO,IAAI,IAAY,GACzBC,IAAmBF;CACvB,OAAOD,EAAaG,CAAO,KAAK,CAACD,EAAK,IAAIC,CAAO,IAAG;EAClD,EAAK,IAAIA,CAAO;EAChB,IAAMC,IAASC,EAA0B,QAAQ,IAAIF,GAASG,CAAiB,CAAC;EAChF,IAAI,CAACF,GACH;EAEF,IAAUA;CACZ;CACA,OAAOD;AACT,GAGaI,KACX,MAC6B;CAC7B,IAAI,CAACC,GACH;CAEF,IAAMJ,IAASK,EAA6BD,CAAM;CAElD,OAAOT,EADQK,KAAU,OAAOA,KAAW,YAAY,UAAUA,IAASM,EAAQ,OAAOF,CAAM,IAAIJ,CACjE;AACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIjH,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAI5E,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;AAK/D;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,GAC/C,OAAO,YAAY,EACnB,eAAe,oBAAoB;AACnC,4FAA4F;AAC5F,cAAc,SAAS,MAAM,EAAE,KAC9B,YAAY,GAAG,IAiDjB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,YAAY,GAAG,SAAS,EAC/B,WAAW,oBAAoB;AAC/B;;;;;GAKG;AACH,mCAAkC,YAAY,GAAG,IAEzC,KACP,mBAAmB,
|
|
1
|
+
{"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIjH,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAI5E,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;AAK/D;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,GAC/C,OAAO,YAAY,EACnB,eAAe,oBAAoB;AACnC,4FAA4F;AAC5F,cAAc,SAAS,MAAM,EAAE,KAC9B,YAAY,GAAG,IAiDjB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,YAAY,GAAG,SAAS,EAC/B,WAAW,oBAAoB;AAC/B;;;;;GAKG;AACH,mCAAkC,YAAY,GAAG,IAEzC,KACP,mBAAmB,EAiCrB,CAAA"}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { getRefName as e } from "./get-ref-name.js";
|
|
2
2
|
import { compositions as t } from "./schema-composition.js";
|
|
3
|
-
import {
|
|
4
|
-
import { unwrapForRead as
|
|
5
|
-
import { resolve as
|
|
6
|
-
import { isArraySchema as
|
|
7
|
-
import { isDefined as
|
|
8
|
-
import { unescapeJsonPointerSegment as
|
|
3
|
+
import { hasArrayItemComposition as n, shouldRenderArrayItemComposition as r } from "./should-render-array-item-composition.js";
|
|
4
|
+
import { unwrapForRead as i } from "./unwrap-for-read.js";
|
|
5
|
+
import { resolve as a } from "@scalar/workspace-store/resolve";
|
|
6
|
+
import { isArraySchema as o } from "@scalar/workspace-store/schemas/v3.2/strict/type-guards";
|
|
7
|
+
import { isDefined as s } from "@scalar/helpers/array/is-defined";
|
|
8
|
+
import { unescapeJsonPointerSegment as c } from "@scalar/helpers/json/unescape-json-pointer-segment";
|
|
9
9
|
// src/schema/helpers/get-compositions-to-render.ts
|
|
10
|
-
var
|
|
10
|
+
var l = (e) => e.startsWith("#/") || e.includes("/") ? e : `#/components/schemas/${e}`, u = (t, n, r) => {
|
|
11
11
|
if (t.oneOf || t.anyOf) return null;
|
|
12
|
-
let
|
|
13
|
-
if (!
|
|
14
|
-
let u =
|
|
12
|
+
let o = t.discriminator?.mapping;
|
|
13
|
+
if (!o) return null;
|
|
14
|
+
let u = i(n);
|
|
15
15
|
if (!u?.components?.schemas) return null;
|
|
16
|
-
let d = (
|
|
17
|
-
let n =
|
|
18
|
-
if (
|
|
16
|
+
let d = (r ?? Object.values(o)).filter((e) => typeof e == "string").map((t) => {
|
|
17
|
+
let n = l(t), r = e(n), i = r ? a.schema(u.components?.schemas?.[c(r)]) : void 0;
|
|
18
|
+
if (i) return {
|
|
19
19
|
$ref: n,
|
|
20
|
-
"$ref-value":
|
|
20
|
+
"$ref-value": i
|
|
21
21
|
};
|
|
22
|
-
}).filter(
|
|
22
|
+
}).filter(s);
|
|
23
23
|
return d.length === 0 ? null : {
|
|
24
|
-
...
|
|
24
|
+
...a.schema(t),
|
|
25
25
|
oneOf: d
|
|
26
26
|
};
|
|
27
|
-
},
|
|
27
|
+
}, d = (e, i, c = e ? u(e, i) : null) => e ? t.map((t) => t === "oneOf" && c ? {
|
|
28
28
|
composition: t,
|
|
29
|
-
value:
|
|
30
|
-
} :
|
|
29
|
+
value: c
|
|
30
|
+
} : r(e, t) && o(e) && e.items ? {
|
|
31
31
|
composition: t,
|
|
32
|
-
value:
|
|
33
|
-
} : e[t] && !(
|
|
32
|
+
value: a.schema(e.items)
|
|
33
|
+
} : e[t] && !n(e, t) ? {
|
|
34
34
|
composition: t,
|
|
35
|
-
value:
|
|
36
|
-
} : null).filter(
|
|
37
|
-
export {
|
|
35
|
+
value: a.schema(e)
|
|
36
|
+
} : null).filter(s) : [];
|
|
37
|
+
export { d as getCompositionsToRender, u as inferDiscriminatorMappingComposition };
|
|
38
38
|
|
|
39
39
|
//# sourceMappingURL=get-compositions-to-render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-compositions-to-render.js","names":["normalizeDiscriminatorMappingRef","value","inferDiscriminatorMappingComposition","mapping","document","unwrapForRead","documentProp","refs","variantRefs","mappingValue","ref","refName","getRefName","refValue","resolve","unescapeJsonPointerSegment","isDefined","getCompositionsToRender","compositions","composition","inferredDiscriminatorComposition","shouldRenderArrayItemComposition","isArraySchema"],"sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { unescapeJsonPointerSegment } from '@scalar/helpers/json/unescape-json-pointer-segment'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { OpenApiDocument, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\nimport { getRefName } from './get-ref-name'\nimport { type CompositionKeyword, compositions } from './schema-composition'\nimport { shouldRenderArrayItemComposition } from './should-render-array-item-composition'\nimport { unwrapForRead } from './unwrap-for-read'\n\ntype CompositionToRender = {\n composition: CompositionKeyword\n value: SchemaObject\n}\n\ntype DocumentSchemaLookup = Pick<OpenApiDocument, 'components'>\n\nconst normalizeDiscriminatorMappingRef = (value: string) =>\n value.startsWith('#/') || value.includes('/') ? value : `#/components/schemas/${value}`\n\n/**\n * Builds a synthetic `oneOf` composition from a `discriminator.mapping` when the\n * schema declares a mapping but no explicit `oneOf`/`anyOf`. This is the shape\n * NSwag emits for polymorphic types, where the base type is a plain object with\n * a discriminator mapping pointing at the concrete variants.\n *\n * Returns `null` when there is nothing to infer (an explicit composition is\n * already present, no document to resolve refs against, or no resolvable refs).\n */\nexport const inferDiscriminatorMappingComposition = (\n value: SchemaObject,\n documentProp?: DocumentSchemaLookup,\n /** Inheritance can supply ordered variants, including schemas that share a mapped value. */\n variantRefs?: readonly string[],\n): SchemaObject | null => {\n if (value.oneOf || value.anyOf) {\n return null\n }\n\n // A schema without a mapping can never infer anything, so it is checked before the document is\n // touched at all: the document read below is by far the more expensive of the two.\n const mapping = value.discriminator?.mapping\n\n if (!mapping) {\n return null\n }\n\n // Reading `components.schemas` per row through the reactive and detect-changes layers is the\n // dominant cost of this helper, so the document is unwrapped once here. See `unwrapForRead`.\n const document = unwrapForRead(documentProp)\n\n if (!document?.components?.schemas) {\n return null\n }\n\n const refs = (variantRefs ?? Object.values(mapping))\n .filter((mappingValue): mappingValue is string => typeof mappingValue === 'string')\n .map((mappingValue) => {\n const ref = normalizeDiscriminatorMappingRef(mappingValue)\n const refName = getRefName(ref)\n const refValue = refName\n ? resolve.schema(document.components?.schemas?.[unescapeJsonPointerSegment(refName)])\n : undefined\n\n if (!refValue) {\n return undefined\n }\n\n return {\n $ref: ref,\n '$ref-value': refValue,\n }\n })\n .filter(isDefined)\n\n if (refs.length === 0) {\n return null\n }\n\n return {\n ...resolve.schema(value),\n oneOf: refs,\n }\n}\n\n/**\n * Computes which compositions should be rendered and with which values\n *\n * @param value - The schema object to check for compositions\n * @returns Array of compositions to render with their values\n */\nexport const getCompositionsToRender = (\n value: SchemaObject | undefined,\n document?: DocumentSchemaLookup,\n /**\n * The `oneOf` inferred from a bare `discriminator.mapping`, when the caller has\n * already computed it. `SchemaProperty` needs the same value to decide whether\n * to suppress the duplicate base object block, so it passes it here to avoid\n * inferring twice. Omit it and it is inferred from `value`.\n */\n inferredDiscriminatorComposition: SchemaObject | null = value\n ? inferDiscriminatorMappingComposition(value, document)\n : null,\n): CompositionToRender[] => {\n if (!value) {\n return []\n }\n\n return compositions\n .map((composition) => {\n if (composition === 'oneOf' && inferredDiscriminatorComposition) {\n return {\n composition,\n value: inferredDiscriminatorComposition,\n }\n }\n\n // Check for array item-level composition first (more specific case)\n if (shouldRenderArrayItemComposition(value, composition) && isArraySchema(value) && value.items) {\n return {\n composition,\n value: resolve.schema(value.items),\n }\n }\n\n // Check for property-level composition\n if (value[composition]
|
|
1
|
+
{"version":3,"file":"get-compositions-to-render.js","names":["normalizeDiscriminatorMappingRef","value","inferDiscriminatorMappingComposition","mapping","document","unwrapForRead","documentProp","refs","variantRefs","mappingValue","ref","refName","getRefName","refValue","resolve","unescapeJsonPointerSegment","isDefined","getCompositionsToRender","compositions","composition","inferredDiscriminatorComposition","shouldRenderArrayItemComposition","isArraySchema","hasArrayItemComposition"],"sources":["../../../src/schema/helpers/get-compositions-to-render.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { unescapeJsonPointerSegment } from '@scalar/helpers/json/unescape-json-pointer-segment'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { OpenApiDocument, SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.2/strict/type-guards'\n\nimport { getRefName } from './get-ref-name'\nimport { type CompositionKeyword, compositions } from './schema-composition'\nimport { hasArrayItemComposition, shouldRenderArrayItemComposition } from './should-render-array-item-composition'\nimport { unwrapForRead } from './unwrap-for-read'\n\ntype CompositionToRender = {\n composition: CompositionKeyword\n value: SchemaObject\n}\n\ntype DocumentSchemaLookup = Pick<OpenApiDocument, 'components'>\n\nconst normalizeDiscriminatorMappingRef = (value: string) =>\n value.startsWith('#/') || value.includes('/') ? value : `#/components/schemas/${value}`\n\n/**\n * Builds a synthetic `oneOf` composition from a `discriminator.mapping` when the\n * schema declares a mapping but no explicit `oneOf`/`anyOf`. This is the shape\n * NSwag emits for polymorphic types, where the base type is a plain object with\n * a discriminator mapping pointing at the concrete variants.\n *\n * Returns `null` when there is nothing to infer (an explicit composition is\n * already present, no document to resolve refs against, or no resolvable refs).\n */\nexport const inferDiscriminatorMappingComposition = (\n value: SchemaObject,\n documentProp?: DocumentSchemaLookup,\n /** Inheritance can supply ordered variants, including schemas that share a mapped value. */\n variantRefs?: readonly string[],\n): SchemaObject | null => {\n if (value.oneOf || value.anyOf) {\n return null\n }\n\n // A schema without a mapping can never infer anything, so it is checked before the document is\n // touched at all: the document read below is by far the more expensive of the two.\n const mapping = value.discriminator?.mapping\n\n if (!mapping) {\n return null\n }\n\n // Reading `components.schemas` per row through the reactive and detect-changes layers is the\n // dominant cost of this helper, so the document is unwrapped once here. See `unwrapForRead`.\n const document = unwrapForRead(documentProp)\n\n if (!document?.components?.schemas) {\n return null\n }\n\n const refs = (variantRefs ?? Object.values(mapping))\n .filter((mappingValue): mappingValue is string => typeof mappingValue === 'string')\n .map((mappingValue) => {\n const ref = normalizeDiscriminatorMappingRef(mappingValue)\n const refName = getRefName(ref)\n const refValue = refName\n ? resolve.schema(document.components?.schemas?.[unescapeJsonPointerSegment(refName)])\n : undefined\n\n if (!refValue) {\n return undefined\n }\n\n return {\n $ref: ref,\n '$ref-value': refValue,\n }\n })\n .filter(isDefined)\n\n if (refs.length === 0) {\n return null\n }\n\n return {\n ...resolve.schema(value),\n oneOf: refs,\n }\n}\n\n/**\n * Computes which compositions should be rendered and with which values\n *\n * @param value - The schema object to check for compositions\n * @returns Array of compositions to render with their values\n */\nexport const getCompositionsToRender = (\n value: SchemaObject | undefined,\n document?: DocumentSchemaLookup,\n /**\n * The `oneOf` inferred from a bare `discriminator.mapping`, when the caller has\n * already computed it. `SchemaProperty` needs the same value to decide whether\n * to suppress the duplicate base object block, so it passes it here to avoid\n * inferring twice. Omit it and it is inferred from `value`.\n */\n inferredDiscriminatorComposition: SchemaObject | null = value\n ? inferDiscriminatorMappingComposition(value, document)\n : null,\n): CompositionToRender[] => {\n if (!value) {\n return []\n }\n\n return compositions\n .map((composition) => {\n if (composition === 'oneOf' && inferredDiscriminatorComposition) {\n return {\n composition,\n value: inferredDiscriminatorComposition,\n }\n }\n\n // Check for array item-level composition first (more specific case)\n if (shouldRenderArrayItemComposition(value, composition) && isArraySchema(value) && value.items) {\n return {\n composition,\n value: resolve.schema(value.items),\n }\n }\n\n // Check for property-level composition\n if (value[composition] && !hasArrayItemComposition(value, composition)) {\n return {\n composition,\n value: resolve.schema(value),\n }\n }\n\n return null\n })\n .filter(isDefined)\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAMA,KAAoC,MACxCC,EAAM,WAAW,IAAI,KAAKA,EAAM,SAAS,GAAG,IAAIA,IAAQ,wBAAwBA,KAWrEC,KACX,GACA,GAEA,MACwB;CACxB,IAAID,EAAM,SAASA,EAAM,OACvB,OAAO;CAKT,IAAME,IAAUF,EAAM,eAAe;CAErC,IAAI,CAACE,GACH,OAAO;CAKT,IAAMC,IAAWC,EAAcC,CAAY;CAE3C,IAAI,CAACF,GAAU,YAAY,SACzB,OAAO;CAGT,IAAMG,KAAQC,KAAe,OAAO,OAAOL,CAAO,EAAA,CAC/C,QAAQ,MAAyC,OAAOM,KAAiB,QAAQ,CAAC,CAClF,KAAK,MAAiB;EACrB,IAAMC,IAAMV,EAAiCS,CAAY,GACnDE,IAAUC,EAAWF,CAAG,GACxBG,IAAWF,IACbG,EAAQ,OAAOV,EAAS,YAAY,UAAUW,EAA2BJ,CAAO,EAAE,IAClF,KAAA;EAEJ,IAAKE,GAIL,OAAO;GACL,MAAMH;GACN,cAAcG;EAChB;CACF,CAAC,CAAC,CACD,OAAOG,CAAS;CAMnB,OAJIT,EAAK,WAAW,IACX,OAGF;EACL,GAAGO,EAAQ,OAAOb,CAAK;EACvB,OAAOM;CACT;AACF,GAQaU,KACX,GACA,GAOA,IAAwDhB,IACpDC,EAAqCD,GAAOG,CAAQ,IACpD,SAECH,IAIEiB,EACJ,KAAK,MACAC,MAAgB,WAAWC,IACtB;CACL;CACA,OAAOA;AACT,IAIEC,EAAiCpB,GAAOkB,CAAW,KAAKG,EAAcrB,CAAK,KAAKA,EAAM,QACjF;CACL;CACA,OAAOa,EAAQ,OAAOb,EAAM,KAAK;AACnC,IAIEA,EAAMkB,MAAgB,CAACI,EAAwBtB,GAAOkB,CAAW,IAC5D;CACL;CACA,OAAOL,EAAQ,OAAOb,CAAK;AAC7B,IAGK,IACR,CAAC,CACD,OAAOe,CAAS,IA9BV,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { resolveDisplaySchema } from './dynamic-scope';
|
|
1
2
|
export { inferDiscriminatorMappingComposition } from './get-compositions-to-render';
|
|
2
3
|
export { getRefName } from './get-ref-name';
|
|
3
4
|
export { type RenderedExample, getRenderedExample, normalizeRenderedExamples } from './get-rendered-example';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,KAAK,eAAe,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAC5G,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,oCAAoC,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,KAAK,eAAe,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAC5G,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
1
|
+
import { resolveDisplaySchema as e } from "./dynamic-scope.js";
|
|
2
|
+
import { inferDiscriminatorMappingComposition as t } from "./get-compositions-to-render.js";
|
|
3
|
+
import { getRefName as n } from "./get-ref-name.js";
|
|
4
|
+
import { getRenderedExample as r, normalizeRenderedExamples as i } from "./get-rendered-example.js";
|
|
5
|
+
import { getSchemaType as a } from "./get-schema-type.js";
|
|
6
|
+
import { getTypeSignatureTokens as o } from "./get-type-signature-tokens.js";
|
|
7
|
+
import { hasComplexArrayItems as s } from "./has-complex-array-items.js";
|
|
8
|
+
import { isModelLinkable as c } from "./is-model-linkable.js";
|
|
9
|
+
import { isTypeObject as l } from "./is-type-object.js";
|
|
10
|
+
import { optimizeValueForDisplay as u } from "./optimize-value-for-display.js";
|
|
11
|
+
import { handleTreeKeydown as d } from "./schema-keyboard-nav.js";
|
|
12
|
+
import { getModelNameFromSchema as f, getModelNameWithArray as p } from "./schema-name.js";
|
|
13
|
+
import { reduceNamesToObject as m, sortPropertyNames as h } from "./sort-property-names.js";
|
|
14
|
+
export { f as getModelNameFromSchema, p as getModelNameWithArray, n as getRefName, r as getRenderedExample, a as getSchemaType, o as getTypeSignatureTokens, d as handleTreeKeydown, s as hasComplexArrayItems, t as inferDiscriminatorMappingComposition, c as isModelLinkable, l as isTypeObject, i as normalizeRenderedExamples, u as optimizeValueForDisplay, m as reduceNamesToObject, e as resolveDisplaySchema, h as sortPropertyNames };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimize-value-for-display.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/optimize-value-for-display.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAKhG,6FAA6F;AAC7F,KAAK,aAAa,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAwD1D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"optimize-value-for-display.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/optimize-value-for-display.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAKhG,6FAA6F;AAC7F,KAAK,aAAa,GAAG,YAAY,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAwD1D;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CA6HnG"}
|
|
@@ -32,19 +32,19 @@ function i(i) {
|
|
|
32
32
|
return p && (e.nullable = !0), e;
|
|
33
33
|
}
|
|
34
34
|
if ((a === "oneOf" || a === "anyOf") && (u || d.some((e) => e.allOf))) {
|
|
35
|
-
let { discriminator: e,
|
|
36
|
-
let
|
|
37
|
-
if (
|
|
38
|
-
let { allOf: e, ...
|
|
39
|
-
if ("properties" in
|
|
40
|
-
let { $ref: e, title:
|
|
41
|
-
return r(
|
|
35
|
+
let { discriminator: e, "x-badges": t, ...o } = l, s = d.map((e) => {
|
|
36
|
+
let t = n.schema(e);
|
|
37
|
+
if (t.allOf?.length === 1) {
|
|
38
|
+
let { allOf: e, ...i } = t, a = n.schema(e[0]);
|
|
39
|
+
if ("properties" in i || "required" in i || "$ref" in i) {
|
|
40
|
+
let { $ref: e, title: t, name: n, ...s } = a;
|
|
41
|
+
return r(o, i, s);
|
|
42
42
|
}
|
|
43
|
-
return r(
|
|
43
|
+
return r(o, i, a);
|
|
44
44
|
}
|
|
45
|
-
return r(
|
|
46
|
-
}),
|
|
47
|
-
return typeof i.description == "string" && (
|
|
45
|
+
return r(o, t);
|
|
46
|
+
}), c = { [a]: s };
|
|
47
|
+
return t !== void 0 && (c["x-badges"] = t), typeof i.description == "string" && (c.description = i.description), p && (c.nullable = !0), c;
|
|
48
48
|
}
|
|
49
49
|
if (d.length !== o.length) {
|
|
50
50
|
let e = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimize-value-for-display.js","names":["mergeSchemaProperties","objects","merged","properties","required","hasProperties","hasRequired","object","key","val","name","optimizeValueForDisplay","value","schemaDiscriminator","composition","compositions","keyword","schemas","_","originalNullable","rootProperties","hasRootProperties","schema","resolve","_schema","acc","shouldBeNullable","hasNullSchema","filteredSchemas","mergedSchema","_discriminator","variantRootProperties","mergedSchemas","otherProps","allOfMember","allOf","_ref","_title","_name","allOfMemberWithoutIdentity","result"],"sources":["../../../src/schema/helpers/optimize-value-for-display.ts"],"sourcesContent":["import { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { type DiscriminatorSchema, schemaDiscriminator } from '../discriminator-metadata'\nimport { compositions } from './schema-composition'\n\n/** Display normalization tracks null branches without changing the stored OpenAPI schema. */\ntype DisplaySchema = SchemaObject & { nullable?: boolean }\n\n/**\n * Shallow-merges schema-like objects, but unions `properties` and `required`\n * instead of letting a later object's `properties`/`required` completely\n * overwrite an earlier one's. Without this, a variant schema (e.g. a `oneOf`\n * branch) that declares its own `properties`/`required` would wipe out the\n * shared base fields factored out at the root (or via a sibling `allOf`)\n * instead of being combined with them (#9657).\n */\nfunction mergeSchemaProperties(...objects: (Record<string, unknown> | undefined)[]): Record<string, unknown> {\n const merged: Record<PropertyKey, unknown> = {}\n const properties: Record<string, unknown> = {}\n const required = new Set<string>()\n let hasProperties = false\n let hasRequired = false\n\n for (const object of objects) {\n if (!object) {\n continue\n }\n\n // Renderer-only symbols must survive flattening nullable and single-branch compositions.\n for (const key of Object.getOwnPropertySymbols(object)) {\n merged[key] = (object as Record<PropertyKey, unknown>)[key]\n }\n\n for (const [key, val] of Object.entries(object)) {\n if (key === 'properties' && val && typeof val === 'object') {\n Object.assign(properties, val)\n hasProperties = true\n continue\n }\n\n if (key === 'required' && Array.isArray(val)) {\n for (const name of val) {\n required.add(name)\n }\n hasRequired = true\n continue\n }\n\n merged[key] = val\n }\n }\n\n if (hasProperties) {\n merged.properties = properties\n }\n if (hasRequired) {\n merged.required = [...required]\n }\n\n return merged\n}\n\n/**\n * Normalize compositions for display without changing the source schema. Null branches\n * become nullable state, single branches are flattened, and shared properties and\n * required fields are merged into variants so the renderer keeps their full context.\n */\nexport function optimizeValueForDisplay(value: DisplaySchema | undefined): DisplaySchema | undefined {\n if (!value || typeof value !== 'object') {\n return value\n }\n\n // Inferred AsyncAPI variants already carry complete concrete schemas. Flattening\n // them would lose reference identities and merge the base identity into descendants.\n if ((value as DiscriminatorSchema)[schemaDiscriminator]?.inheritedVariants) {\n return value\n }\n\n // Find the composition keyword early to avoid unnecessary work\n const composition = compositions.find((keyword) => keyword in value && keyword !== 'not')\n\n // If there's no relevant composition keyword, return a shallow copy\n if (!composition) {\n return { ...value }\n }\n\n const schemas = value[composition]\n if (!Array.isArray(schemas)) {\n return { ...value }\n }\n\n // Extract root properties efficiently (excluding composition and nullable)\n const { [composition]: _, nullable: originalNullable, ...rootProperties } = value\n const hasRootProperties = Object.keys(rootProperties).length > 0\n\n // Check for null schemas and filter them out in one pass\n const { filteredSchemas, hasNullSchema } = schemas.reduce<{\n filteredSchemas: SchemaObject[]\n hasNullSchema: boolean\n }>(\n (acc, _schema) => {\n const schema = resolve.schema(_schema)\n\n if ('type' in schema && schema.type === 'null') {\n acc.hasNullSchema = true\n } else {\n acc.filteredSchemas.push(schema)\n }\n return acc\n },\n { filteredSchemas: [], hasNullSchema: false },\n )\n\n // Determine if nullable should be set\n const shouldBeNullable = hasNullSchema || originalNullable === true\n\n // If only one schema remains after filtering, merge with root properties.\n // `properties`/`required` are unioned so sibling properties declared next to\n // the composition (e.g. `properties` alongside a single-`$ref` `allOf`) are\n // kept instead of being overwritten by the member schema's own `properties`.\n // Root-level annotations (title, description, …) win over the member's: they\n // describe the combined schema, not the base it extends.\n if (filteredSchemas.length === 1) {\n const mergedSchema = mergeSchemaProperties(filteredSchemas[0], rootProperties) as DisplaySchema\n if (shouldBeNullable) {\n mergedSchema.nullable = true\n }\n return mergedSchema\n }\n\n // Check if root properties should be merged into schemas\n const shouldMergeRootProperties =\n (composition === 'oneOf' || composition === 'anyOf') &&\n (hasRootProperties || filteredSchemas.some((schema) => schema.allOf))\n\n if (shouldMergeRootProperties) {\n // The discriminator belongs to the union, not to its variants. Copied into a variant, it\n // makes the variant look like a bare `discriminator.mapping` base, which then infers a\n // second selector inside the variant.\n const { discriminator: _discriminator, ...variantRootProperties } = rootProperties\n\n const mergedSchemas = filteredSchemas.map((_schema) => {\n const schema = resolve.schema(_schema)\n\n // Flatten single-item allOf and merge with root properties. If the\n // variant has its own properties/required/$ref, the allOf member's own\n // identity (`$ref`, `title`, `name`) is dropped before merging so it\n // cannot overwrite the variant's, which would otherwise mislabel the\n // flattened schema as the base it extends instead of the variant itself\n // (#9964). `getModelNameFromSchema` labels a variant by title → name →\n // $ref, so any of those leaking from the base is enough to mislabel it.\n // A variant that is a bare wrapper around the allOf member has no\n // identity of its own to protect, so the base's identity is kept as a\n // fallback label.\n if (schema.allOf?.length === 1) {\n const { allOf, ...otherProps } = schema\n const allOfMember = resolve.schema(allOf[0])!\n const variantHasOwnIdentity = 'properties' in otherProps || 'required' in otherProps || '$ref' in otherProps\n if (variantHasOwnIdentity) {\n const { $ref: _ref, title: _title, name: _name, ...allOfMemberWithoutIdentity } = allOfMember\n return mergeSchemaProperties(variantRootProperties, otherProps, allOfMemberWithoutIdentity)\n }\n return mergeSchemaProperties(variantRootProperties, otherProps, allOfMember)\n }\n return mergeSchemaProperties(variantRootProperties, schema)\n })\n\n // @ts-expect-error - We avoid using coerceValue here as it may be dangerous, so we type cast\n const result = { [composition]: mergedSchemas } as DisplaySchema\n if (typeof value.description === 'string') {\n result.description = value.description\n }\n if (shouldBeNullable) {\n result.nullable = true\n }\n return result\n }\n\n // Return with filtered schemas if any nulls were removed\n if (filteredSchemas.length !== schemas.length) {\n const result: DisplaySchema = { ...value, [composition]: filteredSchemas }\n if (shouldBeNullable) {\n result.nullable = true\n }\n return result\n }\n\n return { ...value }\n}\n"],"mappings":";;;;AAiBA,SAASA,EAAsB,GAAGC,GAA2E;CAC3G,IAAMC,IAAuC,CAAC,GACxCC,IAAsC,CAAC,GACvCC,oBAAW,IAAI,IAAY,GAC7BC,IAAgB,IAChBC,IAAc;CAElB,KAAK,IAAMC,KAAUN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AIS,EAAgB,WAAW,GAAG;EAChC,IAAMC,IAAe7B,EAAsB4B,EAAgB,IAAIR,CAAc;EAI7E,OAHIM,MACF,EAAa,WAAW,KAEnBG;CACT;CAOA,KAHGf,MAAgB,WAAWA,MAAgB,aAC3CO,KAAqBO,EAAgB,MAAM,MAAWN,EAAO,KAAK,IAEtC;EAI7B,IAAM,EAAE,eAAeQ,GAAgB,GAAGC,MAA0BX,GAE9DY,IAAgBJ,EAAgB,KAAK,MAAY;GACrD,IAAMN,IAASC,EAAQ,OAAOC,CAAO;GAYrC,IAAIF,EAAO,OAAO,WAAW,GAAG;IAC9B,IAAM,EAAE,UAAO,GAAGW,MAAeX,GAC3BY,IAAcX,EAAQ,OAAOY,EAAM,EAAE;IAE3C,IAD8B,gBAAgBF,KAAc,cAAcA,KAAc,UAAUA,GACvE;KACzB,IAAM,EAAE,MAAMG,GAAM,OAAOC,GAAQ,MAAMC,GAAO,GAAGC,MAA+BL;KAClF,OAAOlC,EAAsB+B,GAAuBE,GAAYM,CAA0B;IAC5F;IACA,OAAOvC,EAAsB+B,GAAuBE,GAAYC,CAAW;GAC7E;GACA,OAAOlC,EAAsB+B,GAAuBT,CAAM;EAC5D,CAAC,GAGKkB,IAAS,GAAG1B,IAAckB,EAAc;EAO9C,OANI,OAAOpB,EAAM,eAAgB,aAC/B,EAAO,cAAcA,EAAM,cAEzBc,MACF,EAAO,WAAW,KAEbc;CACT;CAGA,IAAIZ,EAAgB,WAAWX,EAAQ,QAAQ;EAC7C,IAAMuB,IAAwB;GAAE,GAAG5B;IAAQE,IAAcc;EAAgB;EAIzE,OAHIF,MACF,EAAO,WAAW,KAEbc;CACT;CAEA,OAAO,EAAE,GAAG5B,EAAM;AACpB"}
|
|
1
|
+
{"version":3,"file":"optimize-value-for-display.js","names":["mergeSchemaProperties","objects","merged","properties","required","hasProperties","hasRequired","object","key","val","name","optimizeValueForDisplay","value","schemaDiscriminator","composition","compositions","keyword","schemas","_","originalNullable","rootProperties","hasRootProperties","schema","resolve","_schema","acc","shouldBeNullable","hasNullSchema","filteredSchemas","mergedSchema","_discriminator","badges","variantRootProperties","mergedSchemas","otherProps","allOfMember","allOf","_ref","_title","_name","allOfMemberWithoutIdentity","result"],"sources":["../../../src/schema/helpers/optimize-value-for-display.ts"],"sourcesContent":["import { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport { type DiscriminatorSchema, schemaDiscriminator } from '../discriminator-metadata'\nimport { compositions } from './schema-composition'\n\n/** Display normalization tracks null branches without changing the stored OpenAPI schema. */\ntype DisplaySchema = SchemaObject & { nullable?: boolean }\n\n/**\n * Shallow-merges schema-like objects, but unions `properties` and `required`\n * instead of letting a later object's `properties`/`required` completely\n * overwrite an earlier one's. Without this, a variant schema (e.g. a `oneOf`\n * branch) that declares its own `properties`/`required` would wipe out the\n * shared base fields factored out at the root (or via a sibling `allOf`)\n * instead of being combined with them (#9657).\n */\nfunction mergeSchemaProperties(...objects: (Record<string, unknown> | undefined)[]): Record<string, unknown> {\n const merged: Record<PropertyKey, unknown> = {}\n const properties: Record<string, unknown> = {}\n const required = new Set<string>()\n let hasProperties = false\n let hasRequired = false\n\n for (const object of objects) {\n if (!object) {\n continue\n }\n\n // Renderer-only symbols must survive flattening nullable and single-branch compositions.\n for (const key of Object.getOwnPropertySymbols(object)) {\n merged[key] = (object as Record<PropertyKey, unknown>)[key]\n }\n\n for (const [key, val] of Object.entries(object)) {\n if (key === 'properties' && val && typeof val === 'object') {\n Object.assign(properties, val)\n hasProperties = true\n continue\n }\n\n if (key === 'required' && Array.isArray(val)) {\n for (const name of val) {\n required.add(name)\n }\n hasRequired = true\n continue\n }\n\n merged[key] = val\n }\n }\n\n if (hasProperties) {\n merged.properties = properties\n }\n if (hasRequired) {\n merged.required = [...required]\n }\n\n return merged\n}\n\n/**\n * Normalize compositions for display without changing the source schema. Null branches\n * become nullable state, single branches are flattened, and shared properties and\n * required fields are merged into variants so the renderer keeps their full context.\n */\nexport function optimizeValueForDisplay(value: DisplaySchema | undefined): DisplaySchema | undefined {\n if (!value || typeof value !== 'object') {\n return value\n }\n\n // Inferred AsyncAPI variants already carry complete concrete schemas. Flattening\n // them would lose reference identities and merge the base identity into descendants.\n if ((value as DiscriminatorSchema)[schemaDiscriminator]?.inheritedVariants) {\n return value\n }\n\n // Find the composition keyword early to avoid unnecessary work\n const composition = compositions.find((keyword) => keyword in value && keyword !== 'not')\n\n // If there's no relevant composition keyword, return a shallow copy\n if (!composition) {\n return { ...value }\n }\n\n const schemas = value[composition]\n if (!Array.isArray(schemas)) {\n return { ...value }\n }\n\n // Extract root properties efficiently (excluding composition and nullable)\n const { [composition]: _, nullable: originalNullable, ...rootProperties } = value\n const hasRootProperties = Object.keys(rootProperties).length > 0\n\n // Check for null schemas and filter them out in one pass\n const { filteredSchemas, hasNullSchema } = schemas.reduce<{\n filteredSchemas: SchemaObject[]\n hasNullSchema: boolean\n }>(\n (acc, _schema) => {\n const schema = resolve.schema(_schema)\n\n if ('type' in schema && schema.type === 'null') {\n acc.hasNullSchema = true\n } else {\n acc.filteredSchemas.push(schema)\n }\n return acc\n },\n { filteredSchemas: [], hasNullSchema: false },\n )\n\n // Determine if nullable should be set\n const shouldBeNullable = hasNullSchema || originalNullable === true\n\n // If only one schema remains after filtering, merge with root properties.\n // `properties`/`required` are unioned so sibling properties declared next to\n // the composition (e.g. `properties` alongside a single-`$ref` `allOf`) are\n // kept instead of being overwritten by the member schema's own `properties`.\n // Root-level annotations (title, description, …) win over the member's: they\n // describe the combined schema, not the base it extends.\n if (filteredSchemas.length === 1) {\n const mergedSchema = mergeSchemaProperties(filteredSchemas[0], rootProperties) as DisplaySchema\n if (shouldBeNullable) {\n mergedSchema.nullable = true\n }\n return mergedSchema\n }\n\n // Check if root properties should be merged into schemas\n const shouldMergeRootProperties =\n (composition === 'oneOf' || composition === 'anyOf') &&\n (hasRootProperties || filteredSchemas.some((schema) => schema.allOf))\n\n if (shouldMergeRootProperties) {\n // The discriminator belongs to the union, not to its variants. Copied into a variant, it\n // makes the variant look like a bare `discriminator.mapping` base, which then infers a\n // second selector inside the variant.\n // The property's badges also belong to the union, while variants can define their own.\n const { discriminator: _discriminator, 'x-badges': badges, ...variantRootProperties } = rootProperties\n\n const mergedSchemas = filteredSchemas.map((_schema) => {\n const schema = resolve.schema(_schema)\n\n // Flatten single-item allOf and merge with root properties. If the\n // variant has its own properties/required/$ref, the allOf member's own\n // identity (`$ref`, `title`, `name`) is dropped before merging so it\n // cannot overwrite the variant's, which would otherwise mislabel the\n // flattened schema as the base it extends instead of the variant itself\n // (#9964). `getModelNameFromSchema` labels a variant by title → name →\n // $ref, so any of those leaking from the base is enough to mislabel it.\n // A variant that is a bare wrapper around the allOf member has no\n // identity of its own to protect, so the base's identity is kept as a\n // fallback label.\n if (schema.allOf?.length === 1) {\n const { allOf, ...otherProps } = schema\n const allOfMember = resolve.schema(allOf[0])!\n const variantHasOwnIdentity = 'properties' in otherProps || 'required' in otherProps || '$ref' in otherProps\n if (variantHasOwnIdentity) {\n const { $ref: _ref, title: _title, name: _name, ...allOfMemberWithoutIdentity } = allOfMember\n return mergeSchemaProperties(variantRootProperties, otherProps, allOfMemberWithoutIdentity)\n }\n return mergeSchemaProperties(variantRootProperties, otherProps, allOfMember)\n }\n return mergeSchemaProperties(variantRootProperties, schema)\n })\n\n // @ts-expect-error - We avoid using coerceValue here as it may be dangerous, so we type cast\n const result = { [composition]: mergedSchemas } as DisplaySchema\n if (badges !== undefined) {\n result['x-badges'] = badges\n }\n if (typeof value.description === 'string') {\n result.description = value.description\n }\n if (shouldBeNullable) {\n result.nullable = true\n }\n return result\n }\n\n // Return with filtered schemas if any nulls were removed\n if (filteredSchemas.length !== schemas.length) {\n const result: DisplaySchema = { ...value, [composition]: filteredSchemas }\n if (shouldBeNullable) {\n result.nullable = true\n }\n return result\n }\n\n return { ...value }\n}\n"],"mappings":";;;;AAiBA,SAASA,EAAsB,GAAGC,GAA2E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AG7B,EAAM;AACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"partition-all-of-compositions.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/partition-all-of-compositions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,8DAA8D,CAAA;AAGrH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,KAAK,aAAa,GAAG,OAAO,CAAC,kBAAkB,EAAE,OAAO,GAAG,OAAO,CAAC,CAAA;AAEnE,iFAAiF;AACjF,KAAK,YAAY,GACb;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GACxC;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,WAAW,EAAE,aAAa,CAAA;IAC1B,qFAAqF;IACrF,KAAK,EAAE,YAAY,CAAA;IACnB,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AA+FL;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,YAAY,GAAG,SAAS,KAAG;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"partition-all-of-compositions.d.ts","sourceRoot":"","sources":["../../../src/schema/helpers/partition-all-of-compositions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAuB,MAAM,8DAA8D,CAAA;AAGrH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAE9D,KAAK,aAAa,GAAG,OAAO,CAAC,kBAAkB,EAAE,OAAO,GAAG,OAAO,CAAC,CAAA;AAEnE,iFAAiF;AACjF,KAAK,YAAY,GACb;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,YAAY,CAAA;CAAE,GACxC;IACE,IAAI,EAAE,QAAQ,CAAA;IACd,WAAW,EAAE,aAAa,CAAA;IAC1B,qFAAqF;IACrF,KAAK,EAAE,YAAY,CAAA;IACnB,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AA+FL;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B,GAAI,QAAQ,YAAY,GAAG,SAAS,KAAG;IAAE,QAAQ,EAAE,YAAY,EAAE,CAAA;CA0GvG,CAAA"}
|
|
@@ -49,29 +49,39 @@ var r = ["oneOf", "anyOf"], i = (e, a, o) => {
|
|
|
49
49
|
kind: "object",
|
|
50
50
|
schema: d
|
|
51
51
|
});
|
|
52
|
-
let p = "$ref" in t ? t.$ref : void 0,
|
|
53
|
-
for (let e of r) if (typeof
|
|
54
|
-
let
|
|
55
|
-
i(
|
|
52
|
+
let p = f.length, m = typeof d.description == "string" ? d.description : void 0, h = "$ref" in t ? t.$ref : void 0, g = new Set(typeof h == "string" ? [h] : []), _ = !1;
|
|
53
|
+
for (let [e, t] of r.entries()) if (typeof t == "boolean" || t && typeof t == "object") {
|
|
54
|
+
let r = n.schema(t), a = r.$ref;
|
|
55
|
+
i(t, f, typeof a == "string" ? new Set(g).add(a) : g), e === 0 && (_ = !!(r.oneOf?.length || r.anyOf?.length || f[p]?.kind === "choice"));
|
|
56
56
|
}
|
|
57
|
-
let
|
|
58
|
-
if (
|
|
59
|
-
let t =
|
|
60
|
-
|
|
57
|
+
let v = [], y = [], b = 0, x = () => {
|
|
58
|
+
if (y.length === 0) return;
|
|
59
|
+
let t = y.length === 1 ? y[0] : e({ allOf: y }), n = y[0] === d, r = t;
|
|
60
|
+
if (m !== void 0) {
|
|
61
|
+
if (n && t.description !== m) r = {
|
|
62
|
+
...t,
|
|
63
|
+
description: m
|
|
64
|
+
};
|
|
65
|
+
else if (!n && !_ && t.description !== void 0) {
|
|
66
|
+
let { description: e, ...n } = t;
|
|
67
|
+
r = n;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
v.push({
|
|
61
71
|
kind: "object",
|
|
62
|
-
schema:
|
|
63
|
-
}),
|
|
72
|
+
schema: r
|
|
73
|
+
}), y = [];
|
|
64
74
|
};
|
|
65
|
-
for (let e of f) e.kind === "object" ?
|
|
75
|
+
for (let e of f) e.kind === "object" ? y.push(e.schema) : e.kind === "boolean" ? (x(), v.push({
|
|
66
76
|
kind: "object",
|
|
67
77
|
schema: e.schema
|
|
68
|
-
})) : e.inheritedSelection ?
|
|
78
|
+
})) : e.inheritedSelection ? b++ : (x(), v.push({
|
|
69
79
|
kind: "choice",
|
|
70
80
|
composition: e.composition,
|
|
71
81
|
value: e.value,
|
|
72
|
-
choiceIndex:
|
|
82
|
+
choiceIndex: b++
|
|
73
83
|
}));
|
|
74
|
-
return
|
|
84
|
+
return x(), { segments: v };
|
|
75
85
|
};
|
|
76
86
|
export { a as partitionAllOfCompositions };
|
|
77
87
|
|