@webpieces/docs-site 0.4.937 → 0.4.939

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/README.md CHANGED
@@ -21,6 +21,10 @@ site/
21
21
  schemas/<kebab-name>/index.html one per named OBJECT dto
22
22
  ```
23
23
 
24
+ An operation's request or response body written INLINE — as `@webpieces/openapi-generator` writes a
25
+ single-use `…Request` / `…Response` wrapper (#1303) — has no schema page: the operation page heads the
26
+ body with its `title` (the name a generated client gives the model) and `description`, then its fields.
27
+
24
28
  Each operation page is HEADED, and its sidebar link LABELLED, with the operation's `summary` — its short
25
29
  human title (#1296) — and shows the `operationId` beside the method and path as the code identifier a
26
30
  generated client names the method by. The page's URL is kebabed from the `operationId`, so rewording a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/docs-site",
3
- "version": "0.4.937",
3
+ "version": "0.4.939",
4
4
  "description": "Render a static, three-pane API reference site from any OpenAPI 3.0-or-3.1 document plus a directory of markdown prose. Node builtins only. Ships the wp-docs-site bin.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -9,5 +9,5 @@
9
9
  * one attribute on `<html>` and nothing else in the site knows about it.
10
10
  */
11
11
  export declare class SiteStyles {
12
- static readonly CSS = "\n:root {\n --bg: #ffffff;\n --bg-soft: #f6f7f9;\n --fg: #1d2129;\n --fg-soft: #5b6472;\n --line: #e2e5ea;\n --accent: #2f5cff;\n --code-bg: #f2f3f6;\n --badge-fg: #ffffff;\n}\n:root[data-theme='dark'] {\n --bg: #14171c;\n --bg-soft: #1b1f26;\n --fg: #e7eaf0;\n --fg-soft: #9aa4b2;\n --line: #2a2f38;\n --accent: #7f9bff;\n --code-bg: #10131a;\n --badge-fg: #14171c;\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0;\n background: var(--bg);\n color: var(--fg);\n font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n}\na { color: var(--accent); text-decoration: none; }\na:hover { text-decoration: underline; }\ncode, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }\ncode { background: var(--code-bg); padding: 1px 4px; border-radius: 3px; }\npre { background: var(--code-bg); padding: 12px; border-radius: 6px; overflow-x: auto; }\npre code { background: none; padding: 0; }\ntable { border-collapse: collapse; width: 100%; margin: 12px 0; }\nth, td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }\nth { background: var(--bg-soft); }\nhr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }\nblockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid var(--line); color: var(--fg-soft); }\n\n.site { display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; gap: 0; min-height: 100vh; }\n.pane-nav { border-right: 1px solid var(--line); padding: 20px 16px; background: var(--bg-soft); }\n.pane-body { padding: 28px 32px; min-width: 0; }\n.pane-cards { border-left: 1px solid var(--line); padding: 20px 16px; background: var(--bg-soft); }\n.pane-cards-inner { position: sticky; top: 20px; }\n\n.site-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; display: block; color: var(--fg); }\n.site-version { color: var(--fg-soft); font-size: 12px; margin-bottom: 16px; }\n.nav-group { margin-bottom: 10px; }\n.nav-group > summary { cursor: pointer; font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-soft); }\n.nav-group ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; }\n.nav-group li { margin: 2px 0; }\n.nav-group a { display: flex; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 4px; color: var(--fg); }\n.nav-group a.current { background: var(--accent); color: var(--badge-fg); }\n.nav-group a.current .badge { background: var(--badge-fg); color: var(--accent); }\n\n.badge { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 3px; background: var(--accent); color: var(--badge-fg); }\n.op-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }\n.op-path { background: var(--code-bg); padding: 3px 8px; border-radius: 4px; }\n.op-id { color: var(--fg-soft); font-size: 12px; }\n.api-summary { font-size: 1.1em; color: var(--fg-soft); margin-top: -4px; }\n\n.card { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: 16px; }\n.card-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-soft); }\n.card-body { padding: 12px; }\n.card-body pre { margin: 0; }\nbutton { font: inherit; font-size: 11px; cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; color: var(--fg-soft); }\nbutton:hover { color: var(--fg); }\n.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 12px 0; }\n.tab[aria-selected='true'] { border-color: var(--accent); color: var(--accent); }\n.sample[hidden] { display: none; }\n\n.field { border-top: 1px solid var(--line); padding: 10px 0; }\n.field-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }\n.field-name { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }\n.field-type { color: var(--fg-soft); font-size: 12px; }\n.field-required { color: #c0392b; font-size: 11px; font-weight: 700; letter-spacing: .04em; }\n.field-optional { color: var(--fg-soft); font-size: 11px; font-weight: 700; letter-spacing: .04em; }\n.headers { margin: 8px 0 12px; }\n.headers-head { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--fg-soft); text-transform: uppercase; }\n.field-doc { margin: 4px 0 0; color: var(--fg-soft); }\n.field-children { margin-left: 16px; border-left: 1px solid var(--line); padding-left: 12px; }\n.chips { margin-top: 6px; font-size: 12px; color: var(--fg-soft); }\n.chip { display: inline-block; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; margin: 2px 4px 2px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }\n.variant { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }\n.variant-head { font-weight: 600; }\ndetails.disclosure > summary { cursor: pointer; color: var(--fg-soft); font-size: 12px; }\n\n@media (max-width: 1100px) {\n .site { grid-template-columns: 1fr; }\n .pane-nav, .pane-cards { border: 0; }\n .pane-cards-inner { position: static; }\n}\n";
12
+ static readonly CSS = "\n:root {\n --bg: #ffffff;\n --bg-soft: #f6f7f9;\n --fg: #1d2129;\n --fg-soft: #5b6472;\n --line: #e2e5ea;\n --accent: #2f5cff;\n --code-bg: #f2f3f6;\n --badge-fg: #ffffff;\n}\n:root[data-theme='dark'] {\n --bg: #14171c;\n --bg-soft: #1b1f26;\n --fg: #e7eaf0;\n --fg-soft: #9aa4b2;\n --line: #2a2f38;\n --accent: #7f9bff;\n --code-bg: #10131a;\n --badge-fg: #14171c;\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0;\n background: var(--bg);\n color: var(--fg);\n font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n}\na { color: var(--accent); text-decoration: none; }\na:hover { text-decoration: underline; }\ncode, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }\ncode { background: var(--code-bg); padding: 1px 4px; border-radius: 3px; }\npre { background: var(--code-bg); padding: 12px; border-radius: 6px; overflow-x: auto; }\npre code { background: none; padding: 0; }\ntable { border-collapse: collapse; width: 100%; margin: 12px 0; }\nth, td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }\nth { background: var(--bg-soft); }\nhr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }\nblockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid var(--line); color: var(--fg-soft); }\n\n.site { display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; gap: 0; min-height: 100vh; }\n.pane-nav { border-right: 1px solid var(--line); padding: 20px 16px; background: var(--bg-soft); }\n.pane-body { padding: 28px 32px; min-width: 0; }\n.pane-cards { border-left: 1px solid var(--line); padding: 20px 16px; background: var(--bg-soft); }\n.pane-cards-inner { position: sticky; top: 20px; }\n\n.site-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; display: block; color: var(--fg); }\n.site-version { color: var(--fg-soft); font-size: 12px; margin-bottom: 16px; }\n.nav-group { margin-bottom: 10px; }\n.nav-group > summary { cursor: pointer; font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-soft); }\n.nav-group ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; }\n.nav-group li { margin: 2px 0; }\n.nav-group a { display: flex; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 4px; color: var(--fg); }\n.nav-group a.current { background: var(--accent); color: var(--badge-fg); }\n.nav-group a.current .badge { background: var(--badge-fg); color: var(--accent); }\n\n.badge { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 3px; background: var(--accent); color: var(--badge-fg); }\n.op-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }\n.op-path { background: var(--code-bg); padding: 3px 8px; border-radius: 4px; }\n.op-id { color: var(--fg-soft); font-size: 12px; }\n.api-summary { font-size: 1.1em; color: var(--fg-soft); margin-top: -4px; }\n\n.card { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: 16px; }\n.card-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-soft); }\n.card-body { padding: 12px; }\n.card-body pre { margin: 0; }\nbutton { font: inherit; font-size: 11px; cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; color: var(--fg-soft); }\nbutton:hover { color: var(--fg); }\n.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 12px 0; }\n.tab[aria-selected='true'] { border-color: var(--accent); color: var(--accent); }\n.sample[hidden] { display: none; }\n\n.field { border-top: 1px solid var(--line); padding: 10px 0; }\n.field-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }\n.field-name { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }\n.field-type { color: var(--fg-soft); font-size: 12px; }\n.field-required { color: #c0392b; font-size: 11px; font-weight: 700; letter-spacing: .04em; }\n.field-optional { color: var(--fg-soft); font-size: 11px; font-weight: 700; letter-spacing: .04em; }\n.headers { margin: 8px 0 12px; }\n.headers-head { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--fg-soft); text-transform: uppercase; }\n.field-doc { margin: 4px 0 0; color: var(--fg-soft); }\n.body-type { margin: 4px 0; }\n.field-children { margin-left: 16px; border-left: 1px solid var(--line); padding-left: 12px; }\n.chips { margin-top: 6px; font-size: 12px; color: var(--fg-soft); }\n.chip { display: inline-block; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; margin: 2px 4px 2px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }\n.variant { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }\n.variant-head { font-weight: 600; }\ndetails.disclosure > summary { cursor: pointer; color: var(--fg-soft); font-size: 12px; }\n\n@media (max-width: 1100px) {\n .site { grid-template-columns: 1fr; }\n .pane-nav, .pane-cards { border: 0; }\n .pane-cards-inner { position: static; }\n}\n";
13
13
  }
@@ -93,6 +93,7 @@ button:hover { color: var(--fg); }
93
93
  .headers { margin: 8px 0 12px; }
94
94
  .headers-head { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--fg-soft); text-transform: uppercase; }
95
95
  .field-doc { margin: 4px 0 0; color: var(--fg-soft); }
96
+ .body-type { margin: 4px 0; }
96
97
  .field-children { margin-left: 16px; border-left: 1px solid var(--line); padding-left: 12px; }
97
98
  .chips { margin-top: 6px; font-size: 12px; color: var(--fg-soft); }
98
99
  .chip { display: inline-block; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; margin: 2px 4px 2px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
@@ -1 +1 @@
1
- {"version":3,"file":"SiteStyles.js","sourceRoot":"","sources":["../../../../../../packages/docs/docs-site/src/assets/SiteStyles.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,MAAa,UAAU;IACnB,MAAM,CAAU,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6FzB,CAAC;;AA9FF,gCA+FC","sourcesContent":["/**\n * The whole stylesheet, as one string written to `styles.css` beside the pages.\n *\n * It is hand-written rather than generated by a framework because #985 puts the framework, the\n * bundler and the markdown library out of scope: adding an API reference to an upstream project must\n * not grow that project's dependency surface, and this package's own build has to stay `tsc`.\n *\n * Colours are declared once as custom properties and redefined for dark mode, so a theme toggle is\n * one attribute on `<html>` and nothing else in the site knows about it.\n */\nexport class SiteStyles {\n static readonly CSS = `\n:root {\n --bg: #ffffff;\n --bg-soft: #f6f7f9;\n --fg: #1d2129;\n --fg-soft: #5b6472;\n --line: #e2e5ea;\n --accent: #2f5cff;\n --code-bg: #f2f3f6;\n --badge-fg: #ffffff;\n}\n:root[data-theme='dark'] {\n --bg: #14171c;\n --bg-soft: #1b1f26;\n --fg: #e7eaf0;\n --fg-soft: #9aa4b2;\n --line: #2a2f38;\n --accent: #7f9bff;\n --code-bg: #10131a;\n --badge-fg: #14171c;\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0;\n background: var(--bg);\n color: var(--fg);\n font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n}\na { color: var(--accent); text-decoration: none; }\na:hover { text-decoration: underline; }\ncode, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }\ncode { background: var(--code-bg); padding: 1px 4px; border-radius: 3px; }\npre { background: var(--code-bg); padding: 12px; border-radius: 6px; overflow-x: auto; }\npre code { background: none; padding: 0; }\ntable { border-collapse: collapse; width: 100%; margin: 12px 0; }\nth, td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }\nth { background: var(--bg-soft); }\nhr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }\nblockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid var(--line); color: var(--fg-soft); }\n\n.site { display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; gap: 0; min-height: 100vh; }\n.pane-nav { border-right: 1px solid var(--line); padding: 20px 16px; background: var(--bg-soft); }\n.pane-body { padding: 28px 32px; min-width: 0; }\n.pane-cards { border-left: 1px solid var(--line); padding: 20px 16px; background: var(--bg-soft); }\n.pane-cards-inner { position: sticky; top: 20px; }\n\n.site-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; display: block; color: var(--fg); }\n.site-version { color: var(--fg-soft); font-size: 12px; margin-bottom: 16px; }\n.nav-group { margin-bottom: 10px; }\n.nav-group > summary { cursor: pointer; font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-soft); }\n.nav-group ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; }\n.nav-group li { margin: 2px 0; }\n.nav-group a { display: flex; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 4px; color: var(--fg); }\n.nav-group a.current { background: var(--accent); color: var(--badge-fg); }\n.nav-group a.current .badge { background: var(--badge-fg); color: var(--accent); }\n\n.badge { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 3px; background: var(--accent); color: var(--badge-fg); }\n.op-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }\n.op-path { background: var(--code-bg); padding: 3px 8px; border-radius: 4px; }\n.op-id { color: var(--fg-soft); font-size: 12px; }\n.api-summary { font-size: 1.1em; color: var(--fg-soft); margin-top: -4px; }\n\n.card { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: 16px; }\n.card-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-soft); }\n.card-body { padding: 12px; }\n.card-body pre { margin: 0; }\nbutton { font: inherit; font-size: 11px; cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; color: var(--fg-soft); }\nbutton:hover { color: var(--fg); }\n.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 12px 0; }\n.tab[aria-selected='true'] { border-color: var(--accent); color: var(--accent); }\n.sample[hidden] { display: none; }\n\n.field { border-top: 1px solid var(--line); padding: 10px 0; }\n.field-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }\n.field-name { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }\n.field-type { color: var(--fg-soft); font-size: 12px; }\n.field-required { color: #c0392b; font-size: 11px; font-weight: 700; letter-spacing: .04em; }\n.field-optional { color: var(--fg-soft); font-size: 11px; font-weight: 700; letter-spacing: .04em; }\n.headers { margin: 8px 0 12px; }\n.headers-head { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--fg-soft); text-transform: uppercase; }\n.field-doc { margin: 4px 0 0; color: var(--fg-soft); }\n.field-children { margin-left: 16px; border-left: 1px solid var(--line); padding-left: 12px; }\n.chips { margin-top: 6px; font-size: 12px; color: var(--fg-soft); }\n.chip { display: inline-block; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; margin: 2px 4px 2px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }\n.variant { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }\n.variant-head { font-weight: 600; }\ndetails.disclosure > summary { cursor: pointer; color: var(--fg-soft); font-size: 12px; }\n\n@media (max-width: 1100px) {\n .site { grid-template-columns: 1fr; }\n .pane-nav, .pane-cards { border: 0; }\n .pane-cards-inner { position: static; }\n}\n`;\n}\n"]}
1
+ {"version":3,"file":"SiteStyles.js","sourceRoot":"","sources":["../../../../../../packages/docs/docs-site/src/assets/SiteStyles.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,MAAa,UAAU;IACnB,MAAM,CAAU,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FzB,CAAC;;AA/FF,gCAgGC","sourcesContent":["/**\n * The whole stylesheet, as one string written to `styles.css` beside the pages.\n *\n * It is hand-written rather than generated by a framework because #985 puts the framework, the\n * bundler and the markdown library out of scope: adding an API reference to an upstream project must\n * not grow that project's dependency surface, and this package's own build has to stay `tsc`.\n *\n * Colours are declared once as custom properties and redefined for dark mode, so a theme toggle is\n * one attribute on `<html>` and nothing else in the site knows about it.\n */\nexport class SiteStyles {\n static readonly CSS = `\n:root {\n --bg: #ffffff;\n --bg-soft: #f6f7f9;\n --fg: #1d2129;\n --fg-soft: #5b6472;\n --line: #e2e5ea;\n --accent: #2f5cff;\n --code-bg: #f2f3f6;\n --badge-fg: #ffffff;\n}\n:root[data-theme='dark'] {\n --bg: #14171c;\n --bg-soft: #1b1f26;\n --fg: #e7eaf0;\n --fg-soft: #9aa4b2;\n --line: #2a2f38;\n --accent: #7f9bff;\n --code-bg: #10131a;\n --badge-fg: #14171c;\n}\n* { box-sizing: border-box; }\nbody {\n margin: 0;\n background: var(--bg);\n color: var(--fg);\n font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;\n}\na { color: var(--accent); text-decoration: none; }\na:hover { text-decoration: underline; }\ncode, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }\ncode { background: var(--code-bg); padding: 1px 4px; border-radius: 3px; }\npre { background: var(--code-bg); padding: 12px; border-radius: 6px; overflow-x: auto; }\npre code { background: none; padding: 0; }\ntable { border-collapse: collapse; width: 100%; margin: 12px 0; }\nth, td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }\nth { background: var(--bg-soft); }\nhr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }\nblockquote { margin: 12px 0; padding: 4px 14px; border-left: 3px solid var(--line); color: var(--fg-soft); }\n\n.site { display: grid; grid-template-columns: 260px minmax(0, 1fr) 360px; gap: 0; min-height: 100vh; }\n.pane-nav { border-right: 1px solid var(--line); padding: 20px 16px; background: var(--bg-soft); }\n.pane-body { padding: 28px 32px; min-width: 0; }\n.pane-cards { border-left: 1px solid var(--line); padding: 20px 16px; background: var(--bg-soft); }\n.pane-cards-inner { position: sticky; top: 20px; }\n\n.site-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; display: block; color: var(--fg); }\n.site-version { color: var(--fg-soft); font-size: 12px; margin-bottom: 16px; }\n.nav-group { margin-bottom: 10px; }\n.nav-group > summary { cursor: pointer; font-weight: 600; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-soft); }\n.nav-group ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; }\n.nav-group li { margin: 2px 0; }\n.nav-group a { display: flex; gap: 6px; align-items: center; padding: 3px 6px; border-radius: 4px; color: var(--fg); }\n.nav-group a.current { background: var(--accent); color: var(--badge-fg); }\n.nav-group a.current .badge { background: var(--badge-fg); color: var(--accent); }\n\n.badge { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 3px; background: var(--accent); color: var(--badge-fg); }\n.op-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }\n.op-path { background: var(--code-bg); padding: 3px 8px; border-radius: 4px; }\n.op-id { color: var(--fg-soft); font-size: 12px; }\n.api-summary { font-size: 1.1em; color: var(--fg-soft); margin-top: -4px; }\n\n.card { border: 1px solid var(--line); border-radius: 8px; background: var(--bg); margin-bottom: 16px; }\n.card-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-soft); }\n.card-body { padding: 12px; }\n.card-body pre { margin: 0; }\nbutton { font: inherit; font-size: 11px; cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 4px; padding: 2px 8px; color: var(--fg-soft); }\nbutton:hover { color: var(--fg); }\n.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 8px 12px 0; }\n.tab[aria-selected='true'] { border-color: var(--accent); color: var(--accent); }\n.sample[hidden] { display: none; }\n\n.field { border-top: 1px solid var(--line); padding: 10px 0; }\n.field-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }\n.field-name { font-weight: 600; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }\n.field-type { color: var(--fg-soft); font-size: 12px; }\n.field-required { color: #c0392b; font-size: 11px; font-weight: 700; letter-spacing: .04em; }\n.field-optional { color: var(--fg-soft); font-size: 11px; font-weight: 700; letter-spacing: .04em; }\n.headers { margin: 8px 0 12px; }\n.headers-head { font-size: 12px; font-weight: 700; letter-spacing: .04em; color: var(--fg-soft); text-transform: uppercase; }\n.field-doc { margin: 4px 0 0; color: var(--fg-soft); }\n.body-type { margin: 4px 0; }\n.field-children { margin-left: 16px; border-left: 1px solid var(--line); padding-left: 12px; }\n.chips { margin-top: 6px; font-size: 12px; color: var(--fg-soft); }\n.chip { display: inline-block; background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; margin: 2px 4px 2px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }\n.variant { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }\n.variant-head { font-weight: 600; }\ndetails.disclosure > summary { cursor: pointer; color: var(--fg-soft); font-size: 12px; }\n\n@media (max-width: 1100px) {\n .site { grid-template-columns: 1fr; }\n .pane-nav, .pane-cards { border: 0; }\n .pane-cards-inner { position: static; }\n}\n`;\n}\n"]}
package/src/index.d.ts CHANGED
@@ -18,7 +18,7 @@ export { SchemaShape } from './spec/SchemaShape';
18
18
  export { Slug } from './spec/Slug';
19
19
  export { SpecLoader } from './spec/SpecLoader';
20
20
  export { SpecReader, UNTAGGED_SECTION } from './spec/SpecReader';
21
- export { FieldNode, FieldTreeBuilder, SchemaVariant } from './spec/FieldTree';
21
+ export { FieldNode, FieldTreeBuilder, InlineBodyHead, SchemaVariant } from './spec/FieldTree';
22
22
  export { ExampleBuilder } from './spec/ExampleBuilder';
23
23
  export { DocsManifest, ProsePage, ProsePageEntry } from './manifest/DocsManifest';
24
24
  export { MANIFEST_FILE, ProseLoader } from './manifest/ProseLoader';
package/src/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RenderedSite = exports.WEBHOOK_BADGE = exports.OperationPageRenderer = exports.HeaderListRenderer = exports.HEADERS_HEADING = exports.POSSIBLE_VALUES = exports.FieldTreeRenderer = exports.REQUEST_LABEL = exports.CardRenderer = exports.COLLAPSE_ALL_LABEL = exports.Layout = exports.SiteUrls = exports.SCHEMAS_GROUP = exports.NavModel = exports.NavLink = exports.NavGroup = exports.NavBuilder = exports.GUIDES_GROUP = exports.Html = exports.SampleHeader = exports.CodeSampleBuilder = exports.CodeSample = exports.Markdown = exports.ProseLoader = exports.MANIFEST_FILE = exports.ProsePageEntry = exports.ProsePage = exports.DocsManifest = exports.ExampleBuilder = exports.SchemaVariant = exports.FieldTreeBuilder = exports.FieldNode = exports.UNTAGGED_SECTION = exports.SpecReader = exports.SpecLoader = exports.Slug = exports.SchemaShape = exports.SchemaLens = exports.RefTarget = exports.TagSection = exports.ServerInfo = exports.SecuritySchemeInfo = exports.ResponseInfo = exports.HeaderInfo = exports.OperationInfo = exports.NamedSchema = exports.ApiSpec = exports.JsonNode = exports.JsonEntry = exports.DocsSiteError = void 0;
4
- exports.WpDocsSiteMain = exports.USAGE = exports.DocsSiteCli = exports.CliResult = exports.LOOPBACK = exports.DevServer = exports.SiteWriter = exports.SiteScript = exports.SiteStyles = exports.SiteRenderer = exports.OVERVIEW_TITLE = exports.SitePage = exports.SiteAsset = void 0;
3
+ exports.WEBHOOK_BADGE = exports.OperationPageRenderer = exports.HeaderListRenderer = exports.HEADERS_HEADING = exports.POSSIBLE_VALUES = exports.FieldTreeRenderer = exports.REQUEST_LABEL = exports.CardRenderer = exports.COLLAPSE_ALL_LABEL = exports.Layout = exports.SiteUrls = exports.SCHEMAS_GROUP = exports.NavModel = exports.NavLink = exports.NavGroup = exports.NavBuilder = exports.GUIDES_GROUP = exports.Html = exports.SampleHeader = exports.CodeSampleBuilder = exports.CodeSample = exports.Markdown = exports.ProseLoader = exports.MANIFEST_FILE = exports.ProsePageEntry = exports.ProsePage = exports.DocsManifest = exports.ExampleBuilder = exports.SchemaVariant = exports.InlineBodyHead = exports.FieldTreeBuilder = exports.FieldNode = exports.UNTAGGED_SECTION = exports.SpecReader = exports.SpecLoader = exports.Slug = exports.SchemaShape = exports.SchemaLens = exports.RefTarget = exports.TagSection = exports.ServerInfo = exports.SecuritySchemeInfo = exports.ResponseInfo = exports.HeaderInfo = exports.OperationInfo = exports.NamedSchema = exports.ApiSpec = exports.JsonNode = exports.JsonEntry = exports.DocsSiteError = void 0;
4
+ exports.WpDocsSiteMain = exports.USAGE = exports.DocsSiteCli = exports.CliResult = exports.LOOPBACK = exports.DevServer = exports.SiteWriter = exports.SiteScript = exports.SiteStyles = exports.SiteRenderer = exports.OVERVIEW_TITLE = exports.SitePage = exports.SiteAsset = exports.RenderedSite = void 0;
5
5
  /**
6
6
  * `@webpieces/docs-site` — a static, three-pane API reference site from any OpenAPI 3.0-or-3.1
7
7
  * document plus a directory of markdown prose.
@@ -42,6 +42,7 @@ Object.defineProperty(exports, "UNTAGGED_SECTION", { enumerable: true, get: func
42
42
  var FieldTree_1 = require("./spec/FieldTree");
43
43
  Object.defineProperty(exports, "FieldNode", { enumerable: true, get: function () { return FieldTree_1.FieldNode; } });
44
44
  Object.defineProperty(exports, "FieldTreeBuilder", { enumerable: true, get: function () { return FieldTree_1.FieldTreeBuilder; } });
45
+ Object.defineProperty(exports, "InlineBodyHead", { enumerable: true, get: function () { return FieldTree_1.InlineBodyHead; } });
45
46
  Object.defineProperty(exports, "SchemaVariant", { enumerable: true, get: function () { return FieldTree_1.SchemaVariant; } });
46
47
  var ExampleBuilder_1 = require("./spec/ExampleBuilder");
47
48
  Object.defineProperty(exports, "ExampleBuilder", { enumerable: true, get: function () { return ExampleBuilder_1.ExampleBuilder; } });
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/docs/docs-site/src/index.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;GAUG;AACH,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,4CAAsD;AAA7C,qGAAA,SAAS,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAE5B,0CASwB;AARpB,kGAAA,OAAO,OAAA;AACP,sGAAA,WAAW,OAAA;AACX,wGAAA,aAAa,OAAA;AACb,qGAAA,UAAU,OAAA;AACV,uGAAA,YAAY,OAAA;AACZ,6GAAA,kBAAkB,OAAA;AAClB,qGAAA,UAAU,OAAA;AACV,qGAAA,UAAU,OAAA;AAEd,gDAA0D;AAAjD,uGAAA,SAAS,OAAA;AAAE,wGAAA,UAAU,OAAA;AAC9B,kDAAiD;AAAxC,0GAAA,WAAW,OAAA;AACpB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AACb,gDAA+C;AAAtC,wGAAA,UAAU,OAAA;AACnB,gDAAiE;AAAxD,wGAAA,UAAU,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACrC,8CAA8E;AAArE,sGAAA,SAAS,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAAE,0GAAA,aAAa,OAAA;AACnD,wDAAu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A;AAAE,qGAAA,QAAQ,OAAA;AAC5B,iDAAkE;AAAzD,wGAAA,SAAS,OAAA;AAAE,0GAAA,WAAW,OAAA;AAAE,oGAAA,KAAK,OAAA;AACtC,uDAAsD;AAA7C,gHAAA,cAAc,OAAA","sourcesContent":["/**\n * `@webpieces/docs-site` — a static, three-pane API reference site from any OpenAPI 3.0-or-3.1\n * document plus a directory of markdown prose.\n *\n * **Node builtins only.** No framework, no markdown library, no bundler, so adding docs to an\n * upstream project never grows that project's dependency surface and this package's own build stays\n * `tsc`. It also does NOT depend on `@webpieces/openapi-generator`, deliberately: the document is\n * read structurally, so \"generated by us\" is not a precondition for \"renderable by us\".\n *\n * It ships the `wp-docs-site` bin.\n */\nexport { DocsSiteError } from './DocsSiteError';\nexport { JsonEntry, JsonNode } from './spec/JsonNode';\nexport type { JsonMap, JsonValue } from './spec/JsonNode';\nexport {\n ApiSpec,\n NamedSchema,\n OperationInfo,\n HeaderInfo,\n ResponseInfo,\n SecuritySchemeInfo,\n ServerInfo,\n TagSection,\n} from './spec/ApiSpec';\nexport { RefTarget, SchemaLens } from './spec/SchemaLens';\nexport { SchemaShape } from './spec/SchemaShape';\nexport { Slug } from './spec/Slug';\nexport { SpecLoader } from './spec/SpecLoader';\nexport { SpecReader, UNTAGGED_SECTION } from './spec/SpecReader';\nexport { FieldNode, FieldTreeBuilder, SchemaVariant } from './spec/FieldTree';\nexport { ExampleBuilder } from './spec/ExampleBuilder';\nexport { DocsManifest, ProsePage, ProsePageEntry } from './manifest/DocsManifest';\nexport { MANIFEST_FILE, ProseLoader } from './manifest/ProseLoader';\nexport { Markdown } from './markdown/Markdown';\nexport { CodeSample, CodeSampleBuilder, SampleHeader } from './samples/CodeSamples';\nexport { Html } from './render/Html';\nexport {\n GUIDES_GROUP,\n NavBuilder,\n NavGroup,\n NavLink,\n NavModel,\n SCHEMAS_GROUP,\n} from './render/NavModel';\nexport { SiteUrls } from './render/SiteUrls';\nexport { Layout } from './render/Layout';\nexport { COLLAPSE_ALL_LABEL, CardRenderer, REQUEST_LABEL } from './render/CardRenderer';\nexport { FieldTreeRenderer, POSSIBLE_VALUES } from './render/FieldTreeRenderer';\nexport { HEADERS_HEADING, HeaderListRenderer } from './render/HeaderListRenderer';\nexport { OperationPageRenderer, WEBHOOK_BADGE } from './render/OperationPageRenderer';\nexport { RenderedSite, SiteAsset, SitePage } from './render/SitePage';\nexport { OVERVIEW_TITLE, SiteRenderer } from './render/SiteRenderer';\nexport { SiteStyles } from './assets/SiteStyles';\nexport { SiteScript } from './assets/SiteScript';\nexport { SiteWriter } from './emit/SiteWriter';\nexport { DevServer, LOOPBACK } from './serve/DevServer';\nexport { CliResult, DocsSiteCli, USAGE } from './cli/DocsSiteCli';\nexport { WpDocsSiteMain } from './cli/WpDocsSiteMain';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/docs/docs-site/src/index.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;GAUG;AACH,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,4CAAsD;AAA7C,qGAAA,SAAS,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAE5B,0CASwB;AARpB,kGAAA,OAAO,OAAA;AACP,sGAAA,WAAW,OAAA;AACX,wGAAA,aAAa,OAAA;AACb,qGAAA,UAAU,OAAA;AACV,uGAAA,YAAY,OAAA;AACZ,6GAAA,kBAAkB,OAAA;AAClB,qGAAA,UAAU,OAAA;AACV,qGAAA,UAAU,OAAA;AAEd,gDAA0D;AAAjD,uGAAA,SAAS,OAAA;AAAE,wGAAA,UAAU,OAAA;AAC9B,kDAAiD;AAAxC,0GAAA,WAAW,OAAA;AACpB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AACb,gDAA+C;AAAtC,wGAAA,UAAU,OAAA;AACnB,gDAAiE;AAAxD,wGAAA,UAAU,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACrC,8CAA8F;AAArF,sGAAA,SAAS,OAAA;AAAE,6GAAA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ACnB,gDAA+C;AAAtC,wGAAA,UAAU,OAAA;AACnB,+CAAwD;AAA/C,sGAAA,SAAS,OAAA;AAAE,qGAAA,QAAQ,OAAA;AAC5B,iDAAkE;AAAzD,wGAAA,SAAS,OAAA;AAAE,0GAAA,WAAW,OAAA;AAAE,oGAAA,KAAK,OAAA;AACtC,uDAAsD;AAA7C,gHAAA,cAAc,OAAA","sourcesContent":["/**\n * `@webpieces/docs-site` — a static, three-pane API reference site from any OpenAPI 3.0-or-3.1\n * document plus a directory of markdown prose.\n *\n * **Node builtins only.** No framework, no markdown library, no bundler, so adding docs to an\n * upstream project never grows that project's dependency surface and this package's own build stays\n * `tsc`. It also does NOT depend on `@webpieces/openapi-generator`, deliberately: the document is\n * read structurally, so \"generated by us\" is not a precondition for \"renderable by us\".\n *\n * It ships the `wp-docs-site` bin.\n */\nexport { DocsSiteError } from './DocsSiteError';\nexport { JsonEntry, JsonNode } from './spec/JsonNode';\nexport type { JsonMap, JsonValue } from './spec/JsonNode';\nexport {\n ApiSpec,\n NamedSchema,\n OperationInfo,\n HeaderInfo,\n ResponseInfo,\n SecuritySchemeInfo,\n ServerInfo,\n TagSection,\n} from './spec/ApiSpec';\nexport { RefTarget, SchemaLens } from './spec/SchemaLens';\nexport { SchemaShape } from './spec/SchemaShape';\nexport { Slug } from './spec/Slug';\nexport { SpecLoader } from './spec/SpecLoader';\nexport { SpecReader, UNTAGGED_SECTION } from './spec/SpecReader';\nexport { FieldNode, FieldTreeBuilder, InlineBodyHead, SchemaVariant } from './spec/FieldTree';\nexport { ExampleBuilder } from './spec/ExampleBuilder';\nexport { DocsManifest, ProsePage, ProsePageEntry } from './manifest/DocsManifest';\nexport { MANIFEST_FILE, ProseLoader } from './manifest/ProseLoader';\nexport { Markdown } from './markdown/Markdown';\nexport { CodeSample, CodeSampleBuilder, SampleHeader } from './samples/CodeSamples';\nexport { Html } from './render/Html';\nexport {\n GUIDES_GROUP,\n NavBuilder,\n NavGroup,\n NavLink,\n NavModel,\n SCHEMAS_GROUP,\n} from './render/NavModel';\nexport { SiteUrls } from './render/SiteUrls';\nexport { Layout } from './render/Layout';\nexport { COLLAPSE_ALL_LABEL, CardRenderer, REQUEST_LABEL } from './render/CardRenderer';\nexport { FieldTreeRenderer, POSSIBLE_VALUES } from './render/FieldTreeRenderer';\nexport { HEADERS_HEADING, HeaderListRenderer } from './render/HeaderListRenderer';\nexport { OperationPageRenderer, WEBHOOK_BADGE } from './render/OperationPageRenderer';\nexport { RenderedSite, SiteAsset, SitePage } from './render/SitePage';\nexport { OVERVIEW_TITLE, SiteRenderer } from './render/SiteRenderer';\nexport { SiteStyles } from './assets/SiteStyles';\nexport { SiteScript } from './assets/SiteScript';\nexport { SiteWriter } from './emit/SiteWriter';\nexport { DevServer, LOOPBACK } from './serve/DevServer';\nexport { CliResult, DocsSiteCli, USAGE } from './cli/DocsSiteCli';\nexport { WpDocsSiteMain } from './cli/WpDocsSiteMain';\n"]}
@@ -46,7 +46,13 @@ export declare class OperationPageRenderer {
46
46
  private requestSection;
47
47
  private responseSection;
48
48
  private response;
49
- /** A `oneOf` renders as expanded variants; anything else renders as one flat field tree. */
49
+ /**
50
+ * A `oneOf` renders as expanded variants; anything else renders as one flat field tree. An INLINE
51
+ * body (#1303) is headed by its `title` and `description` first: it has no schema page, so this
52
+ * page is the only place a reader can see the name a generated client gives it, or its prose.
53
+ */
50
54
  private tree;
55
+ private inlineHead;
56
+ private fieldTree;
51
57
  private cardColumn;
52
58
  }
@@ -96,8 +96,28 @@ class OperationPageRenderer {
96
96
  const headers = this.headers.render(response.headers);
97
97
  return `<details class="disclosure" open><summary>${summary}</summary>${headers}${body}</details>`;
98
98
  }
99
- /** A `oneOf` renders as expanded variants; anything else renders as one flat field tree. */
99
+ /**
100
+ * A `oneOf` renders as expanded variants; anything else renders as one flat field tree. An INLINE
101
+ * body (#1303) is headed by its `title` and `description` first: it has no schema page, so this
102
+ * page is the only place a reader can see the name a generated client gives it, or its prose.
103
+ */
100
104
  tree(schema, prefix) {
105
+ return this.inlineHead(schema) + this.fieldTree(schema, prefix);
106
+ }
107
+ inlineHead(schema) {
108
+ const head = this.fields.inlineHeadOf(schema);
109
+ if (head === undefined) {
110
+ return '';
111
+ }
112
+ const title = head.title === ''
113
+ ? ''
114
+ : `<p class="body-type"><code title="schema title">${this.html.escape(head.title)}</code></p>`;
115
+ const description = head.description === ''
116
+ ? ''
117
+ : `<div class="field-doc">${this.markdown.render(head.description)}</div>`;
118
+ return title + description;
119
+ }
120
+ fieldTree(schema, prefix) {
101
121
  const variants = this.fields.variantsOf(schema);
102
122
  if (variants.length > 0) {
103
123
  return this.trees.renderVariants(variants, this.fields.discriminatorPropertyOf(schema), prefix);
@@ -1 +1 @@
1
- {"version":3,"file":"OperationPageRenderer.js","sourceRoot":"","sources":["../../../../../../packages/docs/docs-site/src/render/OperationPageRenderer.ts"],"names":[],"mappings":";;;AAOA,iCAA8B;AAK9B,yCAAsC;AAEtC,yDAAyD;AAC5C,QAAA,aAAa,GAAG,SAAS,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAa,qBAAqB;IAIT;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAZJ,IAAI,GAAG,IAAI,WAAI,EAAE,CAAC;IAEnC,YACqB,IAAa,EACb,MAAwB,EACxB,KAAwB,EACxB,QAAkB,EAClB,KAAmB,EACnB,OAA0B,EAC1B,QAAwB,EACxB,MAAc,EACd,IAAc,EACd,OAA2B;QAT3B,SAAI,GAAJ,IAAI,CAAS;QACb,WAAM,GAAN,MAAM,CAAkB;QACxB,UAAK,GAAL,KAAK,CAAmB;QACxB,aAAQ,GAAR,QAAQ,CAAU;QAClB,UAAK,GAAL,KAAK,CAAc;QACnB,YAAO,GAAP,OAAO,CAAmB;QAC1B,aAAQ,GAAR,QAAQ,CAAgB;QACxB,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAU;QACd,YAAO,GAAP,OAAO,CAAoB;IAC7C,CAAC;IAEJ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AC,CAAC,CAAC;QACnF,IAAI,SAAS,CAAC,SAAS,EAAE,CAAC;YACtB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QACD,OAAO;YACH,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC;YAC9D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SACzD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;CACJ;AAjHD,sDAiHC","sourcesContent":["import { ApiSpec, OperationInfo, ResponseInfo } from '../spec/ApiSpec';\nimport { CardRenderer } from './CardRenderer';\nimport { CodeSampleBuilder } from '../samples/CodeSamples';\nimport { ExampleBuilder } from '../spec/ExampleBuilder';\nimport { FieldTreeBuilder } from '../spec/FieldTree';\nimport { FieldTreeRenderer } from './FieldTreeRenderer';\nimport { HeaderListRenderer } from './HeaderListRenderer';\nimport { Html } from './Html';\nimport { JsonNode } from '../spec/JsonNode';\nimport { Layout } from './Layout';\nimport { Markdown } from '../markdown/Markdown';\nimport { SiteUrls } from './SiteUrls';\nimport { SitePage } from './SitePage';\n\n/** The badge a webhook carries everywhere it appears. */\nexport const WEBHOOK_BADGE = 'WEBHOOK';\n\n/**\n * One pre-rendered page per operation, at `reference/<kebab-operation>/index.html`.\n *\n * ## What a WEBHOOK page leaves out, and why\n *\n * No method, no path, no code samples. The url is the PARTNER's — they host the endpoint wherever\n * they choose — so a `POST https://api.example.com/...` sample on a webhook page invites them to\n * call something that does not exist. What it keeps is the payload, because the payload is the part\n * that IS ours, and the event name, because that is what they match on the wire.\n */\nexport class OperationPageRenderer {\n private readonly html = new Html();\n\n constructor(\n private readonly spec: ApiSpec,\n private readonly fields: FieldTreeBuilder,\n private readonly trees: FieldTreeRenderer,\n private readonly markdown: Markdown,\n private readonly cards: CardRenderer,\n private readonly samples: CodeSampleBuilder,\n private readonly examples: ExampleBuilder,\n private readonly layout: Layout,\n private readonly urls: SiteUrls,\n private readonly headers: HeaderListRenderer,\n ) {}\n\n page(operation: OperationInfo): SitePage {\n const url = this.urls.operation(operation);\n const prefix = this.urls.prefixFor(url);\n return new SitePage(\n url,\n operation.name,\n this.layout.render(\n url,\n operation.name,\n this.body(operation, prefix),\n this.cardColumn(operation),\n ),\n );\n }\n\n private body(operation: OperationInfo, prefix: string): string {\n const parts = [this.head(operation), `<h1>${this.html.escape(operation.name)}</h1>`];\n if (operation.description !== '') {\n parts.push(this.markdown.render(operation.description));\n }\n parts.push(this.requestSection(operation, prefix));\n parts.push(this.responseSection(operation, prefix));\n return parts.join('\\n');\n }\n\n /**\n * The badge, the path (or event) and the `operationId`. The page HEADING is the operation's\n * summary (#1296); the operationId stays visible here because it is what a generated client names\n * the method, which is what a developer searches their code for.\n */\n private head(operation: OperationInfo): string {\n const id =\n operation.operationId === ''\n ? ''\n : `<code class=\"op-id\" title=\"operationId\">${this.html.escape(operation.operationId)}</code>`;\n if (operation.isWebhook) {\n return `<div class=\"op-head\"><span class=\"badge\">${WEBHOOK_BADGE}</span><code class=\"op-path\">${this.html.escape(operation.eventName)}</code>${id}</div>`;\n }\n return `<div class=\"op-head\"><span class=\"badge\">${this.html.escape(operation.httpMethod)}</span><code class=\"op-path\">${this.html.escape(operation.path)}</code>${id}</div>`;\n }\n\n /** The request's `in: \"header\"` parameters, then its body — each only when there is one. */\n private requestSection(operation: OperationInfo, prefix: string): string {\n const parts: string[] = [];\n if (operation.requestHeaders.length > 0) {\n parts.push(`<h2>Request headers</h2>${this.headers.render(operation.requestHeaders)}`);\n }\n if (operation.requestSchema !== undefined) {\n parts.push(`<h2>Request body</h2>${this.tree(operation.requestSchema, prefix)}`);\n }\n return parts.join('');\n }\n\n private responseSection(operation: OperationInfo, prefix: string): string {\n if (operation.responses.length === 0) {\n return '';\n }\n const blocks = operation.responses\n .map((response: ResponseInfo): string => this.response(response, prefix))\n .join('');\n return `<h2>Responses</h2>${blocks}`;\n }\n\n private response(response: ResponseInfo, prefix: string): string {\n const summary = `${this.html.escape(response.status)} — ${this.html.escape(response.description)}`;\n const body =\n response.schema === undefined\n ? '<p class=\"field-doc\">No body.</p>'\n : this.tree(response.schema, prefix);\n // The headers ride the card beside the body (#1292) — the response a partner holds carries both.\n const headers = this.headers.render(response.headers);\n return `<details class=\"disclosure\" open><summary>${summary}</summary>${headers}${body}</details>`;\n }\n\n /** A `oneOf` renders as expanded variants; anything else renders as one flat field tree. */\n private tree(schema: JsonNode, prefix: string): string {\n const variants = this.fields.variantsOf(schema);\n if (variants.length > 0) {\n return this.trees.renderVariants(\n variants,\n this.fields.discriminatorPropertyOf(schema),\n prefix,\n );\n }\n return this.trees.render(this.fields.fieldsOf(schema), prefix);\n }\n\n private cardColumn(operation: OperationInfo): string {\n const payload = this.examples.render(this.examples.build(operation.requestSchema));\n if (operation.isWebhook) {\n return this.cards.example('EVENT PAYLOAD', payload);\n }\n return [\n this.cards.authorization(operation, this.spec.securitySchemes),\n this.cards.samples(this.samples.samplesFor(operation)),\n ].join('\\n');\n }\n}\n"]}
1
+ {"version":3,"file":"OperationPageRenderer.js","sourceRoot":"","sources":["../../../../../../packages/docs/docs-site/src/render/OperationPageRenderer.ts"],"names":[],"mappings":";;;AAOA,iCAA8B;AAK9B,yCAAsC;AAEtC,yDAAyD;AAC5C,QAAA,aAAa,GAAG,SAAS,CAAC;AAEvC;;;;;;;;;GASG;AACH,MAAa,qBAAqB;IAIT;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAZJ,IAAI,GAAG,IAAI,WAAI,EAAE,CAAC;IAEnC,YACqB,IAAa,EACb,MAAwB,EACxB,KAAwB,EACxB,QAAkB,EAClB,KAAmB,EACnB,OAA0B,EAC1B,QAAwB,EACxB,MAAc,EACd,IAAc,EACd,OAA2B;QAT3B,SAAI,GAAJ,IAAI,CAAS;QACb,WA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C,SAAS,EAAE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC;YAC9D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;SACzD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;CACJ;AAzID,sDAyIC","sourcesContent":["import { ApiSpec, OperationInfo, ResponseInfo } from '../spec/ApiSpec';\nimport { CardRenderer } from './CardRenderer';\nimport { CodeSampleBuilder } from '../samples/CodeSamples';\nimport { ExampleBuilder } from '../spec/ExampleBuilder';\nimport { FieldTreeBuilder } from '../spec/FieldTree';\nimport { FieldTreeRenderer } from './FieldTreeRenderer';\nimport { HeaderListRenderer } from './HeaderListRenderer';\nimport { Html } from './Html';\nimport { JsonNode } from '../spec/JsonNode';\nimport { Layout } from './Layout';\nimport { Markdown } from '../markdown/Markdown';\nimport { SiteUrls } from './SiteUrls';\nimport { SitePage } from './SitePage';\n\n/** The badge a webhook carries everywhere it appears. */\nexport const WEBHOOK_BADGE = 'WEBHOOK';\n\n/**\n * One pre-rendered page per operation, at `reference/<kebab-operation>/index.html`.\n *\n * ## What a WEBHOOK page leaves out, and why\n *\n * No method, no path, no code samples. The url is the PARTNER's — they host the endpoint wherever\n * they choose — so a `POST https://api.example.com/...` sample on a webhook page invites them to\n * call something that does not exist. What it keeps is the payload, because the payload is the part\n * that IS ours, and the event name, because that is what they match on the wire.\n */\nexport class OperationPageRenderer {\n private readonly html = new Html();\n\n constructor(\n private readonly spec: ApiSpec,\n private readonly fields: FieldTreeBuilder,\n private readonly trees: FieldTreeRenderer,\n private readonly markdown: Markdown,\n private readonly cards: CardRenderer,\n private readonly samples: CodeSampleBuilder,\n private readonly examples: ExampleBuilder,\n private readonly layout: Layout,\n private readonly urls: SiteUrls,\n private readonly headers: HeaderListRenderer,\n ) {}\n\n page(operation: OperationInfo): SitePage {\n const url = this.urls.operation(operation);\n const prefix = this.urls.prefixFor(url);\n return new SitePage(\n url,\n operation.name,\n this.layout.render(\n url,\n operation.name,\n this.body(operation, prefix),\n this.cardColumn(operation),\n ),\n );\n }\n\n private body(operation: OperationInfo, prefix: string): string {\n const parts = [this.head(operation), `<h1>${this.html.escape(operation.name)}</h1>`];\n if (operation.description !== '') {\n parts.push(this.markdown.render(operation.description));\n }\n parts.push(this.requestSection(operation, prefix));\n parts.push(this.responseSection(operation, prefix));\n return parts.join('\\n');\n }\n\n /**\n * The badge, the path (or event) and the `operationId`. The page HEADING is the operation's\n * summary (#1296); the operationId stays visible here because it is what a generated client names\n * the method, which is what a developer searches their code for.\n */\n private head(operation: OperationInfo): string {\n const id =\n operation.operationId === ''\n ? ''\n : `<code class=\"op-id\" title=\"operationId\">${this.html.escape(operation.operationId)}</code>`;\n if (operation.isWebhook) {\n return `<div class=\"op-head\"><span class=\"badge\">${WEBHOOK_BADGE}</span><code class=\"op-path\">${this.html.escape(operation.eventName)}</code>${id}</div>`;\n }\n return `<div class=\"op-head\"><span class=\"badge\">${this.html.escape(operation.httpMethod)}</span><code class=\"op-path\">${this.html.escape(operation.path)}</code>${id}</div>`;\n }\n\n /** The request's `in: \"header\"` parameters, then its body — each only when there is one. */\n private requestSection(operation: OperationInfo, prefix: string): string {\n const parts: string[] = [];\n if (operation.requestHeaders.length > 0) {\n parts.push(`<h2>Request headers</h2>${this.headers.render(operation.requestHeaders)}`);\n }\n if (operation.requestSchema !== undefined) {\n parts.push(`<h2>Request body</h2>${this.tree(operation.requestSchema, prefix)}`);\n }\n return parts.join('');\n }\n\n private responseSection(operation: OperationInfo, prefix: string): string {\n if (operation.responses.length === 0) {\n return '';\n }\n const blocks = operation.responses\n .map((response: ResponseInfo): string => this.response(response, prefix))\n .join('');\n return `<h2>Responses</h2>${blocks}`;\n }\n\n private response(response: ResponseInfo, prefix: string): string {\n const summary = `${this.html.escape(response.status)} — ${this.html.escape(response.description)}`;\n const body =\n response.schema === undefined\n ? '<p class=\"field-doc\">No body.</p>'\n : this.tree(response.schema, prefix);\n // The headers ride the card beside the body (#1292) — the response a partner holds carries both.\n const headers = this.headers.render(response.headers);\n return `<details class=\"disclosure\" open><summary>${summary}</summary>${headers}${body}</details>`;\n }\n\n /**\n * A `oneOf` renders as expanded variants; anything else renders as one flat field tree. An INLINE\n * body (#1303) is headed by its `title` and `description` first: it has no schema page, so this\n * page is the only place a reader can see the name a generated client gives it, or its prose.\n */\n private tree(schema: JsonNode, prefix: string): string {\n return this.inlineHead(schema) + this.fieldTree(schema, prefix);\n }\n\n private inlineHead(schema: JsonNode): string {\n const head = this.fields.inlineHeadOf(schema);\n if (head === undefined) {\n return '';\n }\n const title =\n head.title === ''\n ? ''\n : `<p class=\"body-type\"><code title=\"schema title\">${this.html.escape(head.title)}</code></p>`;\n const description =\n head.description === ''\n ? ''\n : `<div class=\"field-doc\">${this.markdown.render(head.description)}</div>`;\n return title + description;\n }\n\n private fieldTree(schema: JsonNode, prefix: string): string {\n const variants = this.fields.variantsOf(schema);\n if (variants.length > 0) {\n return this.trees.renderVariants(\n variants,\n this.fields.discriminatorPropertyOf(schema),\n prefix,\n );\n }\n return this.trees.render(this.fields.fieldsOf(schema), prefix);\n }\n\n private cardColumn(operation: OperationInfo): string {\n const payload = this.examples.render(this.examples.build(operation.requestSchema));\n if (operation.isWebhook) {\n return this.cards.example('EVENT PAYLOAD', payload);\n }\n return [\n this.cards.authorization(operation, this.spec.securitySchemes),\n this.cards.samples(this.samples.samplesFor(operation)),\n ].join('\\n');\n }\n}\n"]}
@@ -31,6 +31,24 @@ export declare class SchemaVariant {
31
31
  readonly fields: readonly FieldNode[];
32
32
  constructor(label: string, discriminatorValue: string, fields: readonly FieldNode[]);
33
33
  }
34
+ /**
35
+ * What an INLINE request or response body says about itself: its `title` and `description`.
36
+ *
37
+ * A generator may define a single-use body inline at its operation rather than as a named component
38
+ * (webpieces does, #1303), keeping the type's name as `title`. Such a body has no schema page, so the
39
+ * operation page is the only place its name and prose can appear.
40
+ */
41
+ export declare class InlineBodyHead {
42
+ /** The schema's `title` — the name a generated client gives the model. Empty when absent. */
43
+ readonly title: string;
44
+ /** The schema's `description`. Empty when absent. */
45
+ readonly description: string;
46
+ constructor(
47
+ /** The schema's `title` — the name a generated client gives the model. Empty when absent. */
48
+ title: string,
49
+ /** The schema's `description`. Empty when absent. */
50
+ description: string);
51
+ }
34
52
  /**
35
53
  * Builds the parameter tree.
36
54
  *
@@ -54,6 +72,11 @@ export declare class FieldTreeBuilder {
54
72
  constructor(lens: SchemaLens);
55
73
  /** The fields of a schema — its own, plus every `allOf` branch's, in declaration order. */
56
74
  fieldsOf(schema: JsonNode): readonly FieldNode[];
75
+ /**
76
+ * The title and description of a body schema written INLINE — `undefined` for a reference (whose
77
+ * prose lives on the referenced schema's own page) and for an inline schema stating neither.
78
+ */
79
+ inlineHeadOf(schema: JsonNode): InlineBodyHead | undefined;
57
80
  /**
58
81
  * The `oneOf` branches of a schema, labelled by the discriminator value that selects each one.
59
82
  * Empty when the schema is not a union, which is what tells a renderer to draw one flat tree.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FieldTreeBuilder = exports.SchemaVariant = exports.FieldNode = void 0;
3
+ exports.FieldTreeBuilder = exports.InlineBodyHead = exports.SchemaVariant = exports.FieldNode = void 0;
4
4
  const SchemaShape_1 = require("./SchemaShape");
5
5
  /**
6
6
  * One row of the parameter tree: the field name, the type label, the prose, and — for an enum — the
@@ -45,6 +45,26 @@ class SchemaVariant {
45
45
  }
46
46
  }
47
47
  exports.SchemaVariant = SchemaVariant;
48
+ /**
49
+ * What an INLINE request or response body says about itself: its `title` and `description`.
50
+ *
51
+ * A generator may define a single-use body inline at its operation rather than as a named component
52
+ * (webpieces does, #1303), keeping the type's name as `title`. Such a body has no schema page, so the
53
+ * operation page is the only place its name and prose can appear.
54
+ */
55
+ class InlineBodyHead {
56
+ title;
57
+ description;
58
+ constructor(
59
+ /** The schema's `title` — the name a generated client gives the model. Empty when absent. */
60
+ title,
61
+ /** The schema's `description`. Empty when absent. */
62
+ description) {
63
+ this.title = title;
64
+ this.description = description;
65
+ }
66
+ }
67
+ exports.InlineBodyHead = InlineBodyHead;
48
68
  /**
49
69
  * Builds the parameter tree.
50
70
  *
@@ -81,6 +101,21 @@ class FieldTreeBuilder {
81
101
  }
82
102
  return fields;
83
103
  }
104
+ /**
105
+ * The title and description of a body schema written INLINE — `undefined` for a reference (whose
106
+ * prose lives on the referenced schema's own page) and for an inline schema stating neither.
107
+ */
108
+ inlineHeadOf(schema) {
109
+ if (this.lens.refTargetOf(schema) !== undefined) {
110
+ return undefined;
111
+ }
112
+ const title = schema.text('title') ?? '';
113
+ const description = schema.text('description') ?? '';
114
+ if (title === '' && description === '') {
115
+ return undefined;
116
+ }
117
+ return new InlineBodyHead(title, description);
118
+ }
84
119
  /**
85
120
  * The `oneOf` branches of a schema, labelled by the discriminator value that selects each one.
86
121
  * Empty when the schema is not a union, which is what tells a renderer to draw one flat tree.
@@ -1 +1 @@
1
- {"version":3,"file":"FieldTree.js","sourceRoot":"","sources":["../../../../../../packages/docs/docs-site/src/spec/FieldTree.ts"],"names":[],"mappings":";;;AAGA,+CAA4C;AAE5C;;;GAGG;AACH,MAAa,SAAS;IAEL;IACA;IACA;IACA;IACA;IAEA;IACA;IARb,YACa,IAAY,EACZ,SAAiB,EACjB,WAAmB,EACnB,QAAiB,EACjB,cAAiC;IAC1C,8FAA8F;IACrF,MAA+B,EAC/B,QAA8B;QAP9B,SAAI,GAAJ,IAAI,CAAQ;QACZ,cAAS,GAAT,SAAS,CAAQ;QACjB,gBAAW,GAAX,WAAW,CAAQ;QACnB,aAAQ,GAAR,QAAQ,CAAS;QACjB,mBAAc,GAAd,cAAc,CAAmB;QAEjC,WAAM,GAAN,MAAM,CAAyB;QAC/B,aAAQ,GAAR,QAAQ,CAAsB;IACxC,CAAC;CACP;AAXD,8BAWC;AAED;;;;;;GAMG;AACH,MAAa,aAAa;IAET;IACA;IACA;IAHb,Y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KAAK,OAAO,EAAE,CAAC;YAChD,MAAM,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;YACnC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,CAAC;QACD,IAAI,QAAQ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAEO,eAAe,CAAC,MAAgB;QACpC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA5GD,4CA4GC","sourcesContent":["import { JsonEntry, JsonNode } from './JsonNode';\nimport { NamedSchema } from './ApiSpec';\nimport { SchemaLens } from './SchemaLens';\nimport { SchemaShape } from './SchemaShape';\n\n/**\n * One row of the parameter tree: the field name, the type label, the prose, and — for an enum — the\n * COMPLETE list of possible values. All four are read from the spec; none is authored here.\n */\nexport class FieldNode {\n constructor(\n readonly name: string,\n readonly typeLabel: string,\n readonly description: string,\n readonly required: boolean,\n readonly possibleValues: readonly string[],\n /** The named object this field's type is, when it has a page of its own. Else `undefined`. */\n readonly linkTo: NamedSchema | undefined,\n readonly children: readonly FieldNode[],\n ) {}\n}\n\n/**\n * One branch of a `oneOf` request body, keyed by its discriminator value.\n *\n * Every branch renders EXPANDED, one after another, rather than behind tabs. A partner writing one\n * handler needs every shape at once — and a tab is invisible to Ctrl-F and to print, so the shapes\n * behind the unselected tabs are, for a reader searching the page, simply not documented.\n */\nexport class SchemaVariant {\n constructor(\n readonly label: string,\n readonly discriminatorValue: string,\n readonly fields: readonly FieldNode[],\n ) {}\n}\n\n/**\n * Builds the parameter tree.\n *\n * ## Two trees on purpose: links here, full resolution in the example\n *\n * Every reference to a named OBJECT renders as a LINK to that object's own page, and the field's\n * children are NOT inlined underneath it — the link IS the expansion. The generated example body\n * (see `ExampleBuilder`) resolves the same references fully instead.\n *\n * Sharing one tree between them is the tempting simplification and it is wrong in both directions.\n * A hyperlink cannot live inside a JSON sample, so a shared tree that links prints `\"data\": {}` on a\n * partner's page; a shared tree that inlines gives every DTO as many copies as it has use sites, and\n * none of them is the page a reader can link to.\n *\n * A named ENUM or scalar alias is NOT linked — it renders inline with its chips, because a page\n * carrying one line of values costs the reader the context they were already reading.\n */\nexport class FieldTreeBuilder {\n private readonly shape = new SchemaShape();\n\n constructor(private readonly lens: SchemaLens) {}\n\n /** The fields of a schema — its own, plus every `allOf` branch's, in declaration order. */\n fieldsOf(schema: JsonNode): readonly FieldNode[] {\n const resolved = this.lens.resolve(schema);\n const fields: FieldNode[] = [];\n for (const branch of resolved.list('allOf')) {\n fields.push(...this.fieldsOf(branch));\n }\n const required = this.requiredNamesOf(resolved);\n for (const property of resolved.at('properties').entries()) {\n fields.push(this.fieldOf(property, required.includes(property.key)));\n }\n return fields;\n }\n\n /**\n * The `oneOf` branches of a schema, labelled by the discriminator value that selects each one.\n * Empty when the schema is not a union, which is what tells a renderer to draw one flat tree.\n */\n variantsOf(schema: JsonNode): readonly SchemaVariant[] {\n const branches = this.lens.branchesOf(schema);\n if (branches.length === 0) {\n return [];\n }\n const mapping = this.lens.resolve(schema).at('discriminator').at('mapping');\n const variants: SchemaVariant[] = [];\n for (const branch of branches) {\n const label = this.lens.label(branch);\n variants.push(\n new SchemaVariant(\n label,\n this.discriminatorValueOf(mapping, label),\n this.fieldsOf(branch),\n ),\n );\n }\n return variants;\n }\n\n /** The `propertyName` a discriminated union switches on, or the empty string when there is none. */\n discriminatorPropertyOf(schema: JsonNode): string {\n return this.lens.resolve(schema).at('discriminator').text('propertyName') ?? '';\n }\n\n private discriminatorValueOf(mapping: JsonNode, typeName: string): string {\n for (const entry of mapping.entries()) {\n const pointer = entry.value.asText();\n if (pointer !== undefined && pointer.endsWith(`/${typeName}`)) {\n return entry.key;\n }\n }\n return '';\n }\n\n private fieldOf(property: JsonEntry, required: boolean): FieldNode {\n const named = this.lens.named(property.value);\n const linked = named !== undefined && named.hasOwnPage ? named : undefined;\n return new FieldNode(\n property.key,\n this.lens.label(property.value),\n this.lens.describe(property.value),\n required,\n this.lens.enumValuesOf(property.value),\n linked ?? this.linkedItemOf(property.value),\n linked === undefined ? this.childrenOf(property.value) : [],\n );\n }\n\n /** For `array<Order>`, the page `Order` lives on — the row links, the array bracket does not. */\n private linkedItemOf(property: JsonNode): NamedSchema | undefined {\n if (this.shape.declaredType(this.lens.resolve(property)) !== 'array') {\n return undefined;\n }\n const named = this.lens.named(this.lens.resolve(property).at('items'));\n return named !== undefined && named.hasOwnPage ? named : undefined;\n }\n\n /**\n * The nested rows of an INLINE shape — an anonymous object, or an array of one. A named object\n * never gets children here; it got a link instead, which is what stops this recursing forever\n * on a self-referential DTO.\n */\n private childrenOf(property: JsonNode): readonly FieldNode[] {\n const resolved = this.lens.resolve(property);\n if (this.shape.declaredType(resolved) === 'array') {\n const items = resolved.at('items');\n return this.lens.named(items) === undefined ? this.fieldsOf(items) : [];\n }\n if (resolved.at('properties').isObject()) {\n return this.fieldsOf(resolved);\n }\n return [];\n }\n\n private requiredNamesOf(schema: JsonNode): readonly string[] {\n const names: string[] = [];\n for (const entry of schema.list('required')) {\n const name = entry.asText();\n if (name !== undefined) {\n names.push(name);\n }\n }\n return names;\n }\n}\n"]}
1
+ {"version":3,"file":"Field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CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,OAAO,EAAE,CAAC;YAChD,MAAM,KAAK,GAAG,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;YACnC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,CAAC;QACD,IAAI,QAAQ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;YACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,EAAE,CAAC;IACd,CAAC;IAEO,eAAe,CAAC,MAAgB;QACpC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5B,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;gBACrB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA5HD,4CA4HC","sourcesContent":["import { JsonEntry, JsonNode } from './JsonNode';\nimport { NamedSchema } from './ApiSpec';\nimport { SchemaLens } from './SchemaLens';\nimport { SchemaShape } from './SchemaShape';\n\n/**\n * One row of the parameter tree: the field name, the type label, the prose, and — for an enum — the\n * COMPLETE list of possible values. All four are read from the spec; none is authored here.\n */\nexport class FieldNode {\n constructor(\n readonly name: string,\n readonly typeLabel: string,\n readonly description: string,\n readonly required: boolean,\n readonly possibleValues: readonly string[],\n /** The named object this field's type is, when it has a page of its own. Else `undefined`. */\n readonly linkTo: NamedSchema | undefined,\n readonly children: readonly FieldNode[],\n ) {}\n}\n\n/**\n * One branch of a `oneOf` request body, keyed by its discriminator value.\n *\n * Every branch renders EXPANDED, one after another, rather than behind tabs. A partner writing one\n * handler needs every shape at once — and a tab is invisible to Ctrl-F and to print, so the shapes\n * behind the unselected tabs are, for a reader searching the page, simply not documented.\n */\nexport class SchemaVariant {\n constructor(\n readonly label: string,\n readonly discriminatorValue: string,\n readonly fields: readonly FieldNode[],\n ) {}\n}\n\n/**\n * What an INLINE request or response body says about itself: its `title` and `description`.\n *\n * A generator may define a single-use body inline at its operation rather than as a named component\n * (webpieces does, #1303), keeping the type's name as `title`. Such a body has no schema page, so the\n * operation page is the only place its name and prose can appear.\n */\nexport class InlineBodyHead {\n constructor(\n /** The schema's `title` — the name a generated client gives the model. Empty when absent. */\n readonly title: string,\n /** The schema's `description`. Empty when absent. */\n readonly description: string,\n ) {}\n}\n\n/**\n * Builds the parameter tree.\n *\n * ## Two trees on purpose: links here, full resolution in the example\n *\n * Every reference to a named OBJECT renders as a LINK to that object's own page, and the field's\n * children are NOT inlined underneath it — the link IS the expansion. The generated example body\n * (see `ExampleBuilder`) resolves the same references fully instead.\n *\n * Sharing one tree between them is the tempting simplification and it is wrong in both directions.\n * A hyperlink cannot live inside a JSON sample, so a shared tree that links prints `\"data\": {}` on a\n * partner's page; a shared tree that inlines gives every DTO as many copies as it has use sites, and\n * none of them is the page a reader can link to.\n *\n * A named ENUM or scalar alias is NOT linked — it renders inline with its chips, because a page\n * carrying one line of values costs the reader the context they were already reading.\n */\nexport class FieldTreeBuilder {\n private readonly shape = new SchemaShape();\n\n constructor(private readonly lens: SchemaLens) {}\n\n /** The fields of a schema — its own, plus every `allOf` branch's, in declaration order. */\n fieldsOf(schema: JsonNode): readonly FieldNode[] {\n const resolved = this.lens.resolve(schema);\n const fields: FieldNode[] = [];\n for (const branch of resolved.list('allOf')) {\n fields.push(...this.fieldsOf(branch));\n }\n const required = this.requiredNamesOf(resolved);\n for (const property of resolved.at('properties').entries()) {\n fields.push(this.fieldOf(property, required.includes(property.key)));\n }\n return fields;\n }\n\n /**\n * The title and description of a body schema written INLINE — `undefined` for a reference (whose\n * prose lives on the referenced schema's own page) and for an inline schema stating neither.\n */\n inlineHeadOf(schema: JsonNode): InlineBodyHead | undefined {\n if (this.lens.refTargetOf(schema) !== undefined) {\n return undefined;\n }\n const title = schema.text('title') ?? '';\n const description = schema.text('description') ?? '';\n if (title === '' && description === '') {\n return undefined;\n }\n return new InlineBodyHead(title, description);\n }\n\n /**\n * The `oneOf` branches of a schema, labelled by the discriminator value that selects each one.\n * Empty when the schema is not a union, which is what tells a renderer to draw one flat tree.\n */\n variantsOf(schema: JsonNode): readonly SchemaVariant[] {\n const branches = this.lens.branchesOf(schema);\n if (branches.length === 0) {\n return [];\n }\n const mapping = this.lens.resolve(schema).at('discriminator').at('mapping');\n const variants: SchemaVariant[] = [];\n for (const branch of branches) {\n const label = this.lens.label(branch);\n variants.push(\n new SchemaVariant(\n label,\n this.discriminatorValueOf(mapping, label),\n this.fieldsOf(branch),\n ),\n );\n }\n return variants;\n }\n\n /** The `propertyName` a discriminated union switches on, or the empty string when there is none. */\n discriminatorPropertyOf(schema: JsonNode): string {\n return this.lens.resolve(schema).at('discriminator').text('propertyName') ?? '';\n }\n\n private discriminatorValueOf(mapping: JsonNode, typeName: string): string {\n for (const entry of mapping.entries()) {\n const pointer = entry.value.asText();\n if (pointer !== undefined && pointer.endsWith(`/${typeName}`)) {\n return entry.key;\n }\n }\n return '';\n }\n\n private fieldOf(property: JsonEntry, required: boolean): FieldNode {\n const named = this.lens.named(property.value);\n const linked = named !== undefined && named.hasOwnPage ? named : undefined;\n return new FieldNode(\n property.key,\n this.lens.label(property.value),\n this.lens.describe(property.value),\n required,\n this.lens.enumValuesOf(property.value),\n linked ?? this.linkedItemOf(property.value),\n linked === undefined ? this.childrenOf(property.value) : [],\n );\n }\n\n /** For `array<Order>`, the page `Order` lives on — the row links, the array bracket does not. */\n private linkedItemOf(property: JsonNode): NamedSchema | undefined {\n if (this.shape.declaredType(this.lens.resolve(property)) !== 'array') {\n return undefined;\n }\n const named = this.lens.named(this.lens.resolve(property).at('items'));\n return named !== undefined && named.hasOwnPage ? named : undefined;\n }\n\n /**\n * The nested rows of an INLINE shape — an anonymous object, or an array of one. A named object\n * never gets children here; it got a link instead, which is what stops this recursing forever\n * on a self-referential DTO.\n */\n private childrenOf(property: JsonNode): readonly FieldNode[] {\n const resolved = this.lens.resolve(property);\n if (this.shape.declaredType(resolved) === 'array') {\n const items = resolved.at('items');\n return this.lens.named(items) === undefined ? this.fieldsOf(items) : [];\n }\n if (resolved.at('properties').isObject()) {\n return this.fieldsOf(resolved);\n }\n return [];\n }\n\n private requiredNamesOf(schema: JsonNode): readonly string[] {\n const names: string[] = [];\n for (const entry of schema.list('required')) {\n const name = entry.asText();\n if (name !== undefined) {\n names.push(name);\n }\n }\n return names;\n }\n}\n"]}