@scalar/api-reference 1.53.1 → 1.54.0
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 +14 -0
- package/dist/browser/standalone.js +224 -224
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.d.ts +15 -12
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue.js.map +1 -1
- package/dist/components/ApiReference.vue.script.js +2 -2
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +1 -1
- package/dist/components/Content/Schema/Schema.vue.js.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.script.js +0 -1
- package/dist/components/Content/Schema/Schema.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js +23 -2
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/helpers/optimize-value-for-display.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/optimize-value-for-display.js +1 -0
- package/dist/components/Content/Schema/helpers/optimize-value-for-display.js.map +1 -1
- package/dist/components/Content/Schema/helpers/should-display-description.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/should-display-description.js +1 -0
- package/dist/components/Content/Schema/helpers/should-display-description.js.map +1 -1
- package/dist/components/Section/SectionHeader.vue.d.ts +1 -0
- package/dist/components/Section/SectionHeader.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionHeader.vue.js +1 -1
- package/dist/components/Section/SectionHeader.vue.js.map +1 -1
- package/dist/components/Section/SectionHeader.vue.script.js +9 -2
- package/dist/components/Section/SectionHeader.vue.script.js.map +1 -1
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js.map +1 -1
- package/dist/features/Operation/Operation.vue.script.js +6 -0
- package/dist/features/Operation/Operation.vue.script.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.script.js +5 -2
- package/dist/features/Operation/components/OperationParameters.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.script.js +6 -7
- package/dist/features/Operation/components/ParameterListItem.vue.script.js.map +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.d.ts +9 -0
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.d.ts.map +1 -0
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.js +7 -0
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.js.map +1 -0
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.script.js +91 -0
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.script.js.map +1 -0
- package/dist/features/Operation/components/SecurityRequirementBadgeScheme.vue.d.ts +10 -0
- package/dist/features/Operation/components/SecurityRequirementBadgeScheme.vue.d.ts.map +1 -0
- package/dist/features/Operation/components/SecurityRequirementBadgeScheme.vue.js +7 -0
- package/dist/features/Operation/components/SecurityRequirementBadgeScheme.vue.js.map +1 -0
- package/dist/features/Operation/components/SecurityRequirementBadgeScheme.vue.script.js +32 -0
- package/dist/features/Operation/components/SecurityRequirementBadgeScheme.vue.script.js.map +1 -0
- package/dist/features/Operation/components/helpers/get-parameter-examples.d.ts +13 -0
- package/dist/features/Operation/components/helpers/get-parameter-examples.d.ts.map +1 -0
- package/dist/features/Operation/components/helpers/get-parameter-examples.js +21 -0
- package/dist/features/Operation/components/helpers/get-parameter-examples.js.map +1 -0
- package/dist/features/Operation/helpers/flatten-deep-object-query-parameter.d.ts +7 -0
- package/dist/features/Operation/helpers/flatten-deep-object-query-parameter.d.ts.map +1 -0
- package/dist/features/Operation/helpers/flatten-deep-object-query-parameter.js +44 -0
- package/dist/features/Operation/helpers/flatten-deep-object-query-parameter.js.map +1 -0
- package/dist/features/Operation/helpers/get-required-security.d.ts +41 -0
- package/dist/features/Operation/helpers/get-required-security.d.ts.map +1 -0
- package/dist/features/Operation/helpers/get-required-security.js +41 -0
- package/dist/features/Operation/helpers/get-required-security.js.map +1 -0
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +3 -0
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js +10 -4
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +3 -0
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.script.js +16 -13
- package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
- package/dist/helpers/storage.d.ts +4 -4
- package/dist/style.css +205 -179
- package/package.json +11 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaObjectProperties.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { sortPropertyNames } from '@/components/Content/Schema/helpers/sort-property-names'\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\n\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<{\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n }>()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n if (\n additionalProperties === true ||\n (typeof additionalProperties === 'object' &&\n Object.keys(additionalProperties).length === 0) ||\n typeof additionalProperties !== 'object' ||\n !('type' in additionalProperties)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof additionalProperties === 'object' ? additionalProperties : {}),\n }\n }\n\n return additionalProperties\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"property in sortedProperties\"\n :key=\"property\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"property\"\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"property\"\n :options=\"options\"\n :required=\"schema.required?.includes(property)\"\n :schema=\"resolve.schema(schema.properties[property])\"\n :schemaContext=\"schemaContext\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"resolve.schema(property)\"\n :schemaContext=\"schemaContext\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"SchemaObjectProperties.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { sortPropertyNames } from '@/components/Content/Schema/helpers/sort-property-names'\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\n\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<{\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n }>()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * Keep sibling property descriptions separate from the referenced schema.\n *\n * This allows us to render both:\n * - the property-specific description written next to the $ref, and\n * - the referenced schema's own description (for example discriminator parent docs)\n */\nconst getPropertySchema = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): SchemaObject | undefined => {\n if (!property) {\n return undefined\n }\n\n if ('$ref' in property && typeof property.$ref === 'string') {\n return getResolvedRef(property) as SchemaObject\n }\n\n return resolve.schema(property)\n}\n\nconst getPropertyDescription = (\n property: SchemaReferenceType<SchemaObject> | undefined,\n): string | undefined => {\n if (!property) {\n return undefined\n }\n\n return typeof property.description === 'string'\n ? property.description\n : undefined\n}\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n if (\n additionalProperties === true ||\n (typeof additionalProperties === 'object' &&\n Object.keys(additionalProperties).length === 0) ||\n typeof additionalProperties !== 'object' ||\n !('type' in additionalProperties)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof additionalProperties === 'object' ? additionalProperties : {}),\n }\n }\n\n return additionalProperties\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"property in sortedProperties\"\n :key=\"property\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"property\"\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"property\"\n :options=\"options\"\n :required=\"schema.required?.includes(property)\"\n :description=\"getPropertyDescription(schema.properties[property])\"\n :schema=\"getPropertySchema(schema.properties[property])\"\n :schemaContext=\"schemaContext\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"key\"\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :description=\"getPropertyDescription(property)\"\n :schema=\"getPropertySchema(property)\"\n :schemaContext=\"schemaContext\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :compositionPath=\"compositionPath\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n :schemaContext=\"schemaContext\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimize-value-for-display.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/optimize-value-for-display.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIhG;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"optimize-value-for-display.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/optimize-value-for-display.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIhG;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,CAyFjG"}
|
|
@@ -49,6 +49,7 @@ function optimizeValueForDisplay(value) {
|
|
|
49
49
|
};
|
|
50
50
|
});
|
|
51
51
|
const result = { [composition]: mergedSchemas };
|
|
52
|
+
if (typeof value.description === "string") result.description = value.description;
|
|
52
53
|
if (shouldBeNullable) result.nullable = true;
|
|
53
54
|
return result;
|
|
54
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"optimize-value-for-display.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/optimize-value-for-display.ts"],"sourcesContent":["import { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { compositions } from './schema-composition'\n\n/**\n * Optimize the value by removing nulls from compositions and merging root properties.\n *\n * TODO: figure out what this does\n */\nexport function optimizeValueForDisplay(value: SchemaObject | undefined): SchemaObject | undefined {\n if (!value || typeof value !== 'object') {\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 as any\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 (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: [] as SchemaObject[], 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 if (filteredSchemas.length === 1) {\n const mergedSchema = { ...rootProperties, ...filteredSchemas[0] }\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 const mergedSchemas = filteredSchemas.map((_schema) => {\n const schema = resolve.schema(_schema)\n\n // Flatten single-item allOf and merge with root properties\n if (schema.allOf?.length === 1) {\n const { allOf, ...otherProps } = schema\n return { ...rootProperties, ...otherProps, ...resolve.schema(allOf[0]) }\n }\n return { ...rootProperties, ...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 SchemaObject\n if (shouldBeNullable) {\n // @ts-expect-error We use nullable\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: SchemaObject = { ...value, [composition]: filteredSchemas }\n if (shouldBeNullable) {\n // @ts-expect-error We use nullable\n result.nullable = true\n }\n return result\n }\n\n return { ...value }\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,wBAAwB,OAA2D;AACjG,KAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,QAAO;CAIT,MAAM,cAAc,aAAa,MAAM,YAAY,WAAW,SAAS,YAAY,MAAM;AAGzF,KAAI,CAAC,YACH,QAAO,EAAE,GAAG,OAAO;CAGrB,MAAM,UAAU,MAAM;AACtB,KAAI,CAAC,MAAM,QAAQ,QAAQ,CACzB,QAAO,EAAE,GAAG,OAAO;CAIrB,MAAM,GAAG,cAAc,GAAG,UAAU,kBAAkB,GAAG,mBAAmB;CAC5E,MAAM,oBAAoB,OAAO,KAAK,eAAe,CAAC,SAAS;CAG/D,MAAM,EAAE,iBAAiB,kBAAkB,QAAQ,QAChD,KAAK,YAAY;EAChB,MAAM,SAAS,QAAQ,OAAO,QAAQ;AAEtC,MAAI,UAAU,UAAU,OAAO,SAAS,OACtC,KAAI,gBAAgB;MAEpB,KAAI,gBAAgB,KAAK,OAAO;AAElC,SAAO;IAET;EAAE,iBAAiB,EAAE;EAAoB,eAAe;EAAO,CAChE;CAGD,MAAM,mBAAmB,iBAAiB,qBAAqB;AAG/D,KAAI,gBAAgB,WAAW,GAAG;EAChC,MAAM,eAAe;GAAE,GAAG;GAAgB,GAAG,gBAAgB;GAAI;AACjE,MAAI,iBACF,cAAa,WAAW;AAE1B,SAAO;;AAQT,MAHG,gBAAgB,WAAW,gBAAgB,aAC3C,qBAAqB,gBAAgB,MAAM,WAAW,OAAO,MAAM,GAEvC;EAC7B,MAAM,gBAAgB,gBAAgB,KAAK,YAAY;GACrD,MAAM,SAAS,QAAQ,OAAO,QAAQ;AAGtC,OAAI,OAAO,OAAO,WAAW,GAAG;IAC9B,MAAM,EAAE,OAAO,GAAG,eAAe;AACjC,WAAO;KAAE,GAAG;KAAgB,GAAG;KAAY,GAAG,QAAQ,OAAO,MAAM,GAAG;KAAE;;AAE1E,UAAO;IAAE,GAAG;IAAgB,GAAG;IAAQ;IACvC;EAGF,MAAM,SAAS,GAAG,cAAc,eAAe;AAC/C,MAAI,iBAEF,QAAO,WAAW;AAEpB,SAAO;;AAIT,KAAI,gBAAgB,WAAW,QAAQ,QAAQ;EAC7C,MAAM,SAAuB;GAAE,GAAG;IAAQ,cAAc;GAAiB;AACzE,MAAI,iBAEF,QAAO,WAAW;AAEpB,SAAO;;AAGT,QAAO,EAAE,GAAG,OAAO"}
|
|
1
|
+
{"version":3,"file":"optimize-value-for-display.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/optimize-value-for-display.ts"],"sourcesContent":["import { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { compositions } from './schema-composition'\n\n/**\n * Optimize the value by removing nulls from compositions and merging root properties.\n *\n * TODO: figure out what this does\n */\nexport function optimizeValueForDisplay(value: SchemaObject | undefined): SchemaObject | undefined {\n if (!value || typeof value !== 'object') {\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 as any\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 (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: [] as SchemaObject[], 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 if (filteredSchemas.length === 1) {\n const mergedSchema = { ...rootProperties, ...filteredSchemas[0] }\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 const mergedSchemas = filteredSchemas.map((_schema) => {\n const schema = resolve.schema(_schema)\n\n // Flatten single-item allOf and merge with root properties\n if (schema.allOf?.length === 1) {\n const { allOf, ...otherProps } = schema\n return { ...rootProperties, ...otherProps, ...resolve.schema(allOf[0]) }\n }\n return { ...rootProperties, ...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 SchemaObject\n if (typeof value.description === 'string') {\n result.description = value.description\n }\n if (shouldBeNullable) {\n // @ts-expect-error We use nullable\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: SchemaObject = { ...value, [composition]: filteredSchemas }\n if (shouldBeNullable) {\n // @ts-expect-error We use nullable\n result.nullable = true\n }\n return result\n }\n\n return { ...value }\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,wBAAwB,OAA2D;AACjG,KAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,QAAO;CAIT,MAAM,cAAc,aAAa,MAAM,YAAY,WAAW,SAAS,YAAY,MAAM;AAGzF,KAAI,CAAC,YACH,QAAO,EAAE,GAAG,OAAO;CAGrB,MAAM,UAAU,MAAM;AACtB,KAAI,CAAC,MAAM,QAAQ,QAAQ,CACzB,QAAO,EAAE,GAAG,OAAO;CAIrB,MAAM,GAAG,cAAc,GAAG,UAAU,kBAAkB,GAAG,mBAAmB;CAC5E,MAAM,oBAAoB,OAAO,KAAK,eAAe,CAAC,SAAS;CAG/D,MAAM,EAAE,iBAAiB,kBAAkB,QAAQ,QAChD,KAAK,YAAY;EAChB,MAAM,SAAS,QAAQ,OAAO,QAAQ;AAEtC,MAAI,UAAU,UAAU,OAAO,SAAS,OACtC,KAAI,gBAAgB;MAEpB,KAAI,gBAAgB,KAAK,OAAO;AAElC,SAAO;IAET;EAAE,iBAAiB,EAAE;EAAoB,eAAe;EAAO,CAChE;CAGD,MAAM,mBAAmB,iBAAiB,qBAAqB;AAG/D,KAAI,gBAAgB,WAAW,GAAG;EAChC,MAAM,eAAe;GAAE,GAAG;GAAgB,GAAG,gBAAgB;GAAI;AACjE,MAAI,iBACF,cAAa,WAAW;AAE1B,SAAO;;AAQT,MAHG,gBAAgB,WAAW,gBAAgB,aAC3C,qBAAqB,gBAAgB,MAAM,WAAW,OAAO,MAAM,GAEvC;EAC7B,MAAM,gBAAgB,gBAAgB,KAAK,YAAY;GACrD,MAAM,SAAS,QAAQ,OAAO,QAAQ;AAGtC,OAAI,OAAO,OAAO,WAAW,GAAG;IAC9B,MAAM,EAAE,OAAO,GAAG,eAAe;AACjC,WAAO;KAAE,GAAG;KAAgB,GAAG;KAAY,GAAG,QAAQ,OAAO,MAAM,GAAG;KAAE;;AAE1E,UAAO;IAAE,GAAG;IAAgB,GAAG;IAAQ;IACvC;EAGF,MAAM,SAAS,GAAG,cAAc,eAAe;AAC/C,MAAI,OAAO,MAAM,gBAAgB,SAC/B,QAAO,cAAc,MAAM;AAE7B,MAAI,iBAEF,QAAO,WAAW;AAEpB,SAAO;;AAIT,KAAI,gBAAgB,WAAW,QAAQ,QAAQ;EAC7C,MAAM,SAAuB;GAAE,GAAG;IAAQ,cAAc;GAAiB;AACzE,MAAI,iBAEF,QAAO,WAAW;AAEpB,SAAO;;AAGT,QAAO,EAAE,GAAG,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-display-description.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/should-display-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,YAAY,GAAG,SAAS,EAAE,kBAAkB,MAAM,KAAG,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"should-display-description.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/should-display-description.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAEhG;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GAAI,QAAQ,YAAY,GAAG,SAAS,EAAE,kBAAkB,MAAM,KAAG,MAAM,GAAG,IAe9G,CAAA"}
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
var shouldDisplayDescription = (schema, propDescription) => {
|
|
10
10
|
if (!schema) return null;
|
|
11
11
|
if (schema.allOf) return null;
|
|
12
|
+
if (propDescription && schema.description && (schema.oneOf || schema.anyOf)) return propDescription === schema.description ? propDescription : `${propDescription}\n\n${schema.description}`;
|
|
12
13
|
return propDescription || schema.description || null;
|
|
13
14
|
};
|
|
14
15
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-display-description.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/should-display-description.ts"],"sourcesContent":["import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/**\n * Determine if description should be displayed\n *\n * @param schema - The schema object to check\n * @param propDescription - Optional description from props\n * @returns Description string to display, or null if should not be displayed\n */\nexport const shouldDisplayDescription = (schema: SchemaObject | undefined, propDescription?: string): string | null => {\n if (!schema) {\n return null\n }\n\n // Don't show description for schemas with compositions to avoid duplicate descriptions\n if (schema.allOf) {\n return null\n }\n\n return propDescription || schema.description || null\n}\n"],"mappings":";;;;;;;;AASA,IAAa,4BAA4B,QAAkC,oBAA4C;AACrH,KAAI,CAAC,OACH,QAAO;AAIT,KAAI,OAAO,MACT,QAAO;AAGT,QAAO,mBAAmB,OAAO,eAAe"}
|
|
1
|
+
{"version":3,"file":"should-display-description.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/should-display-description.ts"],"sourcesContent":["import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\n/**\n * Determine if description should be displayed\n *\n * @param schema - The schema object to check\n * @param propDescription - Optional description from props\n * @returns Description string to display, or null if should not be displayed\n */\nexport const shouldDisplayDescription = (schema: SchemaObject | undefined, propDescription?: string): string | null => {\n if (!schema) {\n return null\n }\n\n // Don't show description for schemas with compositions to avoid duplicate descriptions\n if (schema.allOf) {\n return null\n }\n\n if (propDescription && schema.description && (schema.oneOf || schema.anyOf)) {\n return propDescription === schema.description ? propDescription : `${propDescription}\\n\\n${schema.description}`\n }\n\n return propDescription || schema.description || null\n}\n"],"mappings":";;;;;;;;AASA,IAAa,4BAA4B,QAAkC,oBAA4C;AACrH,KAAI,CAAC,OACH,QAAO;AAIT,KAAI,OAAO,MACT,QAAO;AAGT,KAAI,mBAAmB,OAAO,gBAAgB,OAAO,SAAS,OAAO,OACnE,QAAO,oBAAoB,OAAO,cAAc,kBAAkB,GAAG,gBAAgB,MAAM,OAAO;AAGpG,QAAO,mBAAmB,OAAO,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Section/SectionHeader.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SectionHeader.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Section/SectionHeader.vue"],"names":[],"mappings":"AAkEA,KAAK,WAAW,GAAG;IACjB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB,CAAC;AA0DF,QAAA,IAAI,OAAO,IAAU,EAAE,OAAO,IAAW,CAAE;AAC3C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GAC5C;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK7C,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import SectionHeader_vue_vue_type_script_setup_true_lang_default from "./SectionHeader.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/components/Section/SectionHeader.vue
|
|
5
|
-
var SectionHeader_default = /* @__PURE__ */ _plugin_vue_export_helper_default(SectionHeader_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var SectionHeader_default = /* @__PURE__ */ _plugin_vue_export_helper_default(SectionHeader_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8a5913a9"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SectionHeader_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.vue.js","names":[],"sources":["../../../src/components/Section/SectionHeader.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport LoadingSkeleton from '../LoadingSkeleton.vue'\n\
|
|
1
|
+
{"version":3,"file":"SectionHeader.vue.js","names":[],"sources":["../../../src/components/Section/SectionHeader.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport LoadingSkeleton from '../LoadingSkeleton.vue'\n\nconst {\n loading,\n tight,\n removeMargin = false,\n} = defineProps<{\n loading?: boolean\n tight?: boolean\n removeMargin?: boolean\n}>()\n</script>\n\n<template>\n <div class=\"section-header-wrapper xl:gap-12\">\n <LoadingSkeleton v-if=\"loading\" />\n <div\n v-else\n class=\"section-header\"\n :class=\"{ tight, 'mb-3': !removeMargin }\">\n <slot />\n </div>\n <slot\n v-if=\"$slots.links\"\n name=\"links\" />\n </div>\n</template>\n\n<style scoped>\n@reference \"@/style.css\";\n\n.section-header-wrapper {\n display: grid;\n grid-template-columns: 1fr;\n}\n\n@variant xl {\n .section-header-wrapper {\n grid-template-columns: repeat(2, 1fr);\n }\n}\n\n.section-header {\n font-size: var(--font-size, var(--scalar-heading-1));\n font-weight: var(--font-weight, var(--scalar-bold));\n /* prettier-ignore */\n color: var(--scalar-color-1);\n word-wrap: break-word;\n line-height: 1.45;\n margin-top: 0;\n}\n\n.section-header.tight {\n margin-bottom: 6px;\n}\n\n.section-header.loading {\n width: 80%;\n}\n</style>\n"],"mappings":""}
|
|
@@ -6,13 +6,20 @@ var SectionHeader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
6
6
|
__name: "SectionHeader",
|
|
7
7
|
props: {
|
|
8
8
|
loading: { type: Boolean },
|
|
9
|
-
tight: { type: Boolean }
|
|
9
|
+
tight: { type: Boolean },
|
|
10
|
+
removeMargin: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false
|
|
13
|
+
}
|
|
10
14
|
},
|
|
11
15
|
setup(__props) {
|
|
12
16
|
return (_ctx, _cache) => {
|
|
13
17
|
return openBlock(), createElementBlock("div", _hoisted_1, [__props.loading ? (openBlock(), createBlock(LoadingSkeleton_default, { key: 0 })) : (openBlock(), createElementBlock("div", {
|
|
14
18
|
key: 1,
|
|
15
|
-
class: normalizeClass(["section-header", {
|
|
19
|
+
class: normalizeClass(["section-header", {
|
|
20
|
+
tight: __props.tight,
|
|
21
|
+
"mb-3": !__props.removeMargin
|
|
22
|
+
}])
|
|
16
23
|
}, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 2)), _ctx.$slots.links ? renderSlot(_ctx.$slots, "links", { key: 2 }, void 0, true) : createCommentVNode("", true)]);
|
|
17
24
|
};
|
|
18
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.vue.script.js","names":["$slots"],"sources":["../../../src/components/Section/SectionHeader.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport LoadingSkeleton from '../LoadingSkeleton.vue'\n\
|
|
1
|
+
{"version":3,"file":"SectionHeader.vue.script.js","names":["$slots"],"sources":["../../../src/components/Section/SectionHeader.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport LoadingSkeleton from '../LoadingSkeleton.vue'\n\nconst {\n loading,\n tight,\n removeMargin = false,\n} = defineProps<{\n loading?: boolean\n tight?: boolean\n removeMargin?: boolean\n}>()\n</script>\n\n<template>\n <div class=\"section-header-wrapper xl:gap-12\">\n <LoadingSkeleton v-if=\"loading\" />\n <div\n v-else\n class=\"section-header\"\n :class=\"{ tight, 'mb-3': !removeMargin }\">\n <slot />\n </div>\n <slot\n v-if=\"$slots.links\"\n name=\"links\" />\n </div>\n</template>\n\n<style scoped>\n@reference \"@/style.css\";\n\n.section-header-wrapper {\n display: grid;\n grid-template-columns: 1fr;\n}\n\n@variant xl {\n .section-header-wrapper {\n grid-template-columns: repeat(2, 1fr);\n }\n}\n\n.section-header {\n font-size: var(--font-size, var(--scalar-heading-1));\n font-weight: var(--font-weight, var(--scalar-bold));\n /* prettier-ignore */\n color: var(--scalar-color-1);\n word-wrap: break-word;\n line-height: 1.45;\n margin-top: 0;\n}\n\n.section-header.tight {\n margin-bottom: 6px;\n}\n\n.section-header.loading {\n width: 80%;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;uBAeE,mBAWM,OAXN,YAWM,CAVmB,QAAA,WAAA,WAAA,EAAvB,YAAkC,yBAAA,EAAA,KAAA,GAAA,CAAA,KAAA,WAAA,EAClC,mBAKM,OAAA;;IAHJ,OAAK,eAAA,CAAC,kBAAgB;KAAA,OACZ,QAAA;KAAK,QAAA,CAAW,QAAA;KAAY,CAAA,CAAA;OACtC,WAAQ,KAAA,QAAA,WAAA,EAAA,EAAA,KAAA,GAAA,KAAA,CAAA,EAAA,EAAA,GAGFA,KAAAA,OAAO,QADf,WAEiB,KAAA,QAAA,SAAA,EAAA,KAAA,GAAA,EAAA,KAAA,GAAA,KAAA,GAAA,mBAAA,IAAA,KAAA,CAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"AAoLA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAA;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAA;AACtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACb,MAAM,8DAA8D,CAAA;AAcrE;;GAEG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAIzC,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,UAAU,CAAA;IAClB,kFAAkF;IAClF,OAAO,EAAE,IAAI,CACX,4BAA4B,EAC1B,oBAAoB,GACpB,YAAY,GACZ,uBAAuB,GACvB,QAAQ,GACR,8BAA8B,GAC9B,yBAAyB,GACzB,iBAAiB,CACpB,CAAA;IACD,sBAAsB;IACtB,QAAQ,EAAE,eAAe,CAAA;IACzB,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,SAAS,EAAE,cAAc,GAAG,SAAS,CAAA;IACrC,iDAAiD;IACjD,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,wFAAwF;IACxF,eAAe,EAAE,qBAAqB,CAAA;IACtC,+CAA+C;IAC/C,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,wDAAwD;IACxD,WAAW,EAAE,OAAO,CAAA;IACpB,yCAAyC;IACzC,SAAS,EAAE,OAAO,CAAA;IAClB,qDAAqD;IACrD,cAAc,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,yBAAyB,CAAC,CAAA;IACtE,oBAAoB;IACpB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,qBAAqB;IACrB,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AACD,QAAA,MAAM,YAAY,wSA4Kd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.js","names":[],"sources":["../../../src/features/Operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * References Operation \"block\"\n */\nexport default {}\n\nexport type OperationProps = {\n id: string\n method: HttpMethod\n /** The subset of the configuration object required for the operation component */\n options: Pick<\n ApiReferenceConfigurationRaw,\n | 'expandAllResponses'\n | 'hideModels'\n | 'hideTestRequestButton'\n | 'layout'\n | 'orderRequiredPropertiesFirst'\n | 'orderSchemaPropertiesBy'\n | 'showOperationId'\n >\n /** Document object */\n document: OpenApiDocument\n /** Key of the operations path in the document.paths object */\n path: string\n /** OpenAPI path object that will include the operation */\n pathValue: PathItemObject | undefined\n /** Currently selected server for the document */\n server: ServerObject | null\n /** The merged security schemes for the document and the authentication configuration */\n securitySchemes: MergedSecuritySchemes\n /** The http client options for the dropdown */\n clientOptions: ClientOptionGroup[]\n /** Whether the Classic layout operation is collapsed */\n isCollapsed: boolean\n /** Whether the operation is a webhook */\n isWebhook: boolean\n /** The currently selected client for the document */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** The event bus */\n eventBus: WorkspaceEventBus\n /** The auth store */\n authStore: AuthStore\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport type { ClientOptionGroup } from '@scalar/api-client/blocks/operation-code-sample'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n combineParams,\n type MergedSecuritySchemes,\n} from '@scalar/workspace-store/request-example'\nimport type {\n OpenApiDocument,\n PathItemObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { filterSelectedSecurity } from '@/features/Operation/helpers/filter-selected-security'\n\nimport { getFirstServer } from './helpers/get-first-server'\nimport ClassicLayout from './layouts/ClassicLayout.vue'\nimport ModernLayout from './layouts/ModernLayout.vue'\n\nconst {\n authStore,\n clientOptions,\n document,\n eventBus,\n isCollapsed,\n isWebhook,\n method,\n options,\n path,\n pathValue,\n securitySchemes,\n server,\n} = defineProps<OperationProps>()\n\n/**\n * Operation from the new workspace store, ensure we are de-reference\n *\n * Also adds in params from the pathItemObject\n */\nconst operation = computed(() => {\n const entity = getResolvedRef(pathValue?.[method])\n\n if (!entity) {\n return null\n }\n\n // Combine params from the pathItem and the operation\n const parameters = combineParams(pathValue?.parameters, entity.parameters)\n return { ...entity, parameters }\n})\n\n/**\n * Determine the effective server for the code examples.\n */\nconst selectedServer = computed<ServerObject | null>(() =>\n getFirstServer(\n // 1) Operation\n operation.value?.servers ?? null,\n // 2) Path Item\n pathValue?.servers ?? null,\n // 3) Document\n server,\n ),\n)\n\n/** We must ensure the selected security schemes are required on this operation */\nconst selectedSecuritySchemes = computed(() =>\n filterSelectedSecurity(\n document,\n operation.value,\n authStore.getAuthSelectedSchemas({\n type: 'document',\n documentName: document?.['x-scalar-navigation']?.name ?? '',\n }),\n authStore.getAuthSelectedSchemas({\n type: 'operation',\n documentName: document?.['x-scalar-navigation']?.name ?? '',\n path,\n method,\n }),\n securitySchemes,\n ),\n)\n</script>\n\n<template>\n <template v-if=\"operation\">\n <ClassicLayout\n v-if=\"options.layout === 'classic'\"\n :id\n :clientOptions\n :eventBus\n :isCollapsed\n :isWebhook\n :method\n :operation\n :options\n :path\n :selectedClient\n :selectedSecuritySchemes\n :selectedServer />\n <ModernLayout\n v-else\n :id\n :clientOptions\n :eventBus\n :isWebhook\n :method\n :operation\n :options\n :path\n :selectedClient\n :selectedSecuritySchemes\n :selectedServer />\n </template>\n</template>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Operation.vue.js","names":[],"sources":["../../../src/features/Operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * References Operation \"block\"\n */\nexport default {}\n\nexport type OperationProps = {\n id: string\n method: HttpMethod\n /** The subset of the configuration object required for the operation component */\n options: Pick<\n ApiReferenceConfigurationRaw,\n | 'expandAllResponses'\n | 'hideModels'\n | 'hideTestRequestButton'\n | 'layout'\n | 'orderRequiredPropertiesFirst'\n | 'orderSchemaPropertiesBy'\n | 'showOperationId'\n >\n /** Document object */\n document: OpenApiDocument\n /** Key of the operations path in the document.paths object */\n path: string\n /** OpenAPI path object that will include the operation */\n pathValue: PathItemObject | undefined\n /** Currently selected server for the document */\n server: ServerObject | null\n /** The merged security schemes for the document and the authentication configuration */\n securitySchemes: MergedSecuritySchemes\n /** The http client options for the dropdown */\n clientOptions: ClientOptionGroup[]\n /** Whether the Classic layout operation is collapsed */\n isCollapsed: boolean\n /** Whether the operation is a webhook */\n isWebhook: boolean\n /** The currently selected client for the document */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** The event bus */\n eventBus: WorkspaceEventBus\n /** The auth store */\n authStore: AuthStore\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport type { ClientOptionGroup } from '@scalar/api-client/blocks/operation-code-sample'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n combineParams,\n type MergedSecuritySchemes,\n} from '@scalar/workspace-store/request-example'\nimport type {\n OpenApiDocument,\n PathItemObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { filterSelectedSecurity } from '@/features/Operation/helpers/filter-selected-security'\n\nimport { getFirstServer } from './helpers/get-first-server'\nimport {\n getRequiredSecurity,\n type RequiredSecurity,\n} from './helpers/get-required-security'\nimport ClassicLayout from './layouts/ClassicLayout.vue'\nimport ModernLayout from './layouts/ModernLayout.vue'\n\nconst {\n authStore,\n clientOptions,\n document,\n eventBus,\n isCollapsed,\n isWebhook,\n method,\n options,\n path,\n pathValue,\n securitySchemes,\n server,\n} = defineProps<OperationProps>()\n\n/**\n * Operation from the new workspace store, ensure we are de-reference\n *\n * Also adds in params from the pathItemObject\n */\nconst operation = computed(() => {\n const entity = getResolvedRef(pathValue?.[method])\n\n if (!entity) {\n return null\n }\n\n // Combine params from the pathItem and the operation\n const parameters = combineParams(pathValue?.parameters, entity.parameters)\n return { ...entity, parameters }\n})\n\n/**\n * Determine the effective server for the code examples.\n */\nconst selectedServer = computed<ServerObject | null>(() =>\n getFirstServer(\n // 1) Operation\n operation.value?.servers ?? null,\n // 2) Path Item\n pathValue?.servers ?? null,\n // 3) Document\n server,\n ),\n)\n\nconst requiredSecurity = computed<RequiredSecurity>(() =>\n getRequiredSecurity(operation.value, document),\n)\n\n/** We must ensure the selected security schemes are required on this operation */\nconst selectedSecuritySchemes = computed(() =>\n filterSelectedSecurity(\n document,\n operation.value,\n authStore.getAuthSelectedSchemas({\n type: 'document',\n documentName: document?.['x-scalar-navigation']?.name ?? '',\n }),\n authStore.getAuthSelectedSchemas({\n type: 'operation',\n documentName: document?.['x-scalar-navigation']?.name ?? '',\n path,\n method,\n }),\n securitySchemes,\n ),\n)\n</script>\n\n<template>\n <template v-if=\"operation\">\n <ClassicLayout\n v-if=\"options.layout === 'classic'\"\n :id\n :clientOptions\n :eventBus\n :isCollapsed\n :isWebhook\n :method\n :operation\n :options\n :path\n :requiredSecurity\n :selectedClient\n :selectedSecuritySchemes\n :selectedServer />\n <ModernLayout\n v-else\n :id\n :clientOptions\n :eventBus\n :isWebhook\n :method\n :operation\n :options\n :path\n :requiredSecurity\n :selectedClient\n :selectedSecuritySchemes\n :selectedServer />\n </template>\n</template>\n"],"mappings":""}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { filterSelectedSecurity } from "./helpers/filter-selected-security.js";
|
|
2
2
|
import { getFirstServer } from "./helpers/get-first-server.js";
|
|
3
|
+
import { getRequiredSecurity } from "./helpers/get-required-security.js";
|
|
3
4
|
import ClassicLayout_default from "./layouts/ClassicLayout.vue.js";
|
|
4
5
|
import ModernLayout_default from "./layouts/ModernLayout.vue.js";
|
|
5
6
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, defineComponent, openBlock } from "vue";
|
|
@@ -42,6 +43,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
42
43
|
* Determine the effective server for the code examples.
|
|
43
44
|
*/
|
|
44
45
|
const selectedServer = computed(() => getFirstServer(operation.value?.servers ?? null, __props.pathValue?.servers ?? null, __props.server));
|
|
46
|
+
const requiredSecurity = computed(() => getRequiredSecurity(operation.value, __props.document));
|
|
45
47
|
/** We must ensure the selected security schemes are required on this operation */
|
|
46
48
|
const selectedSecuritySchemes = computed(() => filterSelectedSecurity(__props.document, operation.value, __props.authStore.getAuthSelectedSchemas({
|
|
47
49
|
type: "document",
|
|
@@ -64,6 +66,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
64
66
|
operation: operation.value,
|
|
65
67
|
options: __props.options,
|
|
66
68
|
path: __props.path,
|
|
69
|
+
requiredSecurity: requiredSecurity.value,
|
|
67
70
|
selectedClient: __props.selectedClient,
|
|
68
71
|
selectedSecuritySchemes: selectedSecuritySchemes.value,
|
|
69
72
|
selectedServer: selectedServer.value
|
|
@@ -77,6 +80,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
77
80
|
"operation",
|
|
78
81
|
"options",
|
|
79
82
|
"path",
|
|
83
|
+
"requiredSecurity",
|
|
80
84
|
"selectedClient",
|
|
81
85
|
"selectedSecuritySchemes",
|
|
82
86
|
"selectedServer"
|
|
@@ -90,6 +94,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
90
94
|
operation: operation.value,
|
|
91
95
|
options: __props.options,
|
|
92
96
|
path: __props.path,
|
|
97
|
+
requiredSecurity: requiredSecurity.value,
|
|
93
98
|
selectedClient: __props.selectedClient,
|
|
94
99
|
selectedSecuritySchemes: selectedSecuritySchemes.value,
|
|
95
100
|
selectedServer: selectedServer.value
|
|
@@ -102,6 +107,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
102
107
|
"operation",
|
|
103
108
|
"options",
|
|
104
109
|
"path",
|
|
110
|
+
"requiredSecurity",
|
|
105
111
|
"selectedClient",
|
|
106
112
|
"selectedSecuritySchemes",
|
|
107
113
|
"selectedServer"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.script.js","names":[],"sources":["../../../src/features/Operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * References Operation \"block\"\n */\nexport default {}\n\nexport type OperationProps = {\n id: string\n method: HttpMethod\n /** The subset of the configuration object required for the operation component */\n options: Pick<\n ApiReferenceConfigurationRaw,\n | 'expandAllResponses'\n | 'hideModels'\n | 'hideTestRequestButton'\n | 'layout'\n | 'orderRequiredPropertiesFirst'\n | 'orderSchemaPropertiesBy'\n | 'showOperationId'\n >\n /** Document object */\n document: OpenApiDocument\n /** Key of the operations path in the document.paths object */\n path: string\n /** OpenAPI path object that will include the operation */\n pathValue: PathItemObject | undefined\n /** Currently selected server for the document */\n server: ServerObject | null\n /** The merged security schemes for the document and the authentication configuration */\n securitySchemes: MergedSecuritySchemes\n /** The http client options for the dropdown */\n clientOptions: ClientOptionGroup[]\n /** Whether the Classic layout operation is collapsed */\n isCollapsed: boolean\n /** Whether the operation is a webhook */\n isWebhook: boolean\n /** The currently selected client for the document */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** The event bus */\n eventBus: WorkspaceEventBus\n /** The auth store */\n authStore: AuthStore\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport type { ClientOptionGroup } from '@scalar/api-client/blocks/operation-code-sample'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n combineParams,\n type MergedSecuritySchemes,\n} from '@scalar/workspace-store/request-example'\nimport type {\n OpenApiDocument,\n PathItemObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { filterSelectedSecurity } from '@/features/Operation/helpers/filter-selected-security'\n\nimport { getFirstServer } from './helpers/get-first-server'\nimport ClassicLayout from './layouts/ClassicLayout.vue'\nimport ModernLayout from './layouts/ModernLayout.vue'\n\nconst {\n authStore,\n clientOptions,\n document,\n eventBus,\n isCollapsed,\n isWebhook,\n method,\n options,\n path,\n pathValue,\n securitySchemes,\n server,\n} = defineProps<OperationProps>()\n\n/**\n * Operation from the new workspace store, ensure we are de-reference\n *\n * Also adds in params from the pathItemObject\n */\nconst operation = computed(() => {\n const entity = getResolvedRef(pathValue?.[method])\n\n if (!entity) {\n return null\n }\n\n // Combine params from the pathItem and the operation\n const parameters = combineParams(pathValue?.parameters, entity.parameters)\n return { ...entity, parameters }\n})\n\n/**\n * Determine the effective server for the code examples.\n */\nconst selectedServer = computed<ServerObject | null>(() =>\n getFirstServer(\n // 1) Operation\n operation.value?.servers ?? null,\n // 2) Path Item\n pathValue?.servers ?? null,\n // 3) Document\n server,\n ),\n)\n\n/** We must ensure the selected security schemes are required on this operation */\nconst selectedSecuritySchemes = computed(() =>\n filterSelectedSecurity(\n document,\n operation.value,\n authStore.getAuthSelectedSchemas({\n type: 'document',\n documentName: document?.['x-scalar-navigation']?.name ?? '',\n }),\n authStore.getAuthSelectedSchemas({\n type: 'operation',\n documentName: document?.['x-scalar-navigation']?.name ?? '',\n path,\n method,\n }),\n securitySchemes,\n ),\n)\n</script>\n\n<template>\n <template v-if=\"operation\">\n <ClassicLayout\n v-if=\"options.layout === 'classic'\"\n :id\n :clientOptions\n :eventBus\n :isCollapsed\n :isWebhook\n :method\n :operation\n :options\n :path\n :selectedClient\n :selectedSecuritySchemes\n :selectedServer />\n <ModernLayout\n v-else\n :id\n :clientOptions\n :eventBus\n :isWebhook\n :method\n :operation\n :options\n :path\n :selectedClient\n :selectedSecuritySchemes\n :selectedServer />\n </template>\n</template>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Operation.vue.script.js","names":[],"sources":["../../../src/features/Operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * References Operation \"block\"\n */\nexport default {}\n\nexport type OperationProps = {\n id: string\n method: HttpMethod\n /** The subset of the configuration object required for the operation component */\n options: Pick<\n ApiReferenceConfigurationRaw,\n | 'expandAllResponses'\n | 'hideModels'\n | 'hideTestRequestButton'\n | 'layout'\n | 'orderRequiredPropertiesFirst'\n | 'orderSchemaPropertiesBy'\n | 'showOperationId'\n >\n /** Document object */\n document: OpenApiDocument\n /** Key of the operations path in the document.paths object */\n path: string\n /** OpenAPI path object that will include the operation */\n pathValue: PathItemObject | undefined\n /** Currently selected server for the document */\n server: ServerObject | null\n /** The merged security schemes for the document and the authentication configuration */\n securitySchemes: MergedSecuritySchemes\n /** The http client options for the dropdown */\n clientOptions: ClientOptionGroup[]\n /** Whether the Classic layout operation is collapsed */\n isCollapsed: boolean\n /** Whether the operation is a webhook */\n isWebhook: boolean\n /** The currently selected client for the document */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** The event bus */\n eventBus: WorkspaceEventBus\n /** The auth store */\n authStore: AuthStore\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport type { ClientOptionGroup } from '@scalar/api-client/blocks/operation-code-sample'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ApiReferenceConfigurationRaw } from '@scalar/types/api-reference'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { AuthStore } from '@scalar/workspace-store/entities/auth'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n combineParams,\n type MergedSecuritySchemes,\n} from '@scalar/workspace-store/request-example'\nimport type {\n OpenApiDocument,\n PathItemObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { filterSelectedSecurity } from '@/features/Operation/helpers/filter-selected-security'\n\nimport { getFirstServer } from './helpers/get-first-server'\nimport {\n getRequiredSecurity,\n type RequiredSecurity,\n} from './helpers/get-required-security'\nimport ClassicLayout from './layouts/ClassicLayout.vue'\nimport ModernLayout from './layouts/ModernLayout.vue'\n\nconst {\n authStore,\n clientOptions,\n document,\n eventBus,\n isCollapsed,\n isWebhook,\n method,\n options,\n path,\n pathValue,\n securitySchemes,\n server,\n} = defineProps<OperationProps>()\n\n/**\n * Operation from the new workspace store, ensure we are de-reference\n *\n * Also adds in params from the pathItemObject\n */\nconst operation = computed(() => {\n const entity = getResolvedRef(pathValue?.[method])\n\n if (!entity) {\n return null\n }\n\n // Combine params from the pathItem and the operation\n const parameters = combineParams(pathValue?.parameters, entity.parameters)\n return { ...entity, parameters }\n})\n\n/**\n * Determine the effective server for the code examples.\n */\nconst selectedServer = computed<ServerObject | null>(() =>\n getFirstServer(\n // 1) Operation\n operation.value?.servers ?? null,\n // 2) Path Item\n pathValue?.servers ?? null,\n // 3) Document\n server,\n ),\n)\n\nconst requiredSecurity = computed<RequiredSecurity>(() =>\n getRequiredSecurity(operation.value, document),\n)\n\n/** We must ensure the selected security schemes are required on this operation */\nconst selectedSecuritySchemes = computed(() =>\n filterSelectedSecurity(\n document,\n operation.value,\n authStore.getAuthSelectedSchemas({\n type: 'document',\n documentName: document?.['x-scalar-navigation']?.name ?? '',\n }),\n authStore.getAuthSelectedSchemas({\n type: 'operation',\n documentName: document?.['x-scalar-navigation']?.name ?? '',\n path,\n method,\n }),\n securitySchemes,\n ),\n)\n</script>\n\n<template>\n <template v-if=\"operation\">\n <ClassicLayout\n v-if=\"options.layout === 'classic'\"\n :id\n :clientOptions\n :eventBus\n :isCollapsed\n :isWebhook\n :method\n :operation\n :options\n :path\n :requiredSecurity\n :selectedClient\n :selectedSecuritySchemes\n :selectedServer />\n <ModernLayout\n v-else\n :id\n :clientOptions\n :eventBus\n :isWebhook\n :method\n :operation\n :options\n :path\n :requiredSecurity\n :selectedClient\n :selectedSecuritySchemes\n :selectedServer />\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8FA,MAAM,YAAY,eAAe;GAC/B,MAAM,SAAS,eAAe,QAAA,YAAY,QAAA,QAAO;AAEjD,OAAI,CAAC,OACH,QAAO;GAIT,MAAM,aAAa,cAAc,QAAA,WAAW,YAAY,OAAO,WAAU;AACzE,UAAO;IAAE,GAAG;IAAQ;IAAW;IAChC;;;;EAKD,MAAM,iBAAiB,eACrB,eAEE,UAAU,OAAO,WAAW,MAE5B,QAAA,WAAW,WAAW,MAEtB,QAAA,OACD,CACH;EAEA,MAAM,mBAAmB,eACvB,oBAAoB,UAAU,OAAO,QAAA,SAAS,CAChD;;EAGA,MAAM,0BAA0B,eAC9B,uBACE,QAAA,UACA,UAAU,OACV,QAAA,UAAU,uBAAuB;GAC/B,MAAM;GACN,cAAc,QAAA,WAAW,wBAAwB,QAAQ;GAC1D,CAAC,EACF,QAAA,UAAU,uBAAuB;GAC/B,MAAM;GACN,cAAc,QAAA,WAAW,wBAAwB,QAAQ;GACzD,MAAG,QAAA;GACH,QAAK,QAAA;GACN,CAAC,EACF,QAAA,gBACD,CACH;;UAIkB,UAAA,SAAA,WAAA,EAAhB,mBA8BW,UAAA,EAAA,KAAA,GAAA,EAAA,CA5BD,QAAA,QAAQ,WAAM,aAAA,WAAA,EADtB,YAcoB,uBAAA;;IAZjB,IAAA,QAAA;IACA,eAAA,QAAA;IACA,UAAA,QAAA;IACA,aAAA,QAAA;IACA,WAAA,QAAA;IACA,QAAA,QAAA;IACA,WAAA,UAAA;IACA,SAAA,QAAA;IACA,MAAA,QAAA;IACA,kBAAA,iBAAA;IACA,gBAAA,QAAA;IACA,yBAAA,wBAAA;IACA,gBAAA,eAAA;;;;;;;;;;;;;;;uBACH,YAaoB,sBAAA;;IAXjB,IAAA,QAAA;IACA,eAAA,QAAA;IACA,UAAA,QAAA;IACA,WAAA,QAAA;IACA,QAAA,QAAA;IACA,WAAA,UAAA;IACA,SAAA,QAAA;IACA,MAAA,QAAA;IACA,kBAAA,iBAAA;IACA,gBAAA,QAAA;IACA,yBAAA,wBAAA;IACA,gBAAA,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationParameters.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/OperationParameters.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OperationParameters.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/OperationParameters.vue"],"names":[],"mappings":"AA2GA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAKrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAKxE,KAAK,WAAW,GAAG;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,UAAU,CAAC,EAAE,aAAa,CAAC,eAAe,CAAC,EAAE,CAAA;IAC7C,WAAW,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAA;IAC3C,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE,IAAI,CACX,cAAc,CAAC,SAAS,CAAC,EACzB,YAAY,GAAG,8BAA8B,GAAG,yBAAyB,CAC1E,CAAA;CACF,CAAC;AAiCF,KAAK,gBAAgB,GAAG;IACxB,qEAAqE;IACrE,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AA4IxD,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationParameters.vue.js","names":[],"sources":["../../../../src/features/Operation/components/OperationParameters.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ReferenceType,\n RequestBodyObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { shouldIgnoreEntity } from '@/features/Operation/helpers/should-ignore-entity'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ParameterList from './ParameterList.vue'\nimport RequestBody from './RequestBody.vue'\n\nconst { parameters = [], requestBody } = defineProps<{\n breadcrumb?: string[]\n parameters?: ReferenceType<ParameterObject>[]\n requestBody?: RequestBodyObject | undefined\n eventBus: WorkspaceEventBus | null\n options: Pick<\n OperationProps['options'],\n 'hideModels' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Thread the selected request body content type up to the layout */\nconst selectedContentType = defineModel<string>('selectedContentType')\n\n/** Use a single loop to reduce parameters by type(in) */\nconst splitParameters = computed(() =>\n (parameters ?? []).reduce(\n (acc, p) => {\n const parameter = getResolvedRef(p)\n // Filter out ignored parameters\n if (!shouldIgnoreEntity(parameter)) {\n acc[
|
|
1
|
+
{"version":3,"file":"OperationParameters.vue.js","names":[],"sources":["../../../../src/features/Operation/components/OperationParameters.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ReferenceType,\n RequestBodyObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { flattenDeepObjectQueryParameter } from '@/features/Operation/helpers/flatten-deep-object-query-parameter'\nimport { shouldIgnoreEntity } from '@/features/Operation/helpers/should-ignore-entity'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ParameterList from './ParameterList.vue'\nimport RequestBody from './RequestBody.vue'\n\nconst { parameters = [], requestBody } = defineProps<{\n breadcrumb?: string[]\n parameters?: ReferenceType<ParameterObject>[]\n requestBody?: RequestBodyObject | undefined\n eventBus: WorkspaceEventBus | null\n options: Pick<\n OperationProps['options'],\n 'hideModels' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Thread the selected request body content type up to the layout */\nconst selectedContentType = defineModel<string>('selectedContentType')\n\ntype ParameterLocation = 'cookie' | 'header' | 'path' | 'query'\n\n/** Use a single loop to reduce parameters by type(in) */\nconst splitParameters = computed(() =>\n (parameters ?? []).reduce(\n (acc, p) => {\n const parameter = getResolvedRef(p)\n // Filter out ignored parameters\n if (!shouldIgnoreEntity(parameter)) {\n const flattenedParameters = flattenDeepObjectQueryParameter(parameter)\n flattenedParameters.forEach((flattenedParameter) => {\n acc[flattenedParameter.in as ParameterLocation].push(\n flattenedParameter,\n )\n })\n }\n return acc\n },\n { cookie: [], header: [], path: [], query: [] } as Record<\n 'cookie' | 'header' | 'path' | 'query',\n ParameterObject[]\n >,\n ),\n)\n</script>\n<template>\n <!-- Path parameters-->\n <ParameterList\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'path'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :parameters=\"splitParameters['path']\">\n <template #title>Path Parameters</template>\n </ParameterList>\n\n <!-- Query parameters -->\n <ParameterList\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'query'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :parameters=\"splitParameters['query']\">\n <template #title>Query Parameters</template>\n </ParameterList>\n\n <!-- Headers -->\n <ParameterList\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'headers'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :parameters=\"splitParameters['header']\">\n <template #title>Headers</template>\n </ParameterList>\n\n <!-- Cookies -->\n <ParameterList\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'cookies'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :parameters=\"splitParameters['cookie']\">\n <template #title>Cookies</template>\n </ParameterList>\n\n <!-- Request body -->\n <RequestBody\n v-if=\"requestBody\"\n v-model:selectedContentType=\"selectedContentType\"\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'body'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :requestBody=\"requestBody\">\n <template #title>Body</template>\n </RequestBody>\n</template>\n"],"mappings":""}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { flattenDeepObjectQueryParameter } from "../helpers/flatten-deep-object-query-parameter.js";
|
|
1
2
|
import { shouldIgnoreEntity } from "../helpers/should-ignore-entity.js";
|
|
2
3
|
import ParameterList_default from "./ParameterList.vue.js";
|
|
3
4
|
import RequestBody_default from "./RequestBody.vue.js";
|
|
4
5
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, useModel, withCtx } from "vue";
|
|
5
6
|
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
6
7
|
//#region src/features/Operation/components/OperationParameters.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
/** Use a single loop to reduce parameters by type(in) */
|
|
7
9
|
var OperationParameters_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
8
10
|
__name: "OperationParameters",
|
|
9
11
|
props: /* @__PURE__ */ mergeModels({
|
|
@@ -20,10 +22,11 @@ var OperationParameters_vue_vue_type_script_setup_true_lang_default = /* @__PURE
|
|
|
20
22
|
setup(__props) {
|
|
21
23
|
/** Thread the selected request body content type up to the layout */
|
|
22
24
|
const selectedContentType = useModel(__props, "selectedContentType");
|
|
23
|
-
/** Use a single loop to reduce parameters by type(in) */
|
|
24
25
|
const splitParameters = computed(() => (__props.parameters ?? []).reduce((acc, p) => {
|
|
25
26
|
const parameter = getResolvedRef(p);
|
|
26
|
-
if (!shouldIgnoreEntity(parameter))
|
|
27
|
+
if (!shouldIgnoreEntity(parameter)) flattenDeepObjectQueryParameter(parameter).forEach((flattenedParameter) => {
|
|
28
|
+
acc[flattenedParameter.in].push(flattenedParameter);
|
|
29
|
+
});
|
|
27
30
|
return acc;
|
|
28
31
|
}, {
|
|
29
32
|
cookie: [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationParameters.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/OperationParameters.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ReferenceType,\n RequestBodyObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { shouldIgnoreEntity } from '@/features/Operation/helpers/should-ignore-entity'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ParameterList from './ParameterList.vue'\nimport RequestBody from './RequestBody.vue'\n\nconst { parameters = [], requestBody } = defineProps<{\n breadcrumb?: string[]\n parameters?: ReferenceType<ParameterObject>[]\n requestBody?: RequestBodyObject | undefined\n eventBus: WorkspaceEventBus | null\n options: Pick<\n OperationProps['options'],\n 'hideModels' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Thread the selected request body content type up to the layout */\nconst selectedContentType = defineModel<string>('selectedContentType')\n\n/** Use a single loop to reduce parameters by type(in) */\nconst splitParameters = computed(() =>\n (parameters ?? []).reduce(\n (acc, p) => {\n const parameter = getResolvedRef(p)\n // Filter out ignored parameters\n if (!shouldIgnoreEntity(parameter)) {\n acc[
|
|
1
|
+
{"version":3,"file":"OperationParameters.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/OperationParameters.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ReferenceType,\n RequestBodyObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { flattenDeepObjectQueryParameter } from '@/features/Operation/helpers/flatten-deep-object-query-parameter'\nimport { shouldIgnoreEntity } from '@/features/Operation/helpers/should-ignore-entity'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ParameterList from './ParameterList.vue'\nimport RequestBody from './RequestBody.vue'\n\nconst { parameters = [], requestBody } = defineProps<{\n breadcrumb?: string[]\n parameters?: ReferenceType<ParameterObject>[]\n requestBody?: RequestBodyObject | undefined\n eventBus: WorkspaceEventBus | null\n options: Pick<\n OperationProps['options'],\n 'hideModels' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Thread the selected request body content type up to the layout */\nconst selectedContentType = defineModel<string>('selectedContentType')\n\ntype ParameterLocation = 'cookie' | 'header' | 'path' | 'query'\n\n/** Use a single loop to reduce parameters by type(in) */\nconst splitParameters = computed(() =>\n (parameters ?? []).reduce(\n (acc, p) => {\n const parameter = getResolvedRef(p)\n // Filter out ignored parameters\n if (!shouldIgnoreEntity(parameter)) {\n const flattenedParameters = flattenDeepObjectQueryParameter(parameter)\n flattenedParameters.forEach((flattenedParameter) => {\n acc[flattenedParameter.in as ParameterLocation].push(\n flattenedParameter,\n )\n })\n }\n return acc\n },\n { cookie: [], header: [], path: [], query: [] } as Record<\n 'cookie' | 'header' | 'path' | 'query',\n ParameterObject[]\n >,\n ),\n)\n</script>\n<template>\n <!-- Path parameters-->\n <ParameterList\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'path'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :parameters=\"splitParameters['path']\">\n <template #title>Path Parameters</template>\n </ParameterList>\n\n <!-- Query parameters -->\n <ParameterList\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'query'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :parameters=\"splitParameters['query']\">\n <template #title>Query Parameters</template>\n </ParameterList>\n\n <!-- Headers -->\n <ParameterList\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'headers'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :parameters=\"splitParameters['header']\">\n <template #title>Headers</template>\n </ParameterList>\n\n <!-- Cookies -->\n <ParameterList\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'cookies'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :parameters=\"splitParameters['cookie']\">\n <template #title>Cookies</template>\n </ParameterList>\n\n <!-- Request body -->\n <RequestBody\n v-if=\"requestBody\"\n v-model:selectedContentType=\"selectedContentType\"\n :breadcrumb=\"breadcrumb ? [...breadcrumb, 'body'] : undefined\"\n :eventBus=\"eventBus\"\n :options=\"options\"\n :requestBody=\"requestBody\">\n <template #title>Body</template>\n </RequestBody>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EA6BA,MAAM,sBAAsB,SAAmB,SAAC,sBAAqB;EAKrE,MAAM,kBAAkB,gBACrB,QAAA,cAAc,EAAE,EAAE,QAChB,KAAK,MAAM;GACV,MAAM,YAAY,eAAe,EAAC;AAElC,OAAI,CAAC,mBAAmB,UAAU,CACJ,iCAAgC,UAAS,CACjD,SAAS,uBAAuB;AAClD,QAAI,mBAAmB,IAAyB,KAC9C,mBACF;KACD;AAEH,UAAO;KAET;GAAE,QAAQ,EAAE;GAAE,QAAQ,EAAE;GAAE,MAAM,EAAE;GAAE,OAAO,EAAE;GAAE,CAIhD,CACH;;;IAIE,YAMgB,uBAAA;KALb,YAAY,QAAA,aAAU,CAAA,GAAO,QAAA,YAAU,OAAA,GAAY,KAAA;KACnD,UAAU,QAAA;KACV,SAAS,QAAA;KACT,YAAY,gBAAA,MAAe;;KACjB,OAAK,cAAgB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAf,mBAAe,GAAA,CAAA,EAAA,CAAA;;;;;;;;IAIlC,YAMgB,uBAAA;KALb,YAAY,QAAA,aAAU,CAAA,GAAO,QAAA,YAAU,QAAA,GAAa,KAAA;KACpD,UAAU,QAAA;KACV,SAAS,QAAA;KACT,YAAY,gBAAA,MAAe;;KACjB,OAAK,cAAiB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAhB,oBAAgB,GAAA,CAAA,EAAA,CAAA;;;;;;;;IAInC,YAMgB,uBAAA;KALb,YAAY,QAAA,aAAU,CAAA,GAAO,QAAA,YAAU,UAAA,GAAe,KAAA;KACtD,UAAU,QAAA;KACV,SAAS,QAAA;KACT,YAAY,gBAAA,MAAe;;KACjB,OAAK,cAAQ,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;;;;;;;;IAI1B,YAMgB,uBAAA;KALb,YAAY,QAAA,aAAU,CAAA,GAAO,QAAA,YAAU,UAAA,GAAe,KAAA;KACtD,UAAU,QAAA;KACV,SAAS,QAAA;KACT,YAAY,gBAAA,MAAe;;KACjB,OAAK,cAAQ,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;;;;;;;;IAKlB,QAAA,eAAA,WAAA,EADR,YAQc,qBAAA;;KANJ,qBAAqB,oBAAA;+FAAmB,QAAA;KAC/C,YAAY,QAAA,aAAU,CAAA,GAAO,QAAA,YAAU,OAAA,GAAY,KAAA;KACnD,UAAU,QAAA;KACV,SAAS,QAAA;KACT,aAAa,QAAA;;KACH,OAAK,cAAK,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAJ,QAAI,GAAA,CAAA,EAAA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterListItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParameterListItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"names":[],"mappings":"AAsUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEf,MAAM,8DAA8D,CAAA;AAKrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAMxE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,GAAG,cAAc,CAAA;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,IAAI,CACX,cAAc,CAAC,SAAS,CAAC,EACzB,YAAY,GAAG,8BAA8B,GAAG,yBAAyB,CAC1E,CAAA;CACF,CAAC;AAsYF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
|
|
|
2
2
|
import ParameterListItem_vue_vue_type_script_setup_true_lang_default from "./ParameterListItem.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/features/Operation/components/ParameterListItem.vue
|
|
5
|
-
var ParameterListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ParameterListItem_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var ParameterListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ParameterListItem_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-a268dcf7"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ParameterListItem_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterListItem.vue.js","names":[],"sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarMarkdown,\n ScalarMarkdownSummary,\n ScalarWrappingText,\n} from '@scalar/components'\nimport { ScalarIconCaretRight } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ResponseObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { getRefName } from '@/components/Content/Schema/helpers/get-ref-name'\nimport SchemaProperty from '@/components/Content/Schema/SchemaProperty.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\nimport Headers from './Headers.vue'\n\nconst { name, parameter, options, collapsableItems } = defineProps<{\n parameter: ParameterObject | ResponseObject\n name: string\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n collapsableItems?: boolean\n options: Pick<\n OperationProps['options'],\n 'hideModels' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Whether the markdown summary is being truncated */\nconst truncated = ref(false)\n\n/** Responses and params may both have a schema */\nconst schema = computed<SchemaObject | null>(() =>\n 'schema' in parameter && parameter.schema\n ? getResolvedRef(parameter.schema)\n : null,\n)\n\n/** Response and params may both have content */\nconst content = computed(() => {\n if (!('content' in parameter) || !parameter.content) {\n return null\n }\n const keys = Object.keys(parameter.content)\n if (keys.length === 0) {\n return null\n }\n return parameter.content\n})\n\nconst selectedContentType = ref<string>(\n Object.keys(content.value || {})[0] ?? '',\n)\n\n/** Response headers */\nconst headers = computed<ResponseObject['headers'] | null>(() =>\n 'headers' in parameter && parameter.headers ? parameter.headers : null,\n)\n\n/** Raw schema (possibly with $ref) for the selected content type or param. */\nconst baseSchema = computed(() =>\n content.value\n ? content.value?.[selectedContentType.value]?.schema\n : 'schema' in parameter && parameter.schema\n ? parameter.schema\n : null,\n)\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(() => {\n const raw = baseSchema.value\n if (!raw) {\n return null\n }\n\n if ('$ref' in raw) {\n return getRefName(raw.$ref)\n }\n\n return null\n})\n\n/** Computed value from the combined schema param and content param */\nconst value = computed(() => {\n const base = baseSchema.value\n const resolvedBase = content.value ? getResolvedRef(base) : schema.value\n\n const deprecated =\n 'deprecated' in parameter ? parameter.deprecated : schema.value?.deprecated\n\n // Convert examples to schema examples which is an array\n const paramExamples = 'examples' in parameter ? parameter.examples : {}\n const recordExamples = Object.values({\n ...paramExamples,\n ...content.value?.[selectedContentType.value]?.examples,\n })\n\n // Only use parameter.example as fallback if no other examples exist\n const arrayExamples =\n schema.value?.examples ??\n (recordExamples.length === 0 && 'example' in parameter\n ? [parameter.example]\n : [])\n\n /** Combine param examples with content ones */\n const examples = [...recordExamples, ...arrayExamples]\n\n return {\n ...resolvedBase,\n deprecated: deprecated,\n examples,\n } as SchemaObject\n})\n\n/**\n * Determines whether this parameter item should be rendered as a collapsible disclosure.\n * Only collapses when collapsableItems is enabled and the parameter has additional\n * content to display (content types, headers, or schema details).\n */\nconst shouldCollapse = computed<boolean>(() =>\n Boolean(content.value || headers.value || schema.value || truncated.value),\n)\n</script>\n<template>\n <li class=\"parameter-item group/parameter-item\">\n <Disclosure v-slot=\"{ open }\">\n <component\n :is=\"shouldCollapse ? DisclosureButton : 'div'\"\n v-if=\"collapsableItems\"\n class=\"parameter-item-trigger\"\n :class=\"{ 'parameter-item-trigger-open': open }\">\n <div class=\"parameter-item-name min-w-0\">\n <ScalarIconCaretRight\n v-if=\"shouldCollapse\"\n class=\"parameter-item-icon size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-90': open }\"\n weight=\"bold\" />\n <div>\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </div>\n </div>\n <ScalarMarkdownSummary\n v-if=\"!open && parameter.description\"\n v-model:truncated=\"truncated\"\n class=\"parameter-item-description-summary min-w-0 flex-1\"\n controlled\n :value=\"parameter.description\" />\n <div\n v-else\n class=\"flex-1\" />\n </component>\n <div\n v-if=\"shouldCollapse && content\"\n class=\"absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base\"\n :class=\"{\n 'opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100':\n !open,\n }\">\n <div\n class=\"from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent\" />\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"content\" />\n </div>\n <DisclosurePanel\n class=\"parameter-item-container parameter-item-container-markdown\"\n :static=\"!collapsableItems\">\n <ScalarMarkdown\n v-if=\"collapsableItems && parameter.description\"\n class=\"parameter-item-description\"\n :value=\"parameter.description\" />\n <!-- Headers -->\n <Headers\n v-if=\"headers\"\n :breadcrumb=\"breadcrumb\"\n :eventBus=\"eventBus\"\n :headers=\"headers\"\n :orderRequiredPropertiesFirst=\"options.orderRequiredPropertiesFirst\"\n :orderSchemaPropertiesBy=\"options.orderSchemaPropertiesBy\" />\n\n <!-- Schema -->\n <SchemaProperty\n is=\"div\"\n :breadcrumb=\"breadcrumb\"\n compact\n :description=\"collapsableItems ? '' : parameter.description\"\n :eventBus=\"eventBus\"\n :hideWriteOnly=\"true\"\n :modelName=\"schemaModelName\"\n :name=\"collapsableItems ? '' : name\"\n :noncollapsible=\"true\"\n :options=\"{\n hideWriteOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :required=\"'required' in parameter && parameter.required\"\n :schema=\"value\" />\n </DisclosurePanel>\n </Disclosure>\n </li>\n</template>\n\n<style scoped>\n.parameter-item {\n display: flex;\n flex-direction: column;\n position: relative;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item:last-of-type .parameter-schema {\n padding-bottom: 0;\n}\n\n.parameter-item-container {\n padding: 0;\n}\n\n.parameter-item-headers {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item-name {\n position: relative;\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n overflow-wrap: break-word;\n}\n\n.parameter-item-description,\n.parameter-item-description-summary {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n}\n\n.parameter-item-description-summary.parameter-item-description-summary > * {\n --markdown-line-height: var(--scalar-line-height-5);\n}\n\n/* Match font size of markdown for property-detail-value since first child within accordian is displayed as if it were in the markdown section */\n.parameter-item-trigger\n ~ .parameter-item-container\n :deep(.property--level-0 > .property-heading .property-detail-value) {\n font-size: var(--scalar-micro);\n}\n\n.parameter-item-required-optional {\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n margin-right: 6px;\n position: relative;\n}\n\n.parameter-item--required {\n text-transform: uppercase;\n font-size: var(--scalar-micro);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-orange);\n}\n\n.parameter-item-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-item-description :deep(p) {\n margin-top: 4px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-schema {\n padding-bottom: 9px;\n margin-top: 3px;\n}\n\n.parameter-item-trigger {\n display: flex;\n align-items: baseline;\n line-height: var(--scalar-line-height-5);\n gap: 6px;\n flex-wrap: wrap;\n padding: 10px 0;\n outline: none;\n}\n\n.parameter-item-trigger-open {\n padding-bottom: 0;\n}\n\n.parameter-item-icon {\n color: var(--scalar-color-3);\n left: -19px;\n top: 0.5lh;\n translate: 0 -50%;\n position: absolute;\n}\n\n.parameter-item-trigger:hover .parameter-item-icon,\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n color: var(--scalar-color-1);\n}\n\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n outline: 1px solid var(--scalar-color-accent);\n outline-offset: 2px;\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ParameterListItem.vue.js","names":[],"sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarMarkdown,\n ScalarMarkdownSummary,\n ScalarWrappingText,\n} from '@scalar/components'\nimport { ScalarIconCaretRight } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ResponseObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { getRefName } from '@/components/Content/Schema/helpers/get-ref-name'\nimport SchemaProperty from '@/components/Content/Schema/SchemaProperty.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\nimport Headers from './Headers.vue'\nimport { getParameterExamples } from './helpers/get-parameter-examples'\n\nconst { name, parameter, options, collapsableItems } = defineProps<{\n parameter: ParameterObject | ResponseObject\n name: string\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n collapsableItems?: boolean\n options: Pick<\n OperationProps['options'],\n 'hideModels' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Whether the markdown summary is being truncated */\nconst truncated = ref(false)\n\n/** Responses and params may both have a schema */\nconst schema = computed<SchemaObject | null>(() =>\n 'schema' in parameter && parameter.schema\n ? getResolvedRef(parameter.schema)\n : null,\n)\n\n/** Response and params may both have content */\nconst content = computed(() => {\n if (!('content' in parameter) || !parameter.content) {\n return null\n }\n const keys = Object.keys(parameter.content)\n if (keys.length === 0) {\n return null\n }\n return parameter.content\n})\n\nconst selectedContentType = ref<string>(\n Object.keys(content.value || {})[0] ?? '',\n)\n\n/** Response headers */\nconst headers = computed<ResponseObject['headers'] | null>(() =>\n 'headers' in parameter && parameter.headers ? parameter.headers : null,\n)\n\n/** Raw schema (possibly with $ref) for the selected content type or param. */\nconst baseSchema = computed(() =>\n content.value\n ? content.value?.[selectedContentType.value]?.schema\n : 'schema' in parameter && parameter.schema\n ? parameter.schema\n : null,\n)\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(() => {\n const raw = baseSchema.value\n if (!raw) {\n return null\n }\n\n if ('$ref' in raw) {\n return getRefName(raw.$ref)\n }\n\n return null\n})\n\n/** Computed value from the combined schema param and content param */\nconst value = computed(() => {\n const base = baseSchema.value\n const resolvedBase = content.value ? getResolvedRef(base) : schema.value\n\n const deprecated =\n 'deprecated' in parameter ? parameter.deprecated : schema.value?.deprecated\n\n /** Combine param/content/schema examples while ignoring undefined values. */\n const examples = getParameterExamples({\n parameter,\n schemaExamples: schema.value?.examples,\n contentExamples: content.value?.[selectedContentType.value]?.examples,\n })\n\n return {\n ...resolvedBase,\n deprecated: deprecated,\n examples,\n } as SchemaObject\n})\n\n/**\n * Determines whether this parameter item should be rendered as a collapsible disclosure.\n * Only collapses when collapsableItems is enabled and the parameter has additional\n * content to display (content types, headers, or schema details).\n */\nconst shouldCollapse = computed<boolean>(() =>\n Boolean(content.value || headers.value || schema.value || truncated.value),\n)\n</script>\n<template>\n <li class=\"parameter-item group/parameter-item\">\n <Disclosure v-slot=\"{ open }\">\n <component\n :is=\"shouldCollapse ? DisclosureButton : 'div'\"\n v-if=\"collapsableItems\"\n class=\"parameter-item-trigger\"\n :class=\"{ 'parameter-item-trigger-open': open }\">\n <div class=\"parameter-item-name min-w-0\">\n <ScalarIconCaretRight\n v-if=\"shouldCollapse\"\n class=\"parameter-item-icon size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-90': open }\"\n weight=\"bold\" />\n <div>\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </div>\n </div>\n <ScalarMarkdownSummary\n v-if=\"!open && parameter.description\"\n v-model:truncated=\"truncated\"\n class=\"parameter-item-description-summary min-w-0 flex-1\"\n controlled\n :value=\"parameter.description\" />\n <div\n v-else\n class=\"flex-1\" />\n </component>\n <div\n v-if=\"shouldCollapse && content\"\n class=\"absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base\"\n :class=\"{\n 'opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100':\n !open,\n }\">\n <div\n class=\"from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent\" />\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"content\" />\n </div>\n <DisclosurePanel\n class=\"parameter-item-container parameter-item-container-markdown\"\n :static=\"!collapsableItems\">\n <ScalarMarkdown\n v-if=\"collapsableItems && parameter.description\"\n class=\"parameter-item-description\"\n :value=\"parameter.description\" />\n <!-- Headers -->\n <Headers\n v-if=\"headers\"\n :breadcrumb=\"breadcrumb\"\n :eventBus=\"eventBus\"\n :headers=\"headers\"\n :orderRequiredPropertiesFirst=\"options.orderRequiredPropertiesFirst\"\n :orderSchemaPropertiesBy=\"options.orderSchemaPropertiesBy\" />\n\n <!-- Schema -->\n <SchemaProperty\n is=\"div\"\n :breadcrumb=\"breadcrumb\"\n compact\n :description=\"collapsableItems ? '' : parameter.description\"\n :eventBus=\"eventBus\"\n :hideWriteOnly=\"true\"\n :modelName=\"schemaModelName\"\n :name=\"collapsableItems ? '' : name\"\n :noncollapsible=\"true\"\n :options=\"{\n hideWriteOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :required=\"'required' in parameter && parameter.required\"\n :schema=\"value\" />\n </DisclosurePanel>\n </Disclosure>\n </li>\n</template>\n\n<style scoped>\n.parameter-item {\n display: flex;\n flex-direction: column;\n position: relative;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item:last-of-type .parameter-schema {\n padding-bottom: 0;\n}\n\n.parameter-item-container {\n padding: 0;\n}\n\n.parameter-item-headers {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item-name {\n position: relative;\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n overflow-wrap: break-word;\n}\n\n.parameter-item-description,\n.parameter-item-description-summary {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n}\n\n.parameter-item-description-summary.parameter-item-description-summary > * {\n --markdown-line-height: var(--scalar-line-height-5);\n}\n\n/* Match font size of markdown for property-detail-value since first child within accordian is displayed as if it were in the markdown section */\n.parameter-item-trigger\n ~ .parameter-item-container\n :deep(.property--level-0 > .property-heading .property-detail-value) {\n font-size: var(--scalar-micro);\n}\n\n.parameter-item-required-optional {\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n margin-right: 6px;\n position: relative;\n}\n\n.parameter-item--required {\n text-transform: uppercase;\n font-size: var(--scalar-micro);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-orange);\n}\n\n.parameter-item-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-item-description :deep(p) {\n margin-top: 4px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-schema {\n padding-bottom: 9px;\n margin-top: 3px;\n}\n\n.parameter-item-trigger {\n display: flex;\n align-items: baseline;\n line-height: var(--scalar-line-height-5);\n gap: 6px;\n flex-wrap: wrap;\n padding: 10px 0;\n outline: none;\n}\n\n.parameter-item-trigger-open {\n padding-bottom: 0;\n}\n\n.parameter-item-icon {\n color: var(--scalar-color-3);\n left: -19px;\n top: 0.5lh;\n translate: 0 -50%;\n position: absolute;\n}\n\n.parameter-item-trigger:hover .parameter-item-icon,\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n color: var(--scalar-color-1);\n}\n\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n outline: 1px solid var(--scalar-color-accent);\n outline-offset: 2px;\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":""}
|
|
@@ -2,6 +2,7 @@ import { getRefName } from "../../../components/Content/Schema/helpers/get-ref-n
|
|
|
2
2
|
import SchemaProperty_default from "../../../components/Content/Schema/SchemaProperty.vue.js";
|
|
3
3
|
import ContentTypeSelect_default from "./ContentTypeSelect.vue.js";
|
|
4
4
|
import Headers_default from "./Headers.vue.js";
|
|
5
|
+
import { getParameterExamples } from "./helpers/get-parameter-examples.js";
|
|
5
6
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, resolveDynamicComponent, unref, withCtx } from "vue";
|
|
6
7
|
import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/vue";
|
|
7
8
|
import { ScalarMarkdown, ScalarMarkdownSummary, ScalarWrappingText } from "@scalar/components";
|
|
@@ -52,14 +53,12 @@ var ParameterListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
|
|
|
52
53
|
const base = baseSchema.value;
|
|
53
54
|
const resolvedBase = content.value ? getResolvedRef(base) : schema.value;
|
|
54
55
|
const deprecated = "deprecated" in __props.parameter ? __props.parameter.deprecated : schema.value?.deprecated;
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
/** Combine param/content/schema examples while ignoring undefined values. */
|
|
57
|
+
const examples = getParameterExamples({
|
|
58
|
+
parameter: __props.parameter,
|
|
59
|
+
schemaExamples: schema.value?.examples,
|
|
60
|
+
contentExamples: content.value?.[selectedContentType.value]?.examples
|
|
59
61
|
});
|
|
60
|
-
const arrayExamples = schema.value?.examples ?? (recordExamples.length === 0 && "example" in __props.parameter ? [__props.parameter.example] : []);
|
|
61
|
-
/** Combine param examples with content ones */
|
|
62
|
-
const examples = [...recordExamples, ...arrayExamples];
|
|
63
62
|
return {
|
|
64
63
|
...resolvedBase,
|
|
65
64
|
deprecated,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParameterListItem.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarMarkdown,\n ScalarMarkdownSummary,\n ScalarWrappingText,\n} from '@scalar/components'\nimport { ScalarIconCaretRight } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ResponseObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { getRefName } from '@/components/Content/Schema/helpers/get-ref-name'\nimport SchemaProperty from '@/components/Content/Schema/SchemaProperty.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\nimport Headers from './Headers.vue'\n\nconst { name, parameter, options, collapsableItems } = defineProps<{\n parameter: ParameterObject | ResponseObject\n name: string\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n collapsableItems?: boolean\n options: Pick<\n OperationProps['options'],\n 'hideModels' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Whether the markdown summary is being truncated */\nconst truncated = ref(false)\n\n/** Responses and params may both have a schema */\nconst schema = computed<SchemaObject | null>(() =>\n 'schema' in parameter && parameter.schema\n ? getResolvedRef(parameter.schema)\n : null,\n)\n\n/** Response and params may both have content */\nconst content = computed(() => {\n if (!('content' in parameter) || !parameter.content) {\n return null\n }\n const keys = Object.keys(parameter.content)\n if (keys.length === 0) {\n return null\n }\n return parameter.content\n})\n\nconst selectedContentType = ref<string>(\n Object.keys(content.value || {})[0] ?? '',\n)\n\n/** Response headers */\nconst headers = computed<ResponseObject['headers'] | null>(() =>\n 'headers' in parameter && parameter.headers ? parameter.headers : null,\n)\n\n/** Raw schema (possibly with $ref) for the selected content type or param. */\nconst baseSchema = computed(() =>\n content.value\n ? content.value?.[selectedContentType.value]?.schema\n : 'schema' in parameter && parameter.schema\n ? parameter.schema\n : null,\n)\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(() => {\n const raw = baseSchema.value\n if (!raw) {\n return null\n }\n\n if ('$ref' in raw) {\n return getRefName(raw.$ref)\n }\n\n return null\n})\n\n/** Computed value from the combined schema param and content param */\nconst value = computed(() => {\n const base = baseSchema.value\n const resolvedBase = content.value ? getResolvedRef(base) : schema.value\n\n const deprecated =\n 'deprecated' in parameter ? parameter.deprecated : schema.value?.deprecated\n\n // Convert examples to schema examples which is an array\n const paramExamples = 'examples' in parameter ? parameter.examples : {}\n const recordExamples = Object.values({\n ...paramExamples,\n ...content.value?.[selectedContentType.value]?.examples,\n })\n\n // Only use parameter.example as fallback if no other examples exist\n const arrayExamples =\n schema.value?.examples ??\n (recordExamples.length === 0 && 'example' in parameter\n ? [parameter.example]\n : [])\n\n /** Combine param examples with content ones */\n const examples = [...recordExamples, ...arrayExamples]\n\n return {\n ...resolvedBase,\n deprecated: deprecated,\n examples,\n } as SchemaObject\n})\n\n/**\n * Determines whether this parameter item should be rendered as a collapsible disclosure.\n * Only collapses when collapsableItems is enabled and the parameter has additional\n * content to display (content types, headers, or schema details).\n */\nconst shouldCollapse = computed<boolean>(() =>\n Boolean(content.value || headers.value || schema.value || truncated.value),\n)\n</script>\n<template>\n <li class=\"parameter-item group/parameter-item\">\n <Disclosure v-slot=\"{ open }\">\n <component\n :is=\"shouldCollapse ? DisclosureButton : 'div'\"\n v-if=\"collapsableItems\"\n class=\"parameter-item-trigger\"\n :class=\"{ 'parameter-item-trigger-open': open }\">\n <div class=\"parameter-item-name min-w-0\">\n <ScalarIconCaretRight\n v-if=\"shouldCollapse\"\n class=\"parameter-item-icon size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-90': open }\"\n weight=\"bold\" />\n <div>\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </div>\n </div>\n <ScalarMarkdownSummary\n v-if=\"!open && parameter.description\"\n v-model:truncated=\"truncated\"\n class=\"parameter-item-description-summary min-w-0 flex-1\"\n controlled\n :value=\"parameter.description\" />\n <div\n v-else\n class=\"flex-1\" />\n </component>\n <div\n v-if=\"shouldCollapse && content\"\n class=\"absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base\"\n :class=\"{\n 'opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100':\n !open,\n }\">\n <div\n class=\"from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent\" />\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"content\" />\n </div>\n <DisclosurePanel\n class=\"parameter-item-container parameter-item-container-markdown\"\n :static=\"!collapsableItems\">\n <ScalarMarkdown\n v-if=\"collapsableItems && parameter.description\"\n class=\"parameter-item-description\"\n :value=\"parameter.description\" />\n <!-- Headers -->\n <Headers\n v-if=\"headers\"\n :breadcrumb=\"breadcrumb\"\n :eventBus=\"eventBus\"\n :headers=\"headers\"\n :orderRequiredPropertiesFirst=\"options.orderRequiredPropertiesFirst\"\n :orderSchemaPropertiesBy=\"options.orderSchemaPropertiesBy\" />\n\n <!-- Schema -->\n <SchemaProperty\n is=\"div\"\n :breadcrumb=\"breadcrumb\"\n compact\n :description=\"collapsableItems ? '' : parameter.description\"\n :eventBus=\"eventBus\"\n :hideWriteOnly=\"true\"\n :modelName=\"schemaModelName\"\n :name=\"collapsableItems ? '' : name\"\n :noncollapsible=\"true\"\n :options=\"{\n hideWriteOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :required=\"'required' in parameter && parameter.required\"\n :schema=\"value\" />\n </DisclosurePanel>\n </Disclosure>\n </li>\n</template>\n\n<style scoped>\n.parameter-item {\n display: flex;\n flex-direction: column;\n position: relative;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item:last-of-type .parameter-schema {\n padding-bottom: 0;\n}\n\n.parameter-item-container {\n padding: 0;\n}\n\n.parameter-item-headers {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item-name {\n position: relative;\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n overflow-wrap: break-word;\n}\n\n.parameter-item-description,\n.parameter-item-description-summary {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n}\n\n.parameter-item-description-summary.parameter-item-description-summary > * {\n --markdown-line-height: var(--scalar-line-height-5);\n}\n\n/* Match font size of markdown for property-detail-value since first child within accordian is displayed as if it were in the markdown section */\n.parameter-item-trigger\n ~ .parameter-item-container\n :deep(.property--level-0 > .property-heading .property-detail-value) {\n font-size: var(--scalar-micro);\n}\n\n.parameter-item-required-optional {\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n margin-right: 6px;\n position: relative;\n}\n\n.parameter-item--required {\n text-transform: uppercase;\n font-size: var(--scalar-micro);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-orange);\n}\n\n.parameter-item-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-item-description :deep(p) {\n margin-top: 4px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-schema {\n padding-bottom: 9px;\n margin-top: 3px;\n}\n\n.parameter-item-trigger {\n display: flex;\n align-items: baseline;\n line-height: var(--scalar-line-height-5);\n gap: 6px;\n flex-wrap: wrap;\n padding: 10px 0;\n outline: none;\n}\n\n.parameter-item-trigger-open {\n padding-bottom: 0;\n}\n\n.parameter-item-icon {\n color: var(--scalar-color-3);\n left: -19px;\n top: 0.5lh;\n translate: 0 -50%;\n position: absolute;\n}\n\n.parameter-item-trigger:hover .parameter-item-icon,\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n color: var(--scalar-color-1);\n}\n\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n outline: 1px solid var(--scalar-color-accent);\n outline-offset: 2px;\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"ParameterListItem.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarMarkdown,\n ScalarMarkdownSummary,\n ScalarWrappingText,\n} from '@scalar/components'\nimport { ScalarIconCaretRight } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ResponseObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { getRefName } from '@/components/Content/Schema/helpers/get-ref-name'\nimport SchemaProperty from '@/components/Content/Schema/SchemaProperty.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\nimport Headers from './Headers.vue'\nimport { getParameterExamples } from './helpers/get-parameter-examples'\n\nconst { name, parameter, options, collapsableItems } = defineProps<{\n parameter: ParameterObject | ResponseObject\n name: string\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n collapsableItems?: boolean\n options: Pick<\n OperationProps['options'],\n 'hideModels' | 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Whether the markdown summary is being truncated */\nconst truncated = ref(false)\n\n/** Responses and params may both have a schema */\nconst schema = computed<SchemaObject | null>(() =>\n 'schema' in parameter && parameter.schema\n ? getResolvedRef(parameter.schema)\n : null,\n)\n\n/** Response and params may both have content */\nconst content = computed(() => {\n if (!('content' in parameter) || !parameter.content) {\n return null\n }\n const keys = Object.keys(parameter.content)\n if (keys.length === 0) {\n return null\n }\n return parameter.content\n})\n\nconst selectedContentType = ref<string>(\n Object.keys(content.value || {})[0] ?? '',\n)\n\n/** Response headers */\nconst headers = computed<ResponseObject['headers'] | null>(() =>\n 'headers' in parameter && parameter.headers ? parameter.headers : null,\n)\n\n/** Raw schema (possibly with $ref) for the selected content type or param. */\nconst baseSchema = computed(() =>\n content.value\n ? content.value?.[selectedContentType.value]?.schema\n : 'schema' in parameter && parameter.schema\n ? parameter.schema\n : null,\n)\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(() => {\n const raw = baseSchema.value\n if (!raw) {\n return null\n }\n\n if ('$ref' in raw) {\n return getRefName(raw.$ref)\n }\n\n return null\n})\n\n/** Computed value from the combined schema param and content param */\nconst value = computed(() => {\n const base = baseSchema.value\n const resolvedBase = content.value ? getResolvedRef(base) : schema.value\n\n const deprecated =\n 'deprecated' in parameter ? parameter.deprecated : schema.value?.deprecated\n\n /** Combine param/content/schema examples while ignoring undefined values. */\n const examples = getParameterExamples({\n parameter,\n schemaExamples: schema.value?.examples,\n contentExamples: content.value?.[selectedContentType.value]?.examples,\n })\n\n return {\n ...resolvedBase,\n deprecated: deprecated,\n examples,\n } as SchemaObject\n})\n\n/**\n * Determines whether this parameter item should be rendered as a collapsible disclosure.\n * Only collapses when collapsableItems is enabled and the parameter has additional\n * content to display (content types, headers, or schema details).\n */\nconst shouldCollapse = computed<boolean>(() =>\n Boolean(content.value || headers.value || schema.value || truncated.value),\n)\n</script>\n<template>\n <li class=\"parameter-item group/parameter-item\">\n <Disclosure v-slot=\"{ open }\">\n <component\n :is=\"shouldCollapse ? DisclosureButton : 'div'\"\n v-if=\"collapsableItems\"\n class=\"parameter-item-trigger\"\n :class=\"{ 'parameter-item-trigger-open': open }\">\n <div class=\"parameter-item-name min-w-0\">\n <ScalarIconCaretRight\n v-if=\"shouldCollapse\"\n class=\"parameter-item-icon size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-90': open }\"\n weight=\"bold\" />\n <div>\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </div>\n </div>\n <ScalarMarkdownSummary\n v-if=\"!open && parameter.description\"\n v-model:truncated=\"truncated\"\n class=\"parameter-item-description-summary min-w-0 flex-1\"\n controlled\n :value=\"parameter.description\" />\n <div\n v-else\n class=\"flex-1\" />\n </component>\n <div\n v-if=\"shouldCollapse && content\"\n class=\"absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base\"\n :class=\"{\n 'opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100':\n !open,\n }\">\n <div\n class=\"from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent\" />\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"content\" />\n </div>\n <DisclosurePanel\n class=\"parameter-item-container parameter-item-container-markdown\"\n :static=\"!collapsableItems\">\n <ScalarMarkdown\n v-if=\"collapsableItems && parameter.description\"\n class=\"parameter-item-description\"\n :value=\"parameter.description\" />\n <!-- Headers -->\n <Headers\n v-if=\"headers\"\n :breadcrumb=\"breadcrumb\"\n :eventBus=\"eventBus\"\n :headers=\"headers\"\n :orderRequiredPropertiesFirst=\"options.orderRequiredPropertiesFirst\"\n :orderSchemaPropertiesBy=\"options.orderSchemaPropertiesBy\" />\n\n <!-- Schema -->\n <SchemaProperty\n is=\"div\"\n :breadcrumb=\"breadcrumb\"\n compact\n :description=\"collapsableItems ? '' : parameter.description\"\n :eventBus=\"eventBus\"\n :hideWriteOnly=\"true\"\n :modelName=\"schemaModelName\"\n :name=\"collapsableItems ? '' : name\"\n :noncollapsible=\"true\"\n :options=\"{\n hideWriteOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :required=\"'required' in parameter && parameter.required\"\n :schema=\"value\" />\n </DisclosurePanel>\n </Disclosure>\n </li>\n</template>\n\n<style scoped>\n.parameter-item {\n display: flex;\n flex-direction: column;\n position: relative;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item:last-of-type .parameter-schema {\n padding-bottom: 0;\n}\n\n.parameter-item-container {\n padding: 0;\n}\n\n.parameter-item-headers {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item-name {\n position: relative;\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n overflow-wrap: break-word;\n}\n\n.parameter-item-description,\n.parameter-item-description-summary {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n}\n\n.parameter-item-description-summary.parameter-item-description-summary > * {\n --markdown-line-height: var(--scalar-line-height-5);\n}\n\n/* Match font size of markdown for property-detail-value since first child within accordian is displayed as if it were in the markdown section */\n.parameter-item-trigger\n ~ .parameter-item-container\n :deep(.property--level-0 > .property-heading .property-detail-value) {\n font-size: var(--scalar-micro);\n}\n\n.parameter-item-required-optional {\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n margin-right: 6px;\n position: relative;\n}\n\n.parameter-item--required {\n text-transform: uppercase;\n font-size: var(--scalar-micro);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-orange);\n}\n\n.parameter-item-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-item-description :deep(p) {\n margin-top: 4px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-schema {\n padding-bottom: 9px;\n margin-top: 3px;\n}\n\n.parameter-item-trigger {\n display: flex;\n align-items: baseline;\n line-height: var(--scalar-line-height-5);\n gap: 6px;\n flex-wrap: wrap;\n padding: 10px 0;\n outline: none;\n}\n\n.parameter-item-trigger-open {\n padding-bottom: 0;\n}\n\n.parameter-item-icon {\n color: var(--scalar-color-3);\n left: -19px;\n top: 0.5lh;\n translate: 0 -50%;\n position: absolute;\n}\n\n.parameter-item-trigger:hover .parameter-item-icon,\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n color: var(--scalar-color-1);\n}\n\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n outline: 1px solid var(--scalar-color-accent);\n outline-offset: 2px;\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":"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"}
|