@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
75 lines (74 loc) • 3.24 kB
JavaScript
import { defineComponent as N, computed as y, createElementBlock as n, openBlock as i, Fragment as t, createCommentVNode as d, createBlock as s, unref as a, renderList as h } from "vue";
import { getResolvedRef as l } from "@scalar/workspace-store/helpers/get-resolved-ref";
import { isTypeObject as c } from "./helpers/is-type-object.js";
import { sortPropertyNames as v } from "./helpers/sort-property-names.js";
import p from "./SchemaProperty.vue.js";
const B = /* @__PURE__ */ N({
__name: "SchemaObjectProperties",
props: {
schema: {},
discriminator: {},
compact: { type: Boolean },
hideHeading: { type: Boolean },
level: {},
hideModelNames: { type: Boolean },
breadcrumb: {},
options: {}
},
setup(m) {
const u = y(
() => v(m.schema, m.discriminator, m.options)
), b = (e) => {
const o = l(e);
return typeof o == "object" && typeof o["x-additionalPropertiesName"] == "string" && o["x-additionalPropertiesName"].trim().length > 0 ? `${o["x-additionalPropertiesName"].trim()}` : "propertyName";
}, g = (e) => e === !0 || typeof e == "object" && Object.keys(e).length === 0 || typeof e != "object" || !("type" in e) ? {
// @ts-expect-error - ask hans
type: "anything",
...typeof e == "object" ? e : {}
} : e;
return (e, o) => (i(), n(t, null, [
a(c)(e.schema) && e.schema.properties ? (i(!0), n(t, { key: 0 }, h(u.value, (r) => (i(), s(p, {
key: r,
breadcrumb: e.breadcrumb,
compact: e.compact,
discriminator: e.discriminator,
hideHeading: e.hideHeading,
hideModelNames: e.hideModelNames,
level: e.level,
name: r,
options: e.options,
required: e.schema.required?.includes(r),
schema: a(l)(e.schema.properties[r])
}, null, 8, ["breadcrumb", "compact", "discriminator", "hideHeading", "hideModelNames", "level", "name", "options", "required", "schema"]))), 128)) : d("", !0),
a(c)(e.schema) && e.schema.patternProperties ? (i(!0), n(t, { key: 1 }, h(Object.entries(e.schema.patternProperties), ([r, f]) => (i(), s(p, {
key: r,
breadcrumb: e.breadcrumb,
compact: e.compact,
discriminator: e.discriminator,
hideHeading: e.hideHeading,
hideModelNames: e.hideModelNames,
level: e.level,
name: r,
options: e.options,
schema: a(l)(f)
}, null, 8, ["breadcrumb", "compact", "discriminator", "hideHeading", "hideModelNames", "level", "name", "options", "schema"]))), 128)) : d("", !0),
a(c)(e.schema) && e.schema.additionalProperties ? (i(), s(p, {
key: 2,
breadcrumb: e.breadcrumb,
compact: e.compact,
discriminator: e.discriminator,
hideHeading: e.hideHeading,
hideModelNames: e.hideModelNames,
level: e.level,
name: b(e.schema.additionalProperties),
noncollapsible: "",
options: e.options,
schema: g(e.schema.additionalProperties),
variant: "additionalProperties"
}, null, 8, ["breadcrumb", "compact", "discriminator", "hideHeading", "hideModelNames", "level", "name", "options", "schema"])) : d("", !0)
], 64));
}
});
export {
B as default
};