[{"data":1,"prerenderedAt":721},["ShallowReactive",2],{"docs-nav:en":3,"docs:\u002Fdocs\u002Fschema\u002Fviews":134},[4],{"title":5,"path":6,"stem":7,"children":8},"Docs","\u002Fdocs","docs",[9,12,16,20,24,42,63,92,113],{"title":10,"path":6,"stem":11},"What is Fougere","docs\u002Findex",{"title":13,"path":14,"stem":15},"Getting started","\u002Fdocs\u002Fgetting-started","docs\u002F01.getting-started",{"title":17,"path":18,"stem":19},"Existing Nuxt app","\u002Fdocs\u002Fexisting-app","docs\u002F02.existing-app",{"title":21,"path":22,"stem":23},"The CLI","\u002Fdocs\u002Fcli","docs\u002F03.cli",{"title":25,"path":26,"stem":27,"children":28,"page":41},"Concepts","\u002Fdocs\u002Fconcepts","docs\u002F2.concepts",[29,33,37],{"title":30,"path":31,"stem":32},"Philosophy","\u002Fdocs\u002Fconcepts\u002Fphilosophy","docs\u002F2.concepts\u002F1.philosophy",{"title":34,"path":35,"stem":36},"The Frond","\u002Fdocs\u002Fconcepts\u002Ffrond","docs\u002F2.concepts\u002F2.frond",{"title":38,"path":39,"stem":40},"The shortest path","\u002Fdocs\u002Fconcepts\u002Fshortest-path","docs\u002F2.concepts\u002F3.shortest-path",false,{"title":43,"path":44,"stem":45,"children":46,"page":41},"Schema","\u002Fdocs\u002Fschema","docs\u002F3.schema",[47,51,55,59],{"title":48,"path":49,"stem":50},"Entities","\u002Fdocs\u002Fschema\u002Fentities","docs\u002F3.schema\u002F1.entities",{"title":52,"path":53,"stem":54},"Views","\u002Fdocs\u002Fschema\u002Fviews","docs\u002F3.schema\u002F2.views",{"title":56,"path":57,"stem":58},"The identity card","\u002Fdocs\u002Fschema\u002Fcard","docs\u002F3.schema\u002F3.card",{"title":60,"path":61,"stem":62},"Standard Schema","\u002Fdocs\u002Fschema\u002Fstandard-schema","docs\u002F3.schema\u002F4.standard-schema",{"title":64,"path":65,"stem":66,"children":67,"page":41},"Business","\u002Fdocs\u002Fbusiness","docs\u002F4.business",[68,72,76,80,84,88],{"title":69,"path":70,"stem":71},"Handlers","\u002Fdocs\u002Fbusiness\u002Fhandlers","docs\u002F4.business\u002F1.handlers",{"title":73,"path":74,"stem":75},"Presenters","\u002Fdocs\u002Fbusiness\u002Fpresenters","docs\u002F4.business\u002F2.presenters",{"title":77,"path":78,"stem":79},"Collectors","\u002Fdocs\u002Fbusiness\u002Fcollectors","docs\u002F4.business\u002F3.collectors",{"title":81,"path":82,"stem":83},"Errors","\u002Fdocs\u002Fbusiness\u002Ferrors","docs\u002F4.business\u002F4.errors",{"title":85,"path":86,"stem":87},"Seeds","\u002Fdocs\u002Fbusiness\u002Fseeds","docs\u002F4.business\u002F5.seeds",{"title":89,"path":90,"stem":91},"Facts","\u002Fdocs\u002Fbusiness\u002Ffacts","docs\u002F4.business\u002F6.facts",{"title":93,"path":94,"stem":95,"children":96,"page":41},"Client","\u002Fdocs\u002Fclient","docs\u002F5.client",[97,101,105,109],{"title":98,"path":99,"stem":100},"Queries & commands","\u002Fdocs\u002Fclient\u002Fqueries-commands","docs\u002F5.client\u002F1.queries-commands",{"title":102,"path":103,"stem":104},"Forms","\u002Fdocs\u002Fclient\u002Fforms","docs\u002F5.client\u002F2.forms",{"title":106,"path":107,"stem":108},"Session","\u002Fdocs\u002Fclient\u002Fsession","docs\u002F5.client\u002F3.session",{"title":110,"path":111,"stem":112},"invoke","\u002Fdocs\u002Fclient\u002Finvoke","docs\u002F5.client\u002F4.invoke",{"title":114,"path":115,"stem":116,"children":117,"page":41},"Infrastructure","\u002Fdocs\u002Finfra","docs\u002F6.infra",[118,122,126,130],{"title":119,"path":120,"stem":121},"The gradient","\u002Fdocs\u002Finfra\u002Fgradient","docs\u002F6.infra\u002F1.gradient",{"title":123,"path":124,"stem":125},"Surfaces — REST & GraphQL","\u002Fdocs\u002Finfra\u002Fsurfaces","docs\u002F6.infra\u002F2.surfaces",{"title":127,"path":128,"stem":129},"Deployment","\u002Fdocs\u002Finfra\u002Fdeployment","docs\u002F6.infra\u002F3.deployment",{"title":131,"path":132,"stem":133},"Hosts","\u002Fdocs\u002Finfra\u002Fhosts","docs\u002F6.infra\u002F4.hosts",{"id":135,"title":52,"body":136,"description":716,"extension":717,"meta":718,"navigation":249,"path":53,"seo":719,"stem":54,"__hash__":720},"docs_en\u002Fdocs\u002F3.schema\u002F2.views.md",{"type":137,"value":138,"toc":710},"minimark",[139,143,147,362,376,381,449,456,460,501,505,508,549,563,567,583,605,608,636,639,686,700,706],[140,141,52],"h1",{"id":142},"views",[144,145,146],"p",{},"A view is a schema class created from an entity:",[148,149,154],"pre",{"className":150,"code":151,"language":152,"meta":153,"style":153},"language-ts shiki shiki-themes material-theme-lighter github-light github-dark","\u002F** What an author may write. *\u002F\nexport class PostDraft extends Post.pick('slug', 'title', 'summary', 'body') {}\n\n\u002F** What the public index shows — no body. *\u002F\nexport class PostCard extends Post.pick('id', 'slug', 'title', 'summary', 'publishedAt') {}\n\n\u002F** Input of a custom read operation. *\u002F\nexport class BySlugInput extends Post.pick('slug') {}\n","ts","",[155,156,157,166,244,251,257,321,326,332],"code",{"__ignoreMap":153},[158,159,162],"span",{"class":160,"line":161},"line",1,[158,163,165],{"class":164},"sutJx","\u002F** What an author may write. *\u002F\n",[158,167,169,173,177,181,184,188,192,196,199,203,207,209,212,215,218,220,222,224,227,229,231,233,236,238,241],{"class":160,"line":168},2,[158,170,172],{"class":171},"sVHd0","export",[158,174,176],{"class":175},"sbsja"," class",[158,178,180],{"class":179},"sbgvK"," PostDraft",[158,182,183],{"class":175}," extends",[158,185,187],{"class":186},"su5hD"," Post",[158,189,191],{"class":190},"sP7_E",".",[158,193,195],{"class":194},"sGLFI","pick",[158,197,198],{"class":186},"(",[158,200,202],{"class":201},"sjJ54","'",[158,204,206],{"class":205},"s_sjI","slug",[158,208,202],{"class":201},[158,210,211],{"class":190},",",[158,213,214],{"class":201}," '",[158,216,217],{"class":205},"title",[158,219,202],{"class":201},[158,221,211],{"class":190},[158,223,214],{"class":201},[158,225,226],{"class":205},"summary",[158,228,202],{"class":201},[158,230,211],{"class":190},[158,232,214],{"class":201},[158,234,235],{"class":205},"body",[158,237,202],{"class":201},[158,239,240],{"class":186},") ",[158,242,243],{"class":190},"{}\n",[158,245,247],{"class":160,"line":246},3,[158,248,250],{"emptyLinePlaceholder":249},true,"\n",[158,252,254],{"class":160,"line":253},4,[158,255,256],{"class":164},"\u002F** What the public index shows — no body. *\u002F\n",[158,258,260,262,264,267,269,271,273,275,277,279,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,312,315,317,319],{"class":160,"line":259},5,[158,261,172],{"class":171},[158,263,176],{"class":175},[158,265,266],{"class":179}," PostCard",[158,268,183],{"class":175},[158,270,187],{"class":186},[158,272,191],{"class":190},[158,274,195],{"class":194},[158,276,198],{"class":186},[158,278,202],{"class":201},[158,280,281],{"class":205},"id",[158,283,202],{"class":201},[158,285,211],{"class":190},[158,287,214],{"class":201},[158,289,206],{"class":205},[158,291,202],{"class":201},[158,293,211],{"class":190},[158,295,214],{"class":201},[158,297,217],{"class":205},[158,299,202],{"class":201},[158,301,211],{"class":190},[158,303,214],{"class":201},[158,305,226],{"class":205},[158,307,202],{"class":201},[158,309,211],{"class":190},[158,311,214],{"class":201},[158,313,314],{"class":205},"publishedAt",[158,316,202],{"class":201},[158,318,240],{"class":186},[158,320,243],{"class":190},[158,322,324],{"class":160,"line":323},6,[158,325,250],{"emptyLinePlaceholder":249},[158,327,329],{"class":160,"line":328},7,[158,330,331],{"class":164},"\u002F** Input of a custom read operation. *\u002F\n",[158,333,335,337,339,342,344,346,348,350,352,354,356,358,360],{"class":160,"line":334},8,[158,336,172],{"class":171},[158,338,176],{"class":175},[158,340,341],{"class":179}," BySlugInput",[158,343,183],{"class":175},[158,345,187],{"class":186},[158,347,191],{"class":190},[158,349,195],{"class":194},[158,351,198],{"class":186},[158,353,202],{"class":201},[158,355,206],{"class":205},[158,357,202],{"class":201},[158,359,240],{"class":186},[158,361,243],{"class":190},[144,363,364,365,368,369,372,373,191],{},"A view is a full schema class: it has ",[155,366,367],{},"getFields()",", ",[155,370,371],{},"validate()",", and is usable as a\nTypeScript type. Views chain: ",[155,374,375],{},"Post.pick(…).partial()",[377,378,380],"h2",{"id":379},"the-four-derivations","The four derivations",[382,383,384,397],"table",{},[385,386,387],"thead",{},[388,389,390,394],"tr",{},[391,392,393],"th",{},"Derivation",[391,395,396],{},"Produces",[398,399,400,411,421,431],"tbody",{},[388,401,402,408],{},[403,404,405],"td",{},[155,406,407],{},"Post.pick('a', 'b')",[403,409,410],{},"only those fields",[388,412,413,418],{},[403,414,415],{},[155,416,417],{},"Post.omit('a')",[403,419,420],{},"all fields but those",[388,422,423,428],{},[403,424,425],{},[155,426,427],{},"Post.partial()",[403,429,430],{},"every field optional: an absent field is not updated",[388,432,433,438],{},[403,434,435],{},[155,436,437],{},"Post.extend({ extra: text() })",[403,439,440,441,444,445,448],{},"entity plus new fields (how ",[155,442,443],{},"User"," extends ",[155,446,447],{},"AuthUser",")",[144,450,451,452,455],{},"The ",[155,453,454],{},"partial"," mode is retained when the view is used as an operation input.",[377,457,459],{"id":458},"where-views-plug-in","Where views plug in",[461,462,463,475,491],"ul",{},[464,465,466,470,471,474],"li",{},[467,468,469],"strong",{},"Handler inputs"," — declare the view as the parameter type; the façade validates the\nwire body against it before your code runs (",[472,473,69],"a",{"href":70},").",[464,476,477,480,481,484,485,488,489,474],{},[467,478,479],{},"Handler outputs"," — ",[155,482,483],{},"Crud(Post, { list: PostCard })"," names one op's view;\n",[155,486,487],{},"Crud(Post, PostPublic)"," scopes the whole handler (",[472,490,69],{"href":70},[464,492,493,480,495,498,499,474],{},[467,494,102],{},[155,496,497],{},"useFormFor(PostDraft)"," derives its fields from the view (",[472,500,102],{"href":103},[377,502,504],{"id":503},"the-io-projections","The io projections",[144,506,507],{},"The boundary axis derives two field sets used by every surface:",[148,509,511],{"className":150,"code":510,"language":152,"meta":153,"style":153},"inputFields(Post.getFields())    \u002F\u002F fields a client may WRITE  — readOnly excluded\noutputFields(Post.getFields())   \u002F\u002F fields a client may READ   — writeOnly excluded\n",[155,512,513,532],{"__ignoreMap":153},[158,514,515,518,521,523,526,529],{"class":160,"line":161},[158,516,517],{"class":194},"inputFields",[158,519,520],{"class":186},"(Post",[158,522,191],{"class":190},[158,524,525],{"class":194},"getFields",[158,527,528],{"class":186},"())    ",[158,530,531],{"class":164},"\u002F\u002F fields a client may WRITE  — readOnly excluded\n",[158,533,534,537,539,541,543,546],{"class":160,"line":168},[158,535,536],{"class":194},"outputFields",[158,538,520],{"class":186},[158,540,191],{"class":190},[158,542,525],{"class":194},[158,544,545],{"class":186},"())   ",[158,547,548],{"class":164},"\u002F\u002F fields a client may READ   — writeOnly excluded\n",[144,550,551,552,555,556,559,560,562],{},"This is why a form built on ",[155,553,554],{},"Post"," does not show ",[155,557,558],{},"status"," or ",[155,561,314],{}," inputs, without\nadditional per-form configuration.",[377,564,566],{"id":565},"choosing-between-a-field-and-a-view","Choosing between a field and a view",[144,568,569,572,573,576,577,572,579,582],{},[155,570,571],{},"readOnly"," \u002F ",[155,574,575],{},"writeOnly"," and ",[155,578,195],{},[155,580,581],{},"omit"," can all remove a field from a surface, but\ntheir scope differs.",[461,584,585,595],{},[464,586,587,590,591,594],{},[467,588,589],{},"boundary"," (on the field) defines a global rule. With ",[155,592,593],{},"writeOnly(password)",", the\npassword is excluded from every output.",[464,596,597,600,601,604],{},[467,598,599],{},"pick \u002F omit"," (on a view) selects fields for a specific use. For example,\n",[155,602,603],{},"Post.pick('id', 'title')"," defines the public index response.",[144,606,607],{},"The two mechanisms are complementary.",[461,609,610,620],{},[464,611,612,613,615,616,619],{},"Without ",[155,614,575],{}," on the field, every output view would need to omit ",[155,617,618],{},"password",". The\nglobal rule prevents that omission.",[464,621,622,623,368,625,627,628,631,632,635],{},"A public response (",[155,624,281],{},[155,626,217],{},") and an admin response (",[155,629,630],{},"+ authorEmail",") instead need\ndifferent views: ",[155,633,634],{},"authorEmail"," is included or excluded depending on the use.",[144,637,638],{},"Choose based on the rule's scope: global or specific to one use.",[382,640,641,654],{},[385,642,643],{},[388,644,645,648,651],{},[391,646,647],{},"The fact is…",[391,649,650],{},"It lives…",[391,652,653],{},"Example",[398,655,656,671],{},[388,657,658,661,668],{},[403,659,660],{},"true everywhere (invariant)",[403,662,663,664,572,666],{},"on the field — ",[155,665,571],{},[155,667,575],{},[403,669,670],{},"a password never leaves",[388,672,673,676,683],{},[403,674,675],{},"true for one use (local)",[403,677,678,679,572,681],{},"in a derivation — ",[155,680,195],{},[155,682,581],{},[403,684,685],{},"this endpoint returns only id + title",[144,687,688,689,691,692,695,696,699],{},"A ",[155,690,589],{}," rule is serialized in the ",[472,693,694],{"href":57},"card"," under\n",[155,697,698],{},"x-fougere.boundary",", so a consumer in another language can apply it. A view derived in\nTypeScript is not serialized.",[144,701,702,703,705],{},"Next: ",[472,704,56],{"href":57}," — the schema's portable form.",[707,708,709],"style",{},"html pre.shiki code .sutJx, html code.shiki .sutJx{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#6A737D;--shiki-dark-font-style:inherit}html pre.shiki code .sVHd0, html code.shiki .sVHd0{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#D73A49;--shiki-default-font-style:inherit;--shiki-dark:#F97583;--shiki-dark-font-style:inherit}html pre.shiki code .sbsja, html code.shiki .sbsja{--shiki-light:#9C3EDA;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sbgvK, html code.shiki .sbgvK{--shiki-light:#E2931D;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .su5hD, html code.shiki .su5hD{--shiki-light:#90A4AE;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sP7_E, html code.shiki .sP7_E{--shiki-light:#39ADB5;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sGLFI, html code.shiki .sGLFI{--shiki-light:#6182B8;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sjJ54, html code.shiki .sjJ54{--shiki-light:#39ADB5;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s_sjI, html code.shiki .s_sjI{--shiki-light:#91B859;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":153,"searchDepth":168,"depth":168,"links":711},[712,713,714,715],{"id":379,"depth":168,"text":380},{"id":458,"depth":168,"text":459},{"id":503,"depth":168,"text":504},{"id":565,"depth":168,"text":566},"Create input and output schemas with pick, omit, partial, and extend.","md",{},{"title":52,"description":716},"BMCTh_rTceVnJwlqBftJ2JVby2Y0FGOU5473n6zGMog",1786637819120]