(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[583],{733:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/docs/api/arg-builder",function(){return s(8947)}])},8947:function(e,n,s){"use strict";s.r(n),s.d(n,{__N_SSG:function(){return d},frontmatter:function(){return c}});var i=s(5250),r=s(7160),l=s(3210),d=!0;let c={name:"ArgBuilder",title:"Pothos GraphQL ArgBuilder API",menu:"API",description:"API docs for Pothos ArgBuilder"},o=l.k;function t(e){let n=Object.assign({h1:"h1",h2:"h2",code:"code",ul:"ul",li:"li",h3:"h3",pre:"pre",span:"span",p:"p",a:"a"},(0,r.ah)(),e.components);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.h1,{id:"argbuilder",children:"ArgBuilder"}),"\n",(0,i.jsx)(n.h2,{id:"argoptions",children:(0,i.jsx)(n.code,{children:"arg(options)"})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:[(0,i.jsx)(n.code,{children:"options"}),": [",(0,i.jsx)(n.code,{children:"FieldOptions"}),"]"]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"fieldoptions",children:"FieldOptions"}),"\n",(0,i.jsx)(n.pre,{children:(0,i.jsxs)(n.code,{className:"hljs language-typescript",children:[(0,i.jsx)(n.span,{className:"hljs-keyword",children:"type"})," ",(0,i.jsx)(n.span,{className:"hljs-title class_",children:"FieldOptions"})," = {\n  ",(0,i.jsx)(n.span,{className:"hljs-attr",children:"type"}),": ",(0,i.jsx)(n.span,{className:"hljs-title class_",children:"ReturnType"}),";\n  required?: ",(0,i.jsx)(n.span,{className:"hljs-built_in",children:"boolean"}),";\n  description?: ",(0,i.jsx)(n.span,{className:"hljs-built_in",children:"string"}),";\n  deprecationReason?: ",(0,i.jsx)(n.span,{className:"hljs-built_in",children:"string"}),";\n};\n"]})}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"type"}),": ",(0,i.jsx)(n.a,{href:"./arg-builder#type-parameter",children:"Type Parameter"})]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"required"}),": boolean, defaults to ",(0,i.jsx)(n.code,{children:"false"}),", unless overwritten in SchemaBuilder see"]}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"../guide/changing-default-nullability",children:"Changing Default Nullability"}),"."]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"description"}),": string"]}),"\n"]}),"\n",(0,i.jsxs)(n.li,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"defaultValue"}),": default value for field, type based on ",(0,i.jsx)(n.code,{children:"type"})," option."]}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(n.h3,{id:"type-parameter",children:"Type Parameter"}),"\n",(0,i.jsxs)(n.p,{children:["A Type Parameter for a Field can be any ",(0,i.jsx)(n.code,{children:"InputTypeRef"})," returned by one of the\n",(0,i.jsx)(n.a,{href:"./schema-builder",children:(0,i.jsx)(n.code,{children:"SchemaBuilder"})})," methods for defining an ",(0,i.jsx)(n.code,{children:"InputObject"}),", ",(0,i.jsx)(n.code,{children:"Enum"}),", or ",(0,i.jsx)(n.code,{children:"Scalar"}),", a ts\nenum used to define a graphql enum type, or a string that corresponds to one of they keys of the\n",(0,i.jsx)(n.code,{children:"Scalars"})," object defined in ",(0,i.jsx)(n.code,{children:"SchemaTypes"}),"."]}),"\n",(0,i.jsx)(n.h2,{id:"helpers",children:"helpers"}),"\n",(0,i.jsxs)(n.p,{children:["A set of helpers for creating scalar fields. This work the same as ArgBuilder, but omit the ",(0,i.jsx)(n.code,{children:"type"}),"\nfield from options."]}),"\n",(0,i.jsx)(n.h3,{id:"scalars",children:"Scalars"}),"\n",(0,i.jsxs)(n.ul,{children:["\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.string(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.id(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.boolean(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.int(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.float(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.stringList(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.idList(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.booleanList(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.intList(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.floatList(options)"})}),"\n",(0,i.jsx)(n.li,{children:(0,i.jsx)(n.code,{children:"arg.listRef(type, options)"})}),"\n"]})]})}n.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,i.jsx)(o,Object.assign({},e,{children:(0,i.jsx)(t,e)}))}}},function(e){e.O(0,[8430,3210,9774,2888,179],function(){return e(e.s=733)}),_N_E=e.O()}]);