@fern-api/java-dynamic-snippets 0.0.9 → 0.0.10
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/cjs/DynamicSnippetsGenerator.cjs +6 -6
- package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
- package/cjs/DynamicSnippetsGenerator.d.cts +2 -1
- package/cjs/EndpointSnippetGenerator.cjs +5 -5
- package/cjs/EndpointSnippetGenerator.cjs.map +1 -1
- package/cjs/EndpointSnippetGenerator.d.cts +6 -1
- package/cjs/index.cjs +6 -6
- package/cjs/index.cjs.map +1 -1
- package/esm/DynamicSnippetsGenerator.d.ts +2 -1
- package/esm/DynamicSnippetsGenerator.js +1 -1
- package/esm/EndpointSnippetGenerator.d.ts +6 -1
- package/esm/EndpointSnippetGenerator.js +1 -1
- package/esm/chunk-4QLR5DTX.js +2 -0
- package/esm/chunk-4QLR5DTX.js.map +1 -0
- package/esm/chunk-7WSHDZU7.js +2 -0
- package/esm/chunk-7WSHDZU7.js.map +1 -0
- package/esm/chunk-BBI27KDS.js +2 -0
- package/esm/chunk-BBI27KDS.js.map +1 -0
- package/esm/{chunk-Z267S5KO.js → chunk-L6ZZLSD5.js} +2 -2
- package/esm/{chunk-V3XTHNV6.js → chunk-UPS2GJ7D.js} +2 -2
- package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
- package/esm/context/DynamicTypeLiteralMapper.js +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
- package/esm/chunk-5HAATWAD.js +0 -2
- package/esm/chunk-5HAATWAD.js.map +0 -1
- package/esm/chunk-DD37GKIE.js +0 -2
- package/esm/chunk-DD37GKIE.js.map +0 -1
- package/esm/chunk-PRMFZOQO.js +0 -2
- package/esm/chunk-PRMFZOQO.js.map +0 -1
- /package/esm/{chunk-Z267S5KO.js.map → chunk-L6ZZLSD5.js.map} +0 -0
- /package/esm/{chunk-V3XTHNV6.js.map → chunk-UPS2GJ7D.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/DynamicSnippetsGenerator.ts"],"sourcesContent":["import {\n AbstractDynamicSnippetsGenerator,\n AbstractFormatter,\n FernGeneratorExec,\n Options\n} from \"@fern-api/browser-compatible-base-generator\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { EndpointSnippetGenerator } from \"./EndpointSnippetGenerator\";\n\nexport class DynamicSnippetsGenerator extends AbstractDynamicSnippetsGenerator<\n DynamicSnippetsGeneratorContext,\n EndpointSnippetGenerator\n> {\n private formatter: AbstractFormatter | undefined;\n\n constructor({\n ir,\n config,\n options = {}\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n options?: Options;\n }) {\n super(new DynamicSnippetsGeneratorContext({ ir, config, options }));\n }\n\n public async generate(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<FernIr.dynamic.EndpointSnippetResponse> {\n return super.generate(request, options);\n }\n\n public generateSync(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): FernIr.dynamic.EndpointSnippetResponse {\n return super.generateSync(request, options);\n }\n\n protected createSnippetGenerator(context: DynamicSnippetsGeneratorContext): EndpointSnippetGenerator {\n return new EndpointSnippetGenerator({ context });\n }\n}\n"],"mappings":"yKAAAA,IAAAC,IAUO,IAAMC,EAAN,cAAuCC,CAG5C,CAGE,YAAY,CACR,GAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,CAAC,CACf,EAIG,CACC,MAAM,IAAIC,EAAgC,CAAE,GAAAH,EAAI,OAAAC,EAAQ,QAAAC,CAAQ,CAAC,CAAC,EAXtEE,EAAA,KAAQ,YAYR,CAEA,MAAa,SACTC,EACAH,EAAmB,CAAC,EAC2B,CAC/C,OAAO,MAAM,SAASG,EAASH,CAAO,CAC1C,CAEO,aACHG,EACAH,EAAmB,CAAC,EACkB,CACtC,OAAO,MAAM,aAAaG,EAASH,CAAO,CAC9C,CAEU,uBAAuBI,EAAoE,CACjG,OAAO,IAAIC,EAAyB,CAAE,QAAAD,CAAQ,CAAC,CACnD,CACJ","names":["init_process","init_buffer","DynamicSnippetsGenerator","AbstractDynamicSnippetsGenerator","ir","config","options","DynamicSnippetsGeneratorContext","__publicField","request","context","EndpointSnippetGenerator"]}
|
package/esm/chunk-DD37GKIE.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as m,b as R}from"./chunk-JWUP3MFF.js";import{a as T,b as S,c as b,d as A,f as l,h as a,i as p}from"./chunk-2U3YQWRZ.js";a();p();a();p();var y=class{constructor(){l(this,"reporter");l(this,"snippet");l(this,"err");this.snippet=void 0,this.reporter=void 0,this.err=void 0}update({context:e,snippet:r}){this.shouldUpdate({snippet:r,reporter:e.errors})&&(this.reporter=e.errors.clone(),this.snippet=r)}getResponseOrThrow({endpoint:e}){var r;if(this.snippet!=null&&this.reporter!=null)return{snippet:this.snippet,errors:this.reporter.toDynamicSnippetErrors()};throw(r=this.err)!=null?r:new Error(`Failed to generate snippet for endpoint "${e.method} ${e.path}"`)}shouldUpdate({snippet:e,reporter:r}){var t,n;return this.reporter==null||this.reporter.size()>0&&r.size()===0?!0:e.length>((n=(t=this.snippet)==null?void 0:t.length)!=null?n:0)}};var E=class{constructor(e){l(this,"context");this.context=e}async generate(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=await d.generateSnippet({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}generateSync(e,r={}){let t=this.context.resolveEndpointLocationOrThrow(e.endpoint);if(t.length===0)throw new Error(`No endpoints found that match "${e.endpoint.method} ${e.endpoint.path}"`);let n=new y;for(let i of t){let s=this.context.clone(),d=this.createSnippetGenerator(s);try{let u=d.generateSnippetSync({endpoint:i,request:e,options:r});if(s.errors.empty())return{snippet:u,errors:void 0};n.update({context:s,snippet:u})}catch(u){n.err==null&&(n.err=u)}}return n.getResponseOrThrow({endpoint:e.endpoint})}};a();p();var o={Critical:"CRITICAL",Warning:"WARNING"},v=class c{constructor(){l(this,"errors");l(this,"path");this.errors=[],this.path=[]}add(e){this.errors.push(S(T({},e),{path:[...this.path]}))}scope(e){this.path.push(e)}unscope(){this.path.pop()}getBySeverity(e){return this.errors.filter(r=>r.severity===e)}empty(){return this.errors.length===0}size(){return this.errors.length}clone(){let e=new c;return e.errors=[...this.errors],e.path=[...this.path],e}reset(){this.errors=[],this.path=[]}toDynamicSnippetErrors(){return this.errors.map(e=>({severity:e.severity,path:e.path!=null?this.pathToStringArray(e.path):void 0,message:e.message}))}pathToStringArray(e){let r=[];for(let t of e){if(typeof t=="string"){r.push(t);continue}r[r.length-1]+=`[${t.index}]`}return r}};a();p();a();p();a();p();var g=class{constructor(){l(this,"REFERENCE_REGEX",/^(GET|POST|PUT|DELETE|PATCH|HEAD)\s(\/\S*)$/)}validate(e){return this.REFERENCE_REGEX.test(e)?{type:"valid"}:{type:"invalid"}}tryParse(e){if(this.validate(e).type==="invalid")return;let t=e.match(this.REFERENCE_REGEX);if(!(t==null||t[1]==null||t[2]==null))return{method:t[1],path:t[2]}}};var w=class{constructor({ir:e,config:r,options:t={}}){l(this,"config");l(this,"options");l(this,"errors");l(this,"_ir");l(this,"httpEndpointReferenceParser");this._ir=e,this.config=r,this.options=t,this.errors=new v,this.httpEndpointReferenceParser=new g}associateQueryParametersByWireValue({parameters:e,values:r}){let t=[];for(let[n,i]of Object.entries(r)){this.errors.scope(n);try{let s=e.find(u=>u.name.wireValue===n);if(s==null)throw this.newParameterNotRecognizedError(n);let d=this.isListTypeReference(s.typeReference)&&!Array.isArray(i)?[i]:i;t.push({name:s.name,typeReference:s.typeReference,value:d})}finally{this.errors.unscope()}}return t}associateByWireValueOrDefault({parameters:e,values:r}){let t=[];for(let n of e){this.errors.scope(n.name.wireValue);try{let i=r[n.name.wireValue];if(i==null)if(n.typeReference.type==="primitive"&&n.typeReference.value==="STRING")i=`<${n.name.wireValue}>`;else{this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n.name.wireValue).message});continue}t.push({name:n.name,typeReference:n.typeReference,value:i})}finally{this.errors.unscope()}}return t}associateByWireValue({parameters:e,values:r,ignoreMissingParameters:t}){let n=[];for(let[i,s]of Object.entries(r)){this.errors.scope(i);try{let d=e.find(u=>u.name.wireValue===i);if(d==null){if(t)continue;this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(i).message});continue}n.push({name:d.name,typeReference:d.typeReference,value:s})}finally{this.errors.unscope()}}return n}getExampleObjectProperties({parameters:e,snippetObject:r}){let t=typeof r=="object"&&r!==null&&!Array.isArray(r)?r:{},n=[];for(let i of e){let s=t[i.name.wireValue];s==null?i.typeReference.type==="nullable"&&n.push({name:i.name,typeReference:i.typeReference,value:null}):n.push({name:i.name,typeReference:i.typeReference,value:s})}return n}getSingleFileValue({property:e,record:r}){let t=r[e.wireValue];if(t!=null){if(typeof t!="string"){this.errors.add({severity:o.Critical,message:`Expected file value to be a string, got ${typeof t}`});return}return t}}getFileArrayValues({property:e,record:r}){let t=r[e.wireValue];if(t==null)return;if(!Array.isArray(t)){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof t}`});return}let n=[];for(let i of t){if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected file array value to be an array of strings, got ${typeof i}`});return}n.push(i)}return n}getRecord(e){if(typeof e!="object"||Array.isArray(e)){this.errors.add({severity:o.Critical,message:`Expected object with key, value pairs but got: ${Array.isArray(e)?"array":typeof e}`});return}return e==null?{}:e}resolveNamedType({typeId:e}){let r=this._ir.types[e];if(r==null){this.errors.add({severity:o.Critical,message:`Type identified by "${e}" could not be found`});return}return r}resolveDiscriminatedUnionTypeInstance({discriminatedUnion:e,value:r}){let t=this.getRecord(r);if(t==null)return;let n=e.discriminant.wireValue,i=t[n];if(i==null){this.errors.add({severity:o.Critical,message:this.newParameterNotRecognizedError(n).message});return}if(typeof i!="string"){this.errors.add({severity:o.Critical,message:`Expected discriminant value to be a string but got: ${typeof i}`});return}let s=e.types[i];if(s==null){this.errors.add({severity:o.Critical,message:`No type found for discriminant value "${i}"`});return}let P=t,{[n]:d}=P,u=A(P,[b(n)]);return{singleDiscriminatedUnionType:s,discriminantValue:s.discriminantValue,value:u}}resolveEndpointOrThrow(e){let r=this.httpEndpointReferenceParser.tryParse(e);if(r==null)throw new Error(`Failed to parse endpoint reference "${e}"`);return this.resolveEndpointLocationOrThrow(r)}resolveEndpointLocation(e){let r=[];for(let t of Object.values(this._ir.endpoints))this.parsedEndpointMatches({endpoint:t,parsedEndpoint:e})&&r.push(t);return r}resolveEndpointLocationOrThrow(e){let r=this.resolveEndpointLocation(e);if(r.length===0)throw new Error(`Failed to find endpoint identified by "${e.method} ${e.path}"`);return r}needsRequestParameter({request:e,inlinePathParameters:r,inlineFileProperties:t}){var n;return this.includePathParametersInWrappedRequest({request:e,inlinePathParameters:r})||e.queryParameters!=null&&e.queryParameters.length>0||e.headers!=null&&e.headers.length>0?!0:e.body!=null?this.includeRequestBodyInWrappedRequest({body:e.body,inlineFileProperties:t}):!((n=e.metadata)!=null&&n.onlyPathParameters)}includePathParametersInWrappedRequest({request:e,inlinePathParameters:r}){var t,n;return r&&((n=(t=e.metadata)==null?void 0:t.includePathParameters)!=null?n:!1)}isFileUploadRequestBody(e){switch(e.type){case"fileUpload":return!0;case"properties":case"referenced":return!1;default:m(e)}}resolveEnvironmentName(e){if(this._ir.environments==null)return;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}case"multipleBaseUrls":{let t=r.environments.find(n=>n.id===e);return t==null?void 0:t.name}default:m(r)}}isSingleEnvironmentID(e){return typeof e=="string"}isMultiEnvironmentValues(e){return typeof e=="object"}validateMultiEnvironmentUrlValues(e){if(this._ir.environments==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;let r=this._ir.environments.environments;switch(r.type){case"singleBaseUrl":return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported for single base URL environments; use the baseUrl option instead"}),!1;case"multipleBaseUrls":{let t=r.environments[0];if(t==null)return this.errors.add({severity:o.Critical,message:"Multiple environments are not supported; use the baseUrl option instead"}),!1;let n=new Set(R(t.urls));for(let i of R(e))n.has(i)&&n.delete(i);return n.size>0?(this.errors.add({severity:o.Critical,message:`The provided environments are invalid; got: [${Object.keys(e).join(", ")}], expected: [${R(t.urls).join(", ")}]`}),!1):!0}}}getValueAsNumber({value:e}){if(typeof e!="number"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"number",value:e}).message});return}return e}getValueAsBoolean({value:e}){if(typeof e!="boolean"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"boolean",value:e}).message});return}return e}getValueAsString({value:e}){if(typeof e!="string"){this.errors.add({severity:o.Critical,message:this.newTypeMismatchError({expected:"string",value:e}).message});return}return e}isOptional(e){switch(e.type){case"nullable":return this.isOptional(e.value);case"optional":return!0;case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}isNullable(e){switch(e.type){case"nullable":return!0;case"optional":return this.isNullable(e.value);case"named":{let r=this.resolveNamedType({typeId:e.value});return r==null?!1:r.type==="alias"?this.isNullable(r.typeReference):!1}}return!1}newAuthMismatchError({auth:e,values:r}){return new Error(`Expected auth type ${e.type}, got ${r.type}`)}newParameterNotRecognizedError(e){return new Error(`"${e}" is not a recognized parameter for this endpoint`)}newTypeMismatchError({expected:e,value:r}){return new Error(`Expected ${e}, got ${typeof r}`)}includeRequestBodyInWrappedRequest({body:e,inlineFileProperties:r}){switch(e.type){case"properties":case"referenced":return!0;case"fileUpload":return this.includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r});default:m(e)}}includeFileUploadBodyInWrappedRequest({fileUpload:e,inlineFileProperties:r}){return this.fileUploadHasBodyProperties({fileUpload:e})||r&&this.fileUploadHasFileProperties({fileUpload:e})}fileUploadHasBodyProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!1;case"bodyProperty":return!0;default:m(r)}})}fileUploadHasFileProperties({fileUpload:e}){return e.properties.some(r=>{switch(r.type){case"file":case"fileArray":return!0;case"bodyProperty":return!1;default:m(r)}})}isListTypeReference(e){return e.type==="optional"?this.isListTypeReference(e.value):e.type==="list"||e.type==="set"}parsedEndpointMatches({endpoint:e,parsedEndpoint:r}){return e.location.method===r.method&&e.location.path===r.path}};a();p();var x;(function(c){c.Concise="concise",c.Full="full"})(x||(x={}));a();p();var C={PathParameters:"pathParameters",QueryParameters:"queryParameters",Headers:"headers",RequestBody:"requestBody"};a();p();export{E as a,o as b,w as c,x as d,C as e};
|
|
2
|
-
//# sourceMappingURL=chunk-DD37GKIE.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGenerator.ts","../../../../browser-compatible-base/src/dynamic-snippets/Result.ts","../../../../browser-compatible-base/src/dynamic-snippets/ErrorReporter.ts","../../../../browser-compatible-base/src/dynamic-snippets/AbstractDynamicSnippetsGeneratorContext.ts","../../../../../packages/cli/fern-definition/schema/src/index.ts","../../../../../packages/cli/fern-definition/schema/src/utils/HttpEndpointReferenceParser.ts","../../../../browser-compatible-base/src/dynamic-snippets/Options.ts","../../../../browser-compatible-base/src/dynamic-snippets/Scope.ts","../../../../browser-compatible-base/src/dynamic-snippets/index.ts"],"sourcesContent":["import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\n\nimport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nimport { AbstractEndpointSnippetGenerator } from \"./AbstractEndpointSnippetGenerator\";\nimport { Options } from \"./Options\";\nimport { Result } from \"./Result\";\n\nexport abstract class AbstractDynamicSnippetsGenerator<\n Context extends AbstractDynamicSnippetsGeneratorContext,\n EndpointSnippetGenerator extends AbstractEndpointSnippetGenerator<Context>\n> {\n public constructor(public readonly context: Context) {}\n\n protected abstract createSnippetGenerator(context: Context): EndpointSnippetGenerator;\n\n public async generate(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): Promise<FernIr.dynamic.EndpointSnippetResponse> {\n const endpoints = this.context.resolveEndpointLocationOrThrow(request.endpoint);\n if (endpoints.length === 0) {\n throw new Error(`No endpoints found that match \"${request.endpoint.method} ${request.endpoint.path}\"`);\n }\n const result = new Result();\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const snippet = await snippetGenerator.generateSnippet({ endpoint, request, options });\n if (context.errors.empty()) {\n return {\n snippet,\n errors: undefined\n };\n }\n result.update({ context, snippet });\n } catch (error) {\n if (result.err == null) {\n result.err = error as Error;\n }\n }\n }\n return result.getResponseOrThrow({ endpoint: request.endpoint });\n }\n\n public generateSync(\n request: FernIr.dynamic.EndpointSnippetRequest,\n options: Options = {}\n ): FernIr.dynamic.EndpointSnippetResponse {\n const endpoints = this.context.resolveEndpointLocationOrThrow(request.endpoint);\n if (endpoints.length === 0) {\n throw new Error(`No endpoints found that match \"${request.endpoint.method} ${request.endpoint.path}\"`);\n }\n const result = new Result();\n for (const endpoint of endpoints) {\n const context = this.context.clone() as Context;\n const snippetGenerator = this.createSnippetGenerator(context);\n try {\n const snippet = snippetGenerator.generateSnippetSync({ endpoint, request, options });\n if (context.errors.empty()) {\n return {\n snippet,\n errors: undefined\n };\n }\n result.update({ context, snippet });\n } catch (error) {\n if (result.err == null) {\n result.err = error as Error;\n }\n }\n }\n return result.getResponseOrThrow({ endpoint: request.endpoint });\n }\n}\n","import { FernIr } from \"@fern-api/dynamic-ir-sdk\";\n\nimport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nimport { ErrorReporter } from \"./ErrorReporter\";\n\nexport class Result {\n public reporter: ErrorReporter | undefined;\n public snippet: string | undefined;\n public err: Error | undefined;\n\n constructor() {\n this.snippet = undefined;\n this.reporter = undefined;\n this.err = undefined;\n }\n\n public update({ context, snippet }: { context: AbstractDynamicSnippetsGeneratorContext; snippet: string }): void {\n if (this.shouldUpdate({ snippet, reporter: context.errors })) {\n this.reporter = context.errors.clone();\n this.snippet = snippet;\n }\n }\n\n public getResponseOrThrow({\n endpoint\n }: {\n endpoint: FernIr.dynamic.EndpointLocation;\n }): FernIr.dynamic.EndpointSnippetResponse {\n if (this.snippet != null && this.reporter != null) {\n return {\n snippet: this.snippet,\n errors: this.reporter.toDynamicSnippetErrors()\n };\n }\n throw this.err ?? new Error(`Failed to generate snippet for endpoint \"${endpoint.method} ${endpoint.path}\"`);\n }\n\n private shouldUpdate({ snippet, reporter }: { snippet: string; reporter: ErrorReporter }): boolean {\n if (this.reporter == null || (this.reporter.size() > 0 && reporter.size() === 0)) {\n return true;\n }\n return snippet.length > (this.snippet?.length ?? 0);\n }\n}\n","export const Severity = {\n Critical: \"CRITICAL\",\n Warning: \"WARNING\"\n} as const;\n\nexport declare namespace ErrorReporter {\n type Path = readonly PathItem[];\n\n type PathItem = string | ArrayPathItem;\n\n type Severity = (typeof Severity)[keyof typeof Severity];\n\n interface ArrayPathItem {\n index: number;\n }\n\n interface Error {\n path?: Path;\n severity: Severity;\n message: string;\n }\n}\n\ninterface Error_ {\n severity: \"CRITICAL\" | \"WARNING\";\n path: string[] | undefined;\n message: string;\n}\n\nexport class ErrorReporter {\n private errors: ErrorReporter.Error[];\n private path: ErrorReporter.PathItem[];\n\n constructor() {\n this.errors = [];\n this.path = [];\n }\n\n public add(err: Omit<ErrorReporter.Error, \"path\">): void {\n this.errors.push({\n ...err,\n path: [...this.path]\n });\n }\n\n public scope(path: ErrorReporter.PathItem): void {\n this.path.push(path);\n }\n\n public unscope(): void {\n this.path.pop();\n }\n\n public getBySeverity(severity: ErrorReporter.Severity): ErrorReporter.Error[] {\n return this.errors.filter((err) => err.severity === severity);\n }\n\n public empty(): boolean {\n return this.errors.length === 0;\n }\n\n public size(): number {\n return this.errors.length;\n }\n\n public clone(): ErrorReporter {\n const clone = new ErrorReporter();\n clone.errors = [...this.errors];\n clone.path = [...this.path];\n return clone;\n }\n\n public reset(): void {\n this.errors = [];\n this.path = [];\n }\n\n public toDynamicSnippetErrors(): Error_[] {\n return this.errors.map((err) => ({\n severity: err.severity,\n path: err.path != null ? this.pathToStringArray(err.path) : undefined,\n message: err.message\n }));\n }\n\n private pathToStringArray(path: ErrorReporter.Path): string[] {\n const result: string[] = [];\n for (const item of path) {\n if (typeof item === \"string\") {\n result.push(item);\n continue;\n }\n result[result.length - 1] += `[${item.index}]`;\n }\n return result;\n }\n}\n","import { assertNever, keys } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { HttpEndpointReferenceParser } from \"@fern-api/fern-definition-schema\";\n\nimport { FernGeneratorExec } from \"../GeneratorNotificationService\";\nimport { DiscriminatedUnionTypeInstance } from \"./DiscriminatedUnionTypeInstance\";\nimport { ErrorReporter, Severity } from \"./ErrorReporter\";\nimport { Options } from \"./Options\";\nimport { TypeInstance } from \"./TypeInstance\";\n\nexport abstract class AbstractDynamicSnippetsGeneratorContext {\n public config: FernGeneratorExec.GeneratorConfig;\n public options: Options;\n public errors: ErrorReporter;\n\n private _ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n private httpEndpointReferenceParser: HttpEndpointReferenceParser;\n\n constructor({\n ir,\n config,\n options = {}\n }: {\n ir: FernIr.dynamic.DynamicIntermediateRepresentation;\n config: FernGeneratorExec.GeneratorConfig;\n options?: Options;\n }) {\n this._ir = ir;\n this.config = config;\n this.options = options;\n this.errors = new ErrorReporter();\n this.httpEndpointReferenceParser = new HttpEndpointReferenceParser();\n }\n\n public abstract clone(): AbstractDynamicSnippetsGeneratorContext;\n\n public associateQueryParametersByWireValue({\n parameters,\n values\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const [key, value] of Object.entries(values)) {\n this.errors.scope(key);\n try {\n const parameter = parameters.find((param) => param.name.wireValue === key);\n if (parameter == null) {\n throw this.newParameterNotRecognizedError(key);\n }\n // If this query parameter supports allow-multiple, the user-provided values\n // must be wrapped in an array.\n const typeInstanceValue =\n this.isListTypeReference(parameter.typeReference) && !Array.isArray(value) ? [value] : value;\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value: typeInstanceValue\n });\n } finally {\n this.errors.unscope();\n }\n }\n return instances;\n }\n\n public associateByWireValueOrDefault({\n parameters,\n values\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const parameter of parameters) {\n this.errors.scope(parameter.name.wireValue);\n try {\n let value = values[parameter.name.wireValue];\n\n if (value == null) {\n if (parameter.typeReference.type === \"primitive\" && parameter.typeReference.value === \"STRING\") {\n // synthesize a parameter value for string parameters that are missing data\n value = `<${parameter.name.wireValue}>`;\n } else {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(parameter.name.wireValue).message\n });\n continue;\n }\n }\n\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n } finally {\n this.errors.unscope();\n }\n }\n\n return instances;\n }\n\n public associateByWireValue({\n parameters,\n values,\n ignoreMissingParameters\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n ignoreMissingParameters?: boolean;\n }): TypeInstance[] {\n const instances: TypeInstance[] = [];\n for (const [key, value] of Object.entries(values)) {\n this.errors.scope(key);\n try {\n const parameter = parameters.find((param) => param.name.wireValue === key);\n if (parameter == null) {\n if (ignoreMissingParameters) {\n // Required for request payloads that include more information than\n // just the target parameters (e.g. union base properties).\n continue;\n }\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(key).message\n });\n continue;\n }\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n } finally {\n this.errors.unscope();\n }\n }\n return instances;\n }\n\n /**\n * Similar to `associateByWireValue` but it builds TypeInstance objects by iterating over schema parameters rather\n * than snippet values. Skips non-nullable parameters that are missing from the snippet object.\n */\n public getExampleObjectProperties({\n parameters,\n snippetObject\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n snippetObject: unknown;\n }): TypeInstance[] {\n const objectRecord = (\n typeof snippetObject === \"object\" && snippetObject !== null && !Array.isArray(snippetObject)\n ? snippetObject\n : {}\n ) as Record<string, unknown>;\n const instances: TypeInstance[] = [];\n for (const parameter of parameters) {\n const value = objectRecord[parameter.name.wireValue];\n if (value == null) {\n if (parameter.typeReference.type === \"nullable\") {\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value: null\n });\n }\n } else {\n instances.push({\n name: parameter.name,\n typeReference: parameter.typeReference,\n value\n });\n }\n }\n return instances;\n }\n\n public getSingleFileValue({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.File_;\n record: Record<string, unknown>;\n }): string | undefined {\n const fileValue = record[property.wireValue];\n if (fileValue == null) {\n return undefined;\n }\n if (typeof fileValue !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file value to be a string, got ${typeof fileValue}`\n });\n return undefined;\n }\n return fileValue;\n }\n\n public getFileArrayValues({\n property,\n record\n }: {\n property: FernIr.dynamic.FileUploadRequestBodyProperty.FileArray;\n record: Record<string, unknown>;\n }): string[] | undefined {\n const fileArrayValue = record[property.wireValue];\n if (fileArrayValue == null) {\n return undefined;\n }\n if (!Array.isArray(fileArrayValue)) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file array value to be an array of strings, got ${typeof fileArrayValue}`\n });\n return undefined;\n }\n const stringValues: string[] = [];\n for (const value of fileArrayValue) {\n if (typeof value !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected file array value to be an array of strings, got ${typeof value}`\n });\n return undefined;\n }\n stringValues.push(value);\n }\n return stringValues;\n }\n\n public getRecord(value: unknown): Record<string, unknown> | undefined {\n if (typeof value !== \"object\" || Array.isArray(value)) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected object with key, value pairs but got: ${\n Array.isArray(value) ? \"array\" : typeof value\n }`\n });\n return undefined;\n }\n if (value == null) {\n return {};\n }\n return value as Record<string, unknown>;\n }\n\n public resolveNamedType({ typeId }: { typeId: FernIr.dynamic.TypeId }): FernIr.dynamic.NamedType | undefined {\n const namedType = this._ir.types[typeId];\n if (namedType == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: `Type identified by \"${typeId}\" could not be found`\n });\n return undefined;\n }\n return namedType;\n }\n\n public resolveDiscriminatedUnionTypeInstance({\n discriminatedUnion,\n value\n }: {\n discriminatedUnion: FernIr.dynamic.DiscriminatedUnionType;\n value: unknown;\n }): DiscriminatedUnionTypeInstance | undefined {\n const record = this.getRecord(value);\n if (record == null) {\n return undefined;\n }\n\n const discriminantFieldName = discriminatedUnion.discriminant.wireValue;\n const discriminantValue = record[discriminantFieldName];\n if (discriminantValue == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newParameterNotRecognizedError(discriminantFieldName).message\n });\n return undefined;\n }\n if (typeof discriminantValue !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: `Expected discriminant value to be a string but got: ${typeof discriminantValue}`\n });\n return undefined;\n }\n\n const singleDiscriminatedUnionType = discriminatedUnion.types[discriminantValue];\n if (singleDiscriminatedUnionType == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: `No type found for discriminant value \"${discriminantValue}\"`\n });\n return undefined;\n }\n\n // Remove the discriminant from the record so that the value is valid for the type.\n const { [discriminantFieldName]: _, ...filtered } = record;\n\n return {\n singleDiscriminatedUnionType,\n discriminantValue: singleDiscriminatedUnionType.discriminantValue,\n value: filtered\n };\n }\n\n public resolveEndpointOrThrow(rawEndpoint: string): FernIr.dynamic.Endpoint[] {\n const parsedEndpoint = this.httpEndpointReferenceParser.tryParse(rawEndpoint);\n if (parsedEndpoint == null) {\n throw new Error(`Failed to parse endpoint reference \"${rawEndpoint}\"`);\n }\n return this.resolveEndpointLocationOrThrow(parsedEndpoint);\n }\n\n public resolveEndpointLocation(location: FernIr.dynamic.EndpointLocation): FernIr.dynamic.Endpoint[] {\n const endpoints: FernIr.dynamic.Endpoint[] = [];\n for (const endpoint of Object.values(this._ir.endpoints)) {\n if (this.parsedEndpointMatches({ endpoint, parsedEndpoint: location })) {\n endpoints.push(endpoint);\n }\n }\n\n return endpoints;\n }\n\n public resolveEndpointLocationOrThrow(location: FernIr.dynamic.EndpointLocation): FernIr.dynamic.Endpoint[] {\n const endpoints = this.resolveEndpointLocation(location);\n if (endpoints.length === 0) {\n throw new Error(`Failed to find endpoint identified by \"${location.method} ${location.path}\"`);\n }\n return endpoints;\n }\n\n public needsRequestParameter({\n request,\n inlinePathParameters,\n inlineFileProperties\n }: {\n request: FernIr.dynamic.InlinedRequest;\n inlinePathParameters: boolean;\n inlineFileProperties: boolean;\n }): boolean {\n if (this.includePathParametersInWrappedRequest({ request, inlinePathParameters })) {\n return true;\n }\n if (request.queryParameters != null && request.queryParameters.length > 0) {\n return true;\n }\n if (request.headers != null && request.headers.length > 0) {\n return true;\n }\n if (request.body != null) {\n return this.includeRequestBodyInWrappedRequest({ body: request.body, inlineFileProperties });\n }\n if (request.metadata?.onlyPathParameters) {\n return false;\n }\n return true;\n }\n\n public includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n }: {\n request: FernIr.dynamic.InlinedRequest;\n inlinePathParameters: boolean;\n }): boolean {\n return inlinePathParameters && (request.metadata?.includePathParameters ?? false);\n }\n\n public isFileUploadRequestBody(\n body: FernIr.dynamic.InlinedRequestBody\n ): body is FernIr.dynamic.InlinedRequestBody.FileUpload {\n switch (body.type) {\n case \"fileUpload\":\n return true;\n case \"properties\":\n case \"referenced\":\n return false;\n default:\n assertNever(body);\n }\n }\n\n public resolveEnvironmentName(environmentID: string): FernIr.Name | undefined {\n if (this._ir.environments == null) {\n return undefined;\n }\n const environments = this._ir.environments.environments;\n switch (environments.type) {\n case \"singleBaseUrl\": {\n const environment = environments.environments.find((env) => env.id === environmentID);\n if (environment == null) {\n return undefined;\n }\n return environment.name;\n }\n case \"multipleBaseUrls\": {\n const environment = environments.environments.find((env) => env.id === environmentID);\n if (environment == null) {\n return undefined;\n }\n return environment.name;\n }\n default:\n assertNever(environments);\n }\n }\n\n public isSingleEnvironmentID(\n environment: FernIr.dynamic.EnvironmentValues\n ): environment is FernIr.dynamic.EnvironmentId {\n return typeof environment === \"string\";\n }\n\n public isMultiEnvironmentValues(\n environment: FernIr.dynamic.EnvironmentValues\n ): environment is FernIr.dynamic.MultipleEnvironmentUrlValues {\n return typeof environment === \"object\";\n }\n\n public validateMultiEnvironmentUrlValues(\n multiEnvironmentUrlValues: FernIr.dynamic.MultipleEnvironmentUrlValues\n ): boolean {\n if (this._ir.environments == null) {\n this.errors.add({\n severity: Severity.Critical,\n message:\n \"Multiple environments are not supported for single base URL environments; use the baseUrl option instead\"\n });\n return false;\n }\n const environments = this._ir.environments.environments;\n switch (environments.type) {\n case \"singleBaseUrl\": {\n this.errors.add({\n severity: Severity.Critical,\n message:\n \"Multiple environments are not supported for single base URL environments; use the baseUrl option instead\"\n });\n return false;\n }\n case \"multipleBaseUrls\": {\n const firstEnvironment = environments.environments[0];\n if (firstEnvironment == null) {\n this.errors.add({\n severity: Severity.Critical,\n message: \"Multiple environments are not supported; use the baseUrl option instead\"\n });\n return false;\n }\n const expectedKeys = new Set(keys(firstEnvironment.urls));\n for (const key of keys(multiEnvironmentUrlValues)) {\n if (expectedKeys.has(key)) {\n expectedKeys.delete(key);\n }\n }\n if (expectedKeys.size > 0) {\n this.errors.add({\n severity: Severity.Critical,\n message: `The provided environments are invalid; got: [${Object.keys(multiEnvironmentUrlValues).join(\", \")}], expected: [${keys(firstEnvironment.urls).join(\", \")}]`\n });\n return false;\n }\n return true;\n }\n }\n }\n\n public getValueAsNumber({ value }: { value: unknown }): number | undefined {\n if (typeof value !== \"number\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"number\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public getValueAsBoolean({ value }: { value: unknown }): boolean | undefined {\n if (typeof value !== \"boolean\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"boolean\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public getValueAsString({ value }: { value: unknown }): string | undefined {\n if (typeof value !== \"string\") {\n this.errors.add({\n severity: Severity.Critical,\n message: this.newTypeMismatchError({ expected: \"string\", value }).message\n });\n return undefined;\n }\n return value;\n }\n\n public isOptional(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"nullable\":\n return this.isOptional(typeReference.value);\n case \"optional\":\n return true;\n case \"named\": {\n const resolvedType = this.resolveNamedType({ typeId: typeReference.value });\n if (resolvedType == null) {\n return false;\n }\n if (resolvedType.type === \"alias\") {\n return this.isNullable(resolvedType.typeReference);\n }\n return false;\n }\n }\n return false;\n }\n\n public isNullable(typeReference: FernIr.dynamic.TypeReference): boolean {\n switch (typeReference.type) {\n case \"nullable\":\n return true;\n case \"optional\":\n return this.isNullable(typeReference.value);\n case \"named\": {\n const resolvedType = this.resolveNamedType({ typeId: typeReference.value });\n if (resolvedType == null) {\n return false;\n }\n if (resolvedType.type === \"alias\") {\n return this.isNullable(resolvedType.typeReference);\n }\n return false;\n }\n }\n return false;\n }\n\n public newAuthMismatchError({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): Error {\n return new Error(`Expected auth type ${auth.type}, got ${values.type}`);\n }\n\n public newParameterNotRecognizedError(parameterName: string): Error {\n return new Error(`\"${parameterName}\" is not a recognized parameter for this endpoint`);\n }\n\n public newTypeMismatchError({ expected, value }: { expected: string; value: unknown }): Error {\n return new Error(`Expected ${expected}, got ${typeof value}`);\n }\n\n private includeRequestBodyInWrappedRequest({\n body,\n inlineFileProperties\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n inlineFileProperties: boolean;\n }): boolean {\n switch (body.type) {\n case \"properties\":\n case \"referenced\":\n return true;\n case \"fileUpload\":\n return this.includeFileUploadBodyInWrappedRequest({ fileUpload: body, inlineFileProperties });\n default:\n assertNever(body);\n }\n }\n\n private includeFileUploadBodyInWrappedRequest({\n fileUpload,\n inlineFileProperties\n }: {\n fileUpload: FernIr.dynamic.FileUploadRequestBody;\n inlineFileProperties: boolean;\n }): boolean {\n return (\n this.fileUploadHasBodyProperties({ fileUpload }) ||\n (inlineFileProperties && this.fileUploadHasFileProperties({ fileUpload }))\n );\n }\n\n private fileUploadHasBodyProperties({ fileUpload }: { fileUpload: FernIr.dynamic.FileUploadRequestBody }): boolean {\n return fileUpload.properties.some((property) => {\n switch (property.type) {\n case \"file\":\n case \"fileArray\":\n return false;\n case \"bodyProperty\":\n return true;\n default:\n assertNever(property);\n }\n });\n }\n\n private fileUploadHasFileProperties({ fileUpload }: { fileUpload: FernIr.dynamic.FileUploadRequestBody }): boolean {\n return fileUpload.properties.some((property) => {\n switch (property.type) {\n case \"file\":\n case \"fileArray\":\n return true;\n case \"bodyProperty\":\n return false;\n default:\n assertNever(property);\n }\n });\n }\n\n private isListTypeReference(typeReference: FernIr.dynamic.TypeReference): boolean {\n if (typeReference.type === \"optional\") {\n return this.isListTypeReference(typeReference.value);\n }\n return typeReference.type === \"list\" || typeReference.type === \"set\";\n }\n\n private parsedEndpointMatches({\n endpoint,\n parsedEndpoint\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n parsedEndpoint: HttpEndpointReferenceParser.Parsed;\n }): boolean {\n return endpoint.location.method === parsedEndpoint.method && endpoint.location.path === parsedEndpoint.path;\n }\n}\n","export { EXAMPLE_REFERENCE_PREFIX, YAML_SCHEMA_VERSION } from \"./constants\";\nexport { type NodePath, type NodePathItem } from \"./NodePath\";\nexport * as RawSchemas from \"./schemas\";\nexport { type DefinitionFileSchema, type PackageMarkerFileSchema, type RootApiFileSchema } from \"./schemas\";\nexport * from \"./utils/auth\";\nexport * from \"./utils/generics\";\nexport { getRequestBody } from \"./utils/getRequestBody\";\nexport { getResponseBodyType } from \"./utils/getResponseBodyType\";\nexport { HttpEndpointReferenceParser } from \"./utils/HttpEndpointReferenceParser\";\nexport { isInlineRequestBody } from \"./utils/isInlineRequestBody\";\nexport { isOpenApiSourceSchema } from \"./utils/isOpenApiSourceSchema\";\nexport { isRawProtobufSourceSchema } from \"./utils/isRawProtobufSourceSchema\";\nexport { isRawTextType } from \"./utils/isRawTextType\";\nexport { type BytesRequest, parseBytesRequest } from \"./utils/parseBytesRequest\";\nexport { parseFileUploadRequest, type RawFileUploadRequest } from \"./utils/parseFileUploadRequest\";\nexport { parseRawBytesType, type RawBytesType } from \"./utils/parseRawBytesType\";\nexport { parseRawFileType, type RawFileType } from \"./utils/parseRawFileType\";\nexport { parseRawTextType, type RawTextType } from \"./utils/parseRawTextType\";\nexport { RawPrimitiveType } from \"./utils/RawPrimitiveType\";\nexport { recursivelyVisitRawTypeReference } from \"./utils/recursivelyVisitRawTypeReference\";\nexport { visitExampleCodeSampleSchema } from \"./utils/visitExampleCodeSampleSchema\";\nexport { type ExampleResponseSchemaVisitor, visitExampleResponseSchema } from \"./utils/visitExampleResponseSchema\";\nexport { isAnyAuthSchemes, isSingleAuthScheme, type RawApiAuthVisitor, visitRawApiAuth } from \"./utils/visitRawApiAuth\";\nexport {\n type AuthSchemeDeclarationVisitor,\n isHeaderAuthScheme,\n visitRawAuthSchemeDeclaration\n} from \"./utils/visitRawAuthSchemeDeclaration\";\nexport {\n isRawMultipleBaseUrlsEnvironment,\n isRawSingleBaseUrlEnvironment,\n visitRawEnvironmentDeclaration\n} from \"./utils/visitRawEnvironmentDeclaration\";\nexport {\n isVariablePathParameter,\n type PathParameterDeclarationVisitor,\n visitRawPathParameter\n} from \"./utils/visitRawPathParameter\";\nexport {\n isRawAliasDefinition,\n isRawDiscriminatedUnionDefinition,\n isRawEnumDefinition,\n isRawObjectDefinition,\n isRawUndiscriminatedUnionDefinition,\n type RawTypeDeclarationVisitor,\n visitRawTypeDeclaration\n} from \"./utils/visitRawTypeDeclaration\";\nexport { FernContainerRegex, visitRawTypeReference } from \"./utils/visitRawTypeReference\";\n","export declare namespace HttpEndpointReferenceParser {\n interface Parsed {\n path: string;\n method: Method;\n }\n\n type Method = \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"HEAD\";\n\n export type ValidationResult = Valid | Invalid;\n\n interface Valid {\n type: \"valid\";\n }\n\n interface Invalid {\n type: \"invalid\";\n }\n}\n\n/**\n * Parses an HTTP endpoint reference like `POST /users/get`\n */\nexport class HttpEndpointReferenceParser {\n //eslint-disable-next-line\n private REFERENCE_REGEX = /^(GET|POST|PUT|DELETE|PATCH|HEAD)\\s(\\/\\S*)$/;\n\n public validate(reference: string): HttpEndpointReferenceParser.ValidationResult {\n const validFormat = this.REFERENCE_REGEX.test(reference);\n if (!validFormat) {\n return { type: \"invalid\" };\n }\n return { type: \"valid\" };\n }\n\n public tryParse(reference: string): HttpEndpointReferenceParser.Parsed | undefined {\n const validationResponse = this.validate(reference);\n if (validationResponse.type === \"invalid\") {\n return undefined;\n }\n const match = reference.match(this.REFERENCE_REGEX);\n if (match == null || match[1] == null || match[2] == null) {\n return undefined;\n }\n return {\n method: match[1] as HttpEndpointReferenceParser.Method,\n path: match[2]\n };\n }\n}\n","import { AbstractFormatter } from \"../ast/AbstractFormatter\";\n\n// Style of the generated snippets.\nexport enum Style {\n // Use a concise style for the snippet (top-level statements).\n Concise = \"concise\",\n\n // Use the full style for the snippet (a `main` function that can be run).\n Full = \"full\"\n}\n\n// Options used to customize the behavior of any dynamic snippets generator\nexport interface Options {\n // Config to use for a specific generator. This is independent of the customConfig\n // used by the generator, and is primarily used in testing environments.\n config?: unknown;\n\n // The formatter to use for the generated snippets.\n formatter?: AbstractFormatter;\n\n // Style of the generated snippets. By default, the executable style is used.\n style?: Style;\n}\n","export const Scope = {\n PathParameters: \"pathParameters\",\n QueryParameters: \"queryParameters\",\n Headers: \"headers\",\n RequestBody: \"requestBody\"\n} as const;\n\nexport type Scope = (typeof Scope)[keyof typeof Scope];\n","export { AbstractDynamicSnippetsGenerator } from \"./AbstractDynamicSnippetsGenerator\";\nexport { AbstractDynamicSnippetsGeneratorContext } from \"./AbstractDynamicSnippetsGeneratorContext\";\nexport { type DiscriminatedUnionTypeInstance } from \"./DiscriminatedUnionTypeInstance\";\nexport { ErrorReporter, Severity } from \"./ErrorReporter\";\nexport { type Options, Style } from \"./Options\";\nexport { Result } from \"./Result\";\nexport { Scope } from \"./Scope\";\nexport { type TypeInstance } from \"./TypeInstance\";\nexport { DynamicSnippetsTestRunner } from \"./test-utils/DynamicSnippetsTestRunner\";\n"],"mappings":"iIAKAA,IAAAC,ICAAC,IAAAC,IAAM,IAAOC,EAAP,KAAa,CAKf,aAAA,CAJOC,EAAA,iBACAA,EAAA,gBACAA,EAAA,YAGH,KAAK,QAAU,OACf,KAAK,SAAW,OAChB,KAAK,IAAM,MACf,CAEO,OAAO,CAAE,QAAAC,EAAS,QAAAC,CAAO,EAAyE,CACjG,KAAK,aAAa,CAAE,QAAAA,EAAS,SAAUD,EAAQ,MAAM,CAAE,IACvD,KAAK,SAAWA,EAAQ,OAAO,MAAK,EACpC,KAAK,QAAUC,EAEvB,CAEO,mBAAmB,CACtB,SAAAC,CAAQ,EAGX,CAtBL,IAAAC,EAuBQ,GAAI,KAAK,SAAW,MAAQ,KAAK,UAAY,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AsC,CAAE,WAAYA,EAAM,qBAAAF,CAAoB,CAAE,EAChG,QACIG,EAAYD,CAAI,CACxB,CACJ,CAEQ,sCAAsC,CAC1C,WAAAe,EACA,qBAAAjB,CAAoB,EAIvB,CACG,OACI,KAAK,4BAA4B,CAAE,WAAAiB,CAAU,CAAE,GAC9CjB,GAAwB,KAAK,4BAA4B,CAAE,WAAAiB,CAAU,CAAE,CAEhF,CAEQ,4BAA4B,CAAE,WAAAA,CAAU,EAAwD,CACpG,OAAOA,EAAW,WAAW,KAAMxC,GAAY,CAC3C,OAAQA,EAAS,KAAM,CACnB,IAAK,OACL,IAAK,YACD,MAAO,GACX,IAAK,eACD,MAAO,GACX,QACI0B,EAAY1B,CAAQ,CAC5B,CACJ,CAAC,CACL,CAEQ,4BAA4B,CAAE,WAAAwC,CAAU,EAAwD,CACpG,OAAOA,EAAW,WAAW,KAAMxC,GAAY,CAC3C,OAAQA,EAAS,KAAM,CACnB,IAAK,OACL,IAAK,YACD,MAAO,GACX,IAAK,eACD,MAAO,GACX,QACI0B,EAAY1B,CAAQ,CAC5B,CACJ,CAAC,CACL,CAEQ,oBAAoBmC,EAA2C,CACnE,OAAIA,EAAc,OAAS,WAChB,KAAK,oBAAoBA,EAAc,KAAK,EAEhDA,EAAc,OAAS,QAAUA,EAAc,OAAS,KACnE,CAEQ,sBAAsB,CAC1B,SAAAf,EACA,eAAAH,CAAc,EAIjB,CACG,OAAOG,EAAS,SAAS,SAAWH,EAAe,QAAUG,EAAS,SAAS,OAASH,EAAe,IAC3G,GG7nBJwB,IAAAC,IACA,IAAYC,GAAZ,SAAYA,EAAK,CAEbA,EAAA,QAAA,UAGAA,EAAA,KAAA,MACJ,GANYA,IAAAA,EAAK,CAAA,EAAA,ECHjBC,IAAAC,IAAO,IAAMC,EAAQ,CACjB,eAAgB,iBAChB,gBAAiB,kBACjB,QAAS,UACT,YAAa,eCJjBC,IAAAC","names":["init_process","init_buffer","init_process","init_buffer","Result","__publicField","context","snippet","endpoint","_a","reporter","_b","AbstractDynamicSnippetsGenerator","context","__publicField","request","options","endpoints","result","Result","endpoint","snippetGenerator","snippet","error","init_process","init_buffer","Severity","ErrorReporter","_ErrorReporter","__publicField","err","__spreadProps","__spreadValues","path","severity","clone","result","item","init_process","init_buffer","init_process","init_buffer","init_process","init_buffer","HttpEndpointReferenceParser","__publicField","reference","match","AbstractDynamicSnippetsGeneratorContext","ir","config","options","__publicField","ErrorReporter","HttpEndpointReferenceParser","parameters","values","instances","key","value","parameter","param","typeInstanceValue","Severity","ignoreMissingParameters","snippetObject","objectRecord","property","record","fileValue","fileArrayValue","stringValues","typeId","namedType","discriminatedUnion","discriminantFieldName","discriminantValue","singleDiscriminatedUnionType","_a","_","filtered","__objRest","__restKey","rawEndpoint","parsedEndpoint","location","endpoints","endpoint","request","inlinePathParameters","inlineFileProperties","_b","body","assertNever","environmentID","environments","environment","env","multiEnvironmentUrlValues","firstEnvironment","expectedKeys","keys","typeReference","resolvedType","auth","parameterName","expected","fileUpload","init_process","init_buffer","Style","init_process","init_buffer","Scope","init_process","init_buffer"]}
|
package/esm/chunk-PRMFZOQO.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{b as m,d as g,e as u}from"./chunk-DD37GKIE.js";import{a as y,d as n}from"./chunk-JWUP3MFF.js";import{f as v,h as A,i as b}from"./chunk-2U3YQWRZ.js";A();b();var q="com.example.usage",M="Example",E="main",S="args",T="client",j={type:"primitive",value:"STRING"};function k(h){if(h.type==="optional"&&h.value.type==="list"){let t=h.value.value;if(t.type==="optional")return{type:"optional",value:{type:"list",value:t.value}}}if(h.type==="list"){let e=h.value;if(e.type==="optional")return{type:"list",value:e.value}}return h}var C=class{constructor({context:e,formatter:t}){v(this,"context");v(this,"formatter");this.context=e,this.formatter=t}async generateSnippet({endpoint:e,request:t,options:r}){var i;let a=this.getConfig(r);return await this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toStringAsync({packageName:(i=a.fullStylePackageName)!=null?i:q,customConfig:this.context.customConfig,formatter:this.formatter})}generateSnippetSync({endpoint:e,request:t,options:r}){var i;let a=this.getConfig(r);return this.buildCodeBlock({endpoint:e,snippet:t,options:r}).toString({packageName:(i=a.fullStylePackageName)!=null?i:q,customConfig:this.context.customConfig,formatter:this.formatter})}buildCodeBlock({endpoint:e,snippet:t,options:r}){let a=n.codeblock(i=>{i.writeNodeStatement(this.constructClient({endpoint:e,snippet:t})),i.newLine(),i.writeNodeStatement(this.callMethod({endpoint:e,snippet:t}))}),s=this.getStyle(r);switch(s){case g.Concise:return a;case g.Full:return this.buildFullCodeBlock({body:a,options:r});default:y(s)}}constructClient({endpoint:e,snippet:t}){return n.codeblock(r=>{r.writeNode(this.context.getRootClientClassReference()),r.write(` ${T} = `),r.writeNode(n.TypeLiteral.builder({classReference:this.context.getRootClientClassReference(),parameters:this.getRootClientBuilderArgs({endpoint:e,snippet:t})}))})}buildFullCodeBlock({body:e,options:t}){var i;let r=this.getConfig(t),a=n.class_({name:(i=r.fullStyleClassName)!=null?i:M,access:n.Access.Public}),s=n.parameter({name:S,type:n.Type.array(n.Type.string())});return a.addMethod(n.method({name:E,access:n.Access.Public,static_:!0,parameters:[s],body:e})),a}getRootClientBuilderArgs({endpoint:e,snippet:t}){var o,p;let r=[];e.auth!=null&&(t.auth!=null?r.push(...this.getRootClientAuthArgs({auth:e.auth,values:t.auth})):this.context.errors.add({severity:m.Warning,message:`Auth with ${e.auth.type} configuration is required for this endpoint`}));let a=this.getRootClientBaseUrlArg({baseUrl:t.baseURL,environment:t.environment});a!=null&&r.push(a),this.context.errors.scope(u.Headers),this.context.ir.headers!=null&&t.headers!=null&&r.push(...this.getRootClientHeaderArgs({headers:this.context.ir.headers,values:t.headers})),this.context.errors.unscope();let s=new Set;if([...(o=this.context.ir.pathParameters)!=null?o:[],...(p=e.request.pathParameters)!=null?p:[]].forEach(l=>{l.variable!=null&&s.add(l.variable)}),this.context.ir.variables!=null&&this.context.ir.variables.length>0){for(let l of this.context.ir.variables)if(s.has(l.id)){let c=l.name.camelCase.unsafeName;r.push({name:c,value:n.TypeLiteral.string(`YOUR_${l.name.screamingSnakeCase.unsafeName}`)})}}if(this.context.errors.scope(u.PathParameters),this.context.ir.pathParameters!=null&&this.context.ir.pathParameters.length>0){let l=this.context.ir.pathParameters.filter(c=>c.variable==null);l.length>0&&r.push(...this.getPathParameters({namedParameters:l,snippet:t}))}return this.context.errors.unscope(),r}getRootClientBaseUrlArg({baseUrl:e,environment:t}){var r;if(e!=null&&t!=null){this.context.errors.add({severity:m.Critical,message:"Cannot specify both baseUrl and environment options"});return}if(e!=null){if(((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"){this.context.errors.add({severity:m.Critical,message:"The Java SDK doesn't support a baseUrl when multiple URL environments are configured"});return}return{name:"url",value:n.TypeLiteral.string(e)}}if(t!=null){if(this.context.isSingleEnvironmentID(t)){let a=this.context.getEnvironmentTypeReferenceFromID(t);if(a==null){this.context.errors.add({severity:m.Warning,message:`Environment ${JSON.stringify(t)} was not found`});return}return{name:"environment",value:n.TypeLiteral.reference(a)}}if(this.context.isMultiEnvironmentValues(t))return this.context.validateMultiEnvironmentUrlValues(t)?{name:"environment",value:n.TypeLiteral.reference(n.instantiateClass({classReference:this.context.getEnvironmentClassReference(),arguments_:Object.values(t).map(a=>this.context.dynamicTypeLiteralMapper.convert({typeReference:j,value:a}))}))}:void 0}}getRootClientAuthArgs({auth:e,values:t}){if(t.type!==e.type)return this.addError(this.context.newAuthMismatchError({auth:e,values:t}).message),[];switch(e.type){case"basic":return t.type==="basic"?this.getRootClientBasicAuthArgs({auth:e,values:t}):[];case"bearer":return t.type==="bearer"?this.getRootClientBearerAuthArgs({auth:e,values:t}):[];case"header":return t.type==="header"?this.getRootClientHeaderAuthArgs({auth:e,values:t}):[];case"oauth":return t.type==="oauth"?this.getRootClientOAuthArgs({auth:e,values:t}):[];case"inferred":return this.addWarning("The Java SDK Generator does not support Inferred auth scheme yet"),[];default:y(e)}}addError(e){this.context.errors.add({severity:m.Critical,message:e})}addWarning(e){this.context.errors.add({severity:m.Warning,message:e})}getRootClientBasicAuthArgs({auth:e,values:t}){return[{name:"credentials",value:n.TypeLiteral.raw(`"${t.username}", "${t.password}"`)}]}getRootClientBearerAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.token),value:n.TypeLiteral.string(t.token)}]}getRootClientHeaderAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.header.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:e.header.typeReference,value:t.value})}]}getRootClientOAuthArgs({auth:e,values:t}){return[{name:this.context.getMethodName(e.clientId),value:n.TypeLiteral.string(t.clientId)},{name:this.context.getMethodName(e.clientSecret),value:n.TypeLiteral.string(t.clientSecret)}]}getRootClientHeaderArgs({headers:e,values:t}){let r=[];for(let a of e){let s=this.getRootClientHeaderArg({header:a,value:t.value});s!=null&&r.push({name:this.context.getMethodName(a.name.name),value:s})}return r}getRootClientHeaderArg({header:e,value:t}){let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.typeReference,value:t});if(!n.TypeLiteral.isNop(r))return r}callMethod({endpoint:e,snippet:t}){return n.invokeMethod({on:n.codeblock(T),method:this.getMethod({endpoint:e}),arguments_:this.getMethodArgs({endpoint:e,snippet:t})})}getMethodArgs({endpoint:e,snippet:t}){switch(e.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:e.request,snippet:t});case"body":return this.getMethodArgsForBodyRequest({request:e.request,snippet:t});default:y(e.request)}}getMethodArgsForBodyRequest({request:e,snippet:t}){var i;let r=[];this.context.errors.scope(u.PathParameters);let a=((i=e.pathParameters)!=null?i:[]).filter(o=>o.variable==null);a.length>0&&r.push(...this.getPathParameters({namedParameters:a,snippet:t}).map(o=>o.value)),this.context.errors.unscope(),this.context.errors.scope(u.RequestBody),e.body!=null&&r.push(this.getBodyRequestArg({body:e.body,value:t.requestBody})),this.context.errors.unscope();let s=this.getRequestOptionsArg({request:e,snippet:t});return s!=null&&r.push(s),r}usesOptionalNullable(){var e;return((e=this.context.customConfig)==null?void 0:e["collapse-optional-nullable"])===!0}getBodyRequestArg({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":{if(e.value.type==="optional"){if(t==null)return this.usesOptionalNullable()?this.context.getOptionalNullableAbsent():n.TypeLiteral.reference(n.invokeMethod({on:n.classReference({name:"Optional",packageName:"java.util"}),method:"empty",arguments_:[]}));let r=this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value.value,value:t,as:"request"}),a=r.toString({packageName:"com.example",customConfig:this.context.customConfig});return a.includes("Optional.empty()")||a.includes("OptionalNullable.absent()")?r:this.usesOptionalNullable()?this.context.getOptionalNullableOf(r):n.TypeLiteral.optional({value:r,useOf:!0})}return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"})}default:y(e)}}getBytesBodyRequestArg({value:e}){return e==null?n.TypeLiteral.bytes(""):typeof e!="string"?(this.context.errors.add({severity:m.Critical,message:`Expected bytes value to be a string, got ${typeof e}`}),n.TypeLiteral.nop()):n.TypeLiteral.bytes(e)}getMethodArgsForInlinedRequest({request:e,snippet:t}){var l;let r=[],{inlinePathParameters:a,inlineFileProperties:s}={inlinePathParameters:this.context.shouldInlinePathParameters(),inlineFileProperties:this.context.shouldInlineFileProperties()};this.context.errors.scope(u.PathParameters);let i=[],o=((l=e.pathParameters)!=null?l:[]).filter(c=>c.variable==null);o.length>0&&i.push(...this.getPathParameters({namedParameters:o,snippet:t})),this.context.errors.unscope(),this.context.errors.scope(u.RequestBody);let p=this.getFilePropertyInfo({request:e,snippet:t});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})||r.push(...i.map(c=>c.value)),s||r.push(...p.fileFields.map(c=>c.value)),r.push(this.getInlinedRequestArg({request:e,snippet:t,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:e,inlinePathParameters:a})?i:[],filePropertyInfo:p})),r}getFilePropertyInfo({request:e,snippet:t}){return e.body==null||!this.context.isFileUploadRequestBody(e.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:e.body,value:t.requestBody})}getInlinedRequestArg({request:e,snippet:t,pathParameterFields:r,filePropertyInfo:a}){var P,R,x,F,I,B;this.context.errors.scope(u.QueryParameters);let i=this.context.associateQueryParametersByWireValue({parameters:(P=e.queryParameters)!=null?P:[],values:(R=t.queryParameters)!=null?R:{}}).filter(d=>!this.context.isDirectLiteral(d.typeReference)),p=this.context.sortTypeInstancesByRequiredFirst(i,(x=e.queryParameters)!=null?x:[]).map(d=>({name:this.context.getMethodName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:k(d.typeReference),value:d.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(u.Headers);let c=this.context.associateByWireValue({parameters:(F=e.headers)!=null?F:[],values:(I=t.headers)!=null?I:{}}).filter(d=>!this.context.isDirectLiteral(d.typeReference)),N=this.context.sortTypeInstancesByRequiredFirst(c,(B=e.headers)!=null?B:[]).map(d=>({name:this.context.getMethodName(d.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:d.typeReference,value:d.value,as:"request"})}));this.context.errors.unscope(),this.context.errors.scope(u.RequestBody);let L=e.body!=null?this.getInlinedRequestBodyBuilderParameters({body:e.body,value:t.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),n.TypeLiteral.builder({classReference:n.classReference({name:this.context.getClassName(e.declaration.name),packageName:this.context.getRequestsPackageName(e.declaration.fernFilepath)}),parameters:[...r,...N,...p,...L]})}getRequestOptionsArg({request:e,snippet:t}){var p,l,c;let r="headers"in e?(p=e.headers)!=null?p:[]:[];if(r.length===0||Object.keys((l=t.headers)!=null?l:{}).length===0)return;this.context.errors.scope(u.Headers);let a=this.context.associateByWireValue({parameters:r,values:(c=t.headers)!=null?c:{}});if(this.context.errors.unscope(),a.length===0)return;let s=n.classReference({name:"RequestOptions",packageName:this.context.getCorePackageName()}),i=n.invokeMethod({on:s,method:"builder",arguments_:[]});for(let f of a)i=n.invokeMethod({on:i,method:"addHeader",arguments_:[n.TypeLiteral.string(f.name.wireValue),this.context.dynamicTypeLiteralMapper.convert(f)]});let o=n.invokeMethod({on:i,method:"build",arguments_:[]});return n.TypeLiteral.reference(o)}getInlinedRequestBodyBuilderParameters({body:e,value:t,filePropertyInfo:r}){switch(e.type){case"properties":return this.getInlinedRequestBodyPropertyBuilderParameters({parameters:e.value,value:t});case"referenced":return[this.getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t})];case"fileUpload":return this.getFileUploadRequestBodyBuilderParameters({filePropertyInfo:r});default:y(e)}}getFileUploadRequestBodyBuilderParameters({filePropertyInfo:e}){return this.context.shouldInlineFileProperties()?[...e.fileFields,...e.bodyPropertyFields]:e.bodyPropertyFields}getReferencedRequestBodyPropertyBuilderParameter({body:e,value:t}){return{name:this.context.getMethodName(e.bodyKey),value:this.getReferencedRequestBodyPropertyTypeLiteral({body:e.bodyType,value:t})}}getReferencedRequestBodyPropertyTypeLiteral({body:e,value:t}){switch(e.type){case"bytes":return this.getBytesBodyRequestArg({value:t});case"typeReference":return this.context.dynamicTypeLiteralMapper.convert({typeReference:e.value,value:t,as:"request"});default:y(e)}}getInlinedRequestBodyPropertyBuilderParameters({parameters:e,value:t}){var i;let a=this.context.associateByWireValue({parameters:e,values:(i=this.context.getRecord(t))!=null?i:{}}).filter(o=>!this.context.isDirectLiteral(o.typeReference));return this.context.sortTypeInstancesByRequiredFirst(a,e).map(o=>({name:this.context.getMethodName(o.name.name),value:this.context.dynamicTypeLiteralMapper.convert({typeReference:o.typeReference,value:o.value,as:"request"})}))}getPathParameters({namedParameters:e,snippet:t}){var s;let r=[],a=this.context.associateByWireValue({parameters:e,values:(s=t.pathParameters)!=null?s:{}});for(let i of a)r.push({name:this.context.getMethodName(i.name.name),value:this.context.dynamicTypeLiteralMapper.convert(i)});return r}getMethod({endpoint:e}){return e.declaration.fernFilepath.allParts.length>0?`${e.declaration.fernFilepath.allParts.map(t=>`${this.context.getMethodName(t)}()`).join(".")}.${this.context.getMethodName(e.declaration.name)}`:this.context.getMethodName(e.declaration.name)}getStyle(e){var t,r;return(r=(t=e.style)!=null?t:this.context.options.style)!=null?r:g.Full}getConfig(e){var t,r;return(r=(t=e.config)!=null?t:this.context.options.config)!=null?r:{}}};export{C as a};
|
|
2
|
-
//# sourceMappingURL=chunk-PRMFZOQO.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/EndpointSnippetGenerator.ts"],"sourcesContent":["import { AbstractFormatter, Options, Scope, Severity, Style } from \"@fern-api/browser-compatible-base-generator\";\nimport { assertNever } from \"@fern-api/core-utils\";\nimport { FernIr } from \"@fern-api/dynamic-ir-sdk\";\nimport { java } from \"@fern-api/java-ast\";\n\nimport { Config } from \"./Config\";\nimport { DynamicSnippetsGeneratorContext } from \"./context/DynamicSnippetsGeneratorContext\";\nimport { FilePropertyInfo } from \"./context/FilePropertyMapper\";\n\nconst SNIPPET_PACKAGE_NAME = \"com.example.usage\";\nconst SNIPPET_CLASS_NAME = \"Example\";\nconst SNIPPET_METHOD_NAME = \"main\";\nconst SNIPPET_METHOD_ARG = \"args\";\nconst CLIENT_VAR_NAME = \"client\";\nconst STRING_TYPE_REFERENCE: FernIr.dynamic.TypeReference = {\n type: \"primitive\",\n value: \"STRING\"\n};\n\n/**\n * For query parameters with allow-multiple and optional types, the Dynamic IR produces\n * optional<list<optional<T>>> or list<optional<T>>. However, Java SDK builders have\n * convenience overloads that accept List<T> directly. This function unwraps the optional\n * from list items so we generate List<T> instead of List<Optional<T>>.\n *\n * Note: We only unwrap \"optional\", not \"nullable\". Nullable list items (list<nullable<T>>)\n * are a distinct case where items genuinely can be null, and the SDK expects List<Optional<T>>.\n */\nfunction unwrapOptionalFromListItems(typeReference: FernIr.dynamic.TypeReference): FernIr.dynamic.TypeReference {\n if (typeReference.type === \"optional\" && typeReference.value.type === \"list\") {\n const listType = typeReference.value;\n const itemType = listType.value;\n if (itemType.type === \"optional\") {\n return {\n type: \"optional\",\n value: {\n type: \"list\",\n value: itemType.value\n }\n };\n }\n }\n if (typeReference.type === \"list\") {\n const itemType = typeReference.value;\n if (itemType.type === \"optional\") {\n return {\n type: \"list\",\n value: itemType.value\n };\n }\n }\n return typeReference;\n}\n\nexport class EndpointSnippetGenerator {\n private context: DynamicSnippetsGeneratorContext;\n private formatter: AbstractFormatter | undefined;\n\n constructor({ context, formatter }: { context: DynamicSnippetsGeneratorContext; formatter?: AbstractFormatter }) {\n this.context = context;\n this.formatter = formatter;\n }\n\n public async generateSnippet({\n endpoint,\n request,\n options\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n options: Options;\n }): Promise<string> {\n const config = this.getConfig(options);\n const code = this.buildCodeBlock({ endpoint, snippet: request, options });\n return await code.toStringAsync({\n packageName: config.fullStylePackageName ?? SNIPPET_PACKAGE_NAME,\n customConfig: this.context.customConfig,\n formatter: this.formatter\n });\n }\n\n public generateSnippetSync({\n endpoint,\n request,\n options\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n request: FernIr.dynamic.EndpointSnippetRequest;\n options: Options;\n }): string {\n const config = this.getConfig(options);\n const code = this.buildCodeBlock({ endpoint, snippet: request, options });\n return code.toString({\n packageName: config.fullStylePackageName ?? SNIPPET_PACKAGE_NAME,\n customConfig: this.context.customConfig,\n formatter: this.formatter\n });\n }\n\n private buildCodeBlock({\n endpoint,\n snippet,\n options\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n options: Options;\n }): java.AstNode {\n const body = java.codeblock((writer) => {\n writer.writeNodeStatement(this.constructClient({ endpoint, snippet }));\n writer.newLine();\n writer.writeNodeStatement(this.callMethod({ endpoint, snippet }));\n });\n const style = this.getStyle(options);\n switch (style) {\n case Style.Concise:\n return body;\n case Style.Full:\n return this.buildFullCodeBlock({ body, options });\n default:\n assertNever(style);\n }\n }\n\n private constructClient({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): java.CodeBlock {\n return java.codeblock((writer) => {\n writer.writeNode(this.context.getRootClientClassReference());\n writer.write(` ${CLIENT_VAR_NAME} = `);\n writer.writeNode(\n java.TypeLiteral.builder({\n classReference: this.context.getRootClientClassReference(),\n parameters: this.getRootClientBuilderArgs({ endpoint, snippet })\n })\n );\n });\n }\n\n private buildFullCodeBlock({ body, options }: { body: java.CodeBlock; options: Options }): java.AstNode {\n const config = this.getConfig(options);\n const class_ = java.class_({\n name: config.fullStyleClassName ?? SNIPPET_CLASS_NAME,\n access: java.Access.Public\n });\n const stringArgs = java.parameter({\n name: SNIPPET_METHOD_ARG,\n type: java.Type.array(java.Type.string())\n });\n class_.addMethod(\n java.method({\n name: SNIPPET_METHOD_NAME,\n access: java.Access.Public,\n static_: true,\n parameters: [stringArgs],\n body\n })\n );\n return class_;\n }\n\n private getRootClientBuilderArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): java.BuilderParameter[] {\n const builderArgs: java.BuilderParameter[] = [];\n if (endpoint.auth != null) {\n if (snippet.auth != null) {\n builderArgs.push(...this.getRootClientAuthArgs({ auth: endpoint.auth, values: snippet.auth }));\n } else {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Auth with ${endpoint.auth.type} configuration is required for this endpoint`\n });\n }\n }\n const baseUrlArg = this.getRootClientBaseUrlArg({\n baseUrl: snippet.baseURL,\n environment: snippet.environment\n });\n if (baseUrlArg != null) {\n builderArgs.push(baseUrlArg);\n }\n this.context.errors.scope(Scope.Headers);\n if (this.context.ir.headers != null && snippet.headers != null) {\n builderArgs.push(\n ...this.getRootClientHeaderArgs({ headers: this.context.ir.headers, values: snippet.headers })\n );\n }\n this.context.errors.unscope();\n\n const usedVariables = new Set<string>();\n const allPathParams = [...(this.context.ir.pathParameters ?? []), ...(endpoint.request.pathParameters ?? [])];\n\n allPathParams.forEach((param) => {\n if (param.variable != null) {\n usedVariables.add(param.variable);\n }\n });\n\n if (this.context.ir.variables != null && this.context.ir.variables.length > 0) {\n for (const variable of this.context.ir.variables) {\n if (usedVariables.has(variable.id)) {\n const variableName = variable.name.camelCase.unsafeName;\n builderArgs.push({\n name: variableName,\n value: java.TypeLiteral.string(`YOUR_${variable.name.screamingSnakeCase.unsafeName}`)\n });\n }\n }\n }\n\n this.context.errors.scope(Scope.PathParameters);\n if (this.context.ir.pathParameters != null && this.context.ir.pathParameters.length > 0) {\n const apiPathParams = this.context.ir.pathParameters.filter((param) => param.variable == null);\n if (apiPathParams.length > 0) {\n builderArgs.push(...this.getPathParameters({ namedParameters: apiPathParams, snippet }));\n }\n }\n this.context.errors.unscope();\n\n return builderArgs;\n }\n\n private getRootClientBaseUrlArg({\n baseUrl,\n environment\n }: {\n baseUrl: string | undefined;\n environment: FernIr.dynamic.EnvironmentValues | undefined;\n }): java.BuilderParameter | undefined {\n if (baseUrl != null && environment != null) {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"Cannot specify both baseUrl and environment options\"\n });\n return undefined;\n }\n if (baseUrl != null) {\n if (this.context.ir.environments?.environments.type === \"multipleBaseUrls\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: \"The Java SDK doesn't support a baseUrl when multiple URL environments are configured\"\n });\n return undefined;\n }\n return {\n name: \"url\",\n value: java.TypeLiteral.string(baseUrl)\n };\n }\n if (environment != null) {\n if (this.context.isSingleEnvironmentID(environment)) {\n const classReference = this.context.getEnvironmentTypeReferenceFromID(environment);\n if (classReference == null) {\n this.context.errors.add({\n severity: Severity.Warning,\n message: `Environment ${JSON.stringify(environment)} was not found`\n });\n return undefined;\n }\n return {\n name: \"environment\",\n value: java.TypeLiteral.reference(classReference)\n };\n }\n if (this.context.isMultiEnvironmentValues(environment)) {\n if (!this.context.validateMultiEnvironmentUrlValues(environment)) {\n return undefined;\n }\n return {\n name: \"environment\",\n value: java.TypeLiteral.reference(\n java.instantiateClass({\n classReference: this.context.getEnvironmentClassReference(),\n arguments_: Object.values(environment).map((value) =>\n this.context.dynamicTypeLiteralMapper.convert({\n typeReference: STRING_TYPE_REFERENCE,\n value\n })\n )\n })\n )\n };\n }\n }\n return undefined;\n }\n\n private getRootClientAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.Auth;\n values: FernIr.dynamic.AuthValues;\n }): java.BuilderParameter[] {\n if (values.type !== auth.type) {\n this.addError(this.context.newAuthMismatchError({ auth, values }).message);\n return [];\n }\n switch (auth.type) {\n case \"basic\":\n return values.type === \"basic\" ? this.getRootClientBasicAuthArgs({ auth, values }) : [];\n case \"bearer\":\n return values.type === \"bearer\" ? this.getRootClientBearerAuthArgs({ auth, values }) : [];\n case \"header\":\n return values.type === \"header\" ? this.getRootClientHeaderAuthArgs({ auth, values }) : [];\n case \"oauth\":\n return values.type === \"oauth\" ? this.getRootClientOAuthArgs({ auth, values }) : [];\n case \"inferred\":\n this.addWarning(\"The Java SDK Generator does not support Inferred auth scheme yet\");\n return [];\n default:\n assertNever(auth);\n }\n }\n\n private addError(message: string): void {\n this.context.errors.add({ severity: Severity.Critical, message });\n }\n\n private addWarning(message: string): void {\n this.context.errors.add({ severity: Severity.Warning, message });\n }\n\n private getRootClientBasicAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BasicAuth;\n values: FernIr.dynamic.BasicAuthValues;\n }): java.BuilderParameter[] {\n return [\n {\n name: \"credentials\",\n value: java.TypeLiteral.raw(`\"${values.username}\", \"${values.password}\"`)\n }\n ];\n }\n\n private getRootClientBearerAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.BearerAuth;\n values: FernIr.dynamic.BearerAuthValues;\n }): java.BuilderParameter[] {\n return [\n {\n name: this.context.getMethodName(auth.token),\n value: java.TypeLiteral.string(values.token)\n }\n ];\n }\n\n private getRootClientHeaderAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.HeaderAuth;\n values: FernIr.dynamic.HeaderAuthValues;\n }): java.BuilderParameter[] {\n return [\n {\n name: this.context.getMethodName(auth.header.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: auth.header.typeReference,\n value: values.value\n })\n }\n ];\n }\n\n private getRootClientOAuthArgs({\n auth,\n values\n }: {\n auth: FernIr.dynamic.OAuth;\n values: FernIr.dynamic.OAuthValues;\n }): java.BuilderParameter[] {\n return [\n {\n name: this.context.getMethodName(auth.clientId),\n value: java.TypeLiteral.string(values.clientId)\n },\n {\n name: this.context.getMethodName(auth.clientSecret),\n value: java.TypeLiteral.string(values.clientSecret)\n }\n ];\n }\n\n private getRootClientHeaderArgs({\n headers,\n values\n }: {\n headers: FernIr.dynamic.NamedParameter[];\n values: FernIr.dynamic.Values;\n }): java.BuilderParameter[] {\n const args: java.BuilderParameter[] = [];\n for (const header of headers) {\n const arg = this.getRootClientHeaderArg({ header, value: values.value });\n if (arg != null) {\n args.push({\n name: this.context.getMethodName(header.name.name),\n value: arg\n });\n }\n }\n return args;\n }\n\n private getRootClientHeaderArg({\n header,\n value\n }: {\n header: FernIr.dynamic.NamedParameter;\n value: unknown;\n }): java.TypeLiteral | undefined {\n const typeLiteral = this.context.dynamicTypeLiteralMapper.convert({\n typeReference: header.typeReference,\n value\n });\n if (java.TypeLiteral.isNop(typeLiteral)) {\n // Literal header values (e.g. \"X-API-Version\") should not be included in the\n // client constructor.\n return undefined;\n }\n return typeLiteral;\n }\n\n private callMethod({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): java.MethodInvocation {\n return java.invokeMethod({\n on: java.codeblock(CLIENT_VAR_NAME),\n method: this.getMethod({ endpoint }),\n arguments_: this.getMethodArgs({ endpoint, snippet })\n });\n }\n\n private getMethodArgs({\n endpoint,\n snippet\n }: {\n endpoint: FernIr.dynamic.Endpoint;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): java.TypeLiteral[] {\n switch (endpoint.request.type) {\n case \"inlined\":\n return this.getMethodArgsForInlinedRequest({ request: endpoint.request, snippet });\n case \"body\":\n return this.getMethodArgsForBodyRequest({ request: endpoint.request, snippet });\n default:\n assertNever(endpoint.request);\n }\n }\n\n private getMethodArgsForBodyRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.BodyRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): java.TypeLiteral[] {\n const args: java.TypeLiteral[] = [];\n\n this.context.errors.scope(Scope.PathParameters);\n // Only include endpoint-level path parameters that don't reference variables\n // Variables are configured at client level, not passed as method args\n const pathParameters = (request.pathParameters ?? []).filter((param) => param.variable == null);\n if (pathParameters.length > 0) {\n args.push(\n ...this.getPathParameters({ namedParameters: pathParameters, snippet }).map((field) => field.value)\n );\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n if (request.body != null) {\n args.push(this.getBodyRequestArg({ body: request.body, value: snippet.requestBody }));\n }\n this.context.errors.unscope();\n\n // For body requests, headers are passed via RequestOptions\n const requestOptionsArg = this.getRequestOptionsArg({ request, snippet });\n if (requestOptionsArg != null) {\n args.push(requestOptionsArg);\n }\n\n return args;\n }\n\n private usesOptionalNullable(): boolean {\n return this.context.customConfig?.[\"collapse-optional-nullable\"] === true;\n }\n\n private getBodyRequestArg({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): java.TypeLiteral {\n switch (body.type) {\n case \"bytes\": {\n return this.getBytesBodyRequestArg({ value });\n }\n case \"typeReference\": {\n if (body.value.type === \"optional\") {\n // TODO(amckinney): This endpoint defines an optional request body, so the\n // Java SDK requires the Optional.of(...) wrapper.\n //\n // We should fix the generator to permit the non-Optional type and\n // remove this special case.\n\n // Check if value is undefined/null and use Optional.empty() or OptionalNullable.absent()\n if (value === undefined || value === null) {\n if (this.usesOptionalNullable()) {\n return this.context.getOptionalNullableAbsent();\n } else {\n return java.TypeLiteral.reference(\n java.invokeMethod({\n on: java.classReference({\n name: \"Optional\",\n packageName: \"java.util\"\n }),\n method: \"empty\",\n arguments_: []\n })\n );\n }\n }\n\n const convertedValue = this.context.dynamicTypeLiteralMapper.convert({\n typeReference: body.value.value,\n value,\n as: \"request\"\n });\n\n // Check if the converted value is already Optional.empty() or OptionalNullable.absent() to avoid double-wrapping\n const convertedValueStr = convertedValue.toString({\n packageName: \"com.example\",\n customConfig: this.context.customConfig\n });\n\n if (\n convertedValueStr.includes(\"Optional.empty()\") ||\n convertedValueStr.includes(\"OptionalNullable.absent()\")\n ) {\n return convertedValue;\n }\n\n if (this.usesOptionalNullable()) {\n return this.context.getOptionalNullableOf(convertedValue);\n } else {\n return java.TypeLiteral.optional({\n value: convertedValue,\n useOf: true\n });\n }\n }\n return this.context.dynamicTypeLiteralMapper.convert({\n typeReference: body.value,\n value,\n as: \"request\"\n });\n }\n default:\n assertNever(body);\n }\n }\n\n private getBytesBodyRequestArg({ value }: { value: unknown }): java.TypeLiteral {\n if (value === undefined || value === null) {\n return java.TypeLiteral.bytes(\"\");\n }\n if (typeof value !== \"string\") {\n this.context.errors.add({\n severity: Severity.Critical,\n message: `Expected bytes value to be a string, got ${typeof value}`\n });\n return java.TypeLiteral.nop();\n }\n return java.TypeLiteral.bytes(value as string);\n }\n\n private getMethodArgsForInlinedRequest({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): java.TypeLiteral[] {\n const args: java.TypeLiteral[] = [];\n\n const { inlinePathParameters, inlineFileProperties } = {\n inlinePathParameters: this.context.shouldInlinePathParameters(),\n inlineFileProperties: this.context.shouldInlineFileProperties()\n };\n\n this.context.errors.scope(Scope.PathParameters);\n const pathParameterFields: java.BuilderParameter[] = [];\n // Only include endpoint-level path parameters that don't reference variables\n const nonVariablePathParams = (request.pathParameters ?? []).filter((param) => param.variable == null);\n if (nonVariablePathParams.length > 0) {\n pathParameterFields.push(...this.getPathParameters({ namedParameters: nonVariablePathParams, snippet }));\n }\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const filePropertyInfo = this.getFilePropertyInfo({ request, snippet });\n this.context.errors.unscope();\n\n if (\n !this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ) {\n args.push(...pathParameterFields.map((field) => field.value));\n }\n\n // For now, the Java SDK always includes file properties as positional parameters.\n if (!inlineFileProperties) {\n args.push(...filePropertyInfo.fileFields.map((field) => field.value));\n }\n\n // For now, the Java SDK always requires the inlined request parameter.\n args.push(\n this.getInlinedRequestArg({\n request,\n snippet,\n pathParameterFields: this.context.includePathParametersInWrappedRequest({\n request,\n inlinePathParameters\n })\n ? pathParameterFields\n : [],\n filePropertyInfo\n })\n );\n\n return args;\n }\n\n private getFilePropertyInfo({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): FilePropertyInfo {\n if (request.body == null || !this.context.isFileUploadRequestBody(request.body)) {\n return {\n fileFields: [],\n bodyPropertyFields: []\n };\n }\n return this.context.filePropertyMapper.getFilePropertyInfo({\n body: request.body,\n value: snippet.requestBody\n });\n }\n\n private getInlinedRequestArg({\n request,\n snippet,\n pathParameterFields,\n filePropertyInfo\n }: {\n request: FernIr.dynamic.InlinedRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n pathParameterFields: java.BuilderParameter[];\n filePropertyInfo: FilePropertyInfo;\n }): java.TypeLiteral {\n this.context.errors.scope(Scope.QueryParameters);\n const queryParameters = this.context.associateQueryParametersByWireValue({\n parameters: request.queryParameters ?? [],\n values: snippet.queryParameters ?? {}\n });\n const filteredQueryParameters = queryParameters.filter(\n (queryParameter) => !this.context.isDirectLiteral(queryParameter.typeReference)\n );\n const sortedQueryParameters = this.context.sortTypeInstancesByRequiredFirst(\n filteredQueryParameters,\n request.queryParameters ?? []\n );\n const queryParameterFields = sortedQueryParameters.map((queryParameter) => ({\n name: this.context.getMethodName(queryParameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n // Unwrap optional from list items for allow-multiple query params.\n // Java SDK builders have convenience overloads that accept List<T>.\n typeReference: unwrapOptionalFromListItems(queryParameter.typeReference),\n value: queryParameter.value,\n as: \"request\"\n })\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.Headers);\n const headers = this.context.associateByWireValue({\n parameters: request.headers ?? [],\n values: snippet.headers ?? {}\n });\n const filteredHeaders = headers.filter((header) => !this.context.isDirectLiteral(header.typeReference));\n const sortedHeaders = this.context.sortTypeInstancesByRequiredFirst(filteredHeaders, request.headers ?? []);\n const headerFields = sortedHeaders.map((header) => ({\n name: this.context.getMethodName(header.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: header.typeReference,\n value: header.value,\n as: \"request\"\n })\n }));\n this.context.errors.unscope();\n\n this.context.errors.scope(Scope.RequestBody);\n const requestBodyFields =\n request.body != null\n ? this.getInlinedRequestBodyBuilderParameters({\n body: request.body,\n value: snippet.requestBody,\n filePropertyInfo\n })\n : [];\n this.context.errors.unscope();\n\n return java.TypeLiteral.builder({\n classReference: java.classReference({\n name: this.context.getClassName(request.declaration.name),\n packageName: this.context.getRequestsPackageName(request.declaration.fernFilepath)\n }),\n parameters: [...pathParameterFields, ...headerFields, ...queryParameterFields, ...requestBodyFields]\n });\n }\n\n private getRequestOptionsArg({\n request,\n snippet\n }: {\n request: FernIr.dynamic.InlinedRequest | FernIr.dynamic.BodyRequest;\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): java.TypeLiteral | undefined {\n const requestHeaders = \"headers\" in request ? (request.headers ?? []) : [];\n\n if (requestHeaders.length === 0 || Object.keys(snippet.headers ?? {}).length === 0) {\n return undefined;\n }\n\n this.context.errors.scope(Scope.Headers);\n const headers = this.context.associateByWireValue({\n parameters: requestHeaders,\n values: snippet.headers ?? {}\n });\n this.context.errors.unscope();\n\n if (headers.length === 0) {\n return undefined;\n }\n\n const requestOptionsClass = java.classReference({\n name: \"RequestOptions\",\n packageName: this.context.getCorePackageName()\n });\n\n let builderChain: java.AstNode = java.invokeMethod({\n on: requestOptionsClass,\n method: \"builder\",\n arguments_: []\n });\n\n for (const header of headers) {\n builderChain = java.invokeMethod({\n on: builderChain,\n method: \"addHeader\",\n arguments_: [\n java.TypeLiteral.string(header.name.wireValue),\n this.context.dynamicTypeLiteralMapper.convert(header)\n ]\n });\n }\n\n const buildMethodCall = java.invokeMethod({\n on: builderChain,\n method: \"build\",\n arguments_: []\n });\n\n return java.TypeLiteral.reference(buildMethodCall);\n }\n\n private getInlinedRequestBodyBuilderParameters({\n body,\n value,\n filePropertyInfo\n }: {\n body: FernIr.dynamic.InlinedRequestBody;\n value: unknown;\n filePropertyInfo: FilePropertyInfo;\n }): java.BuilderParameter[] {\n switch (body.type) {\n case \"properties\":\n return this.getInlinedRequestBodyPropertyBuilderParameters({ parameters: body.value, value });\n case \"referenced\":\n return [this.getReferencedRequestBodyPropertyBuilderParameter({ body, value })];\n case \"fileUpload\":\n return this.getFileUploadRequestBodyBuilderParameters({ filePropertyInfo });\n default:\n assertNever(body);\n }\n }\n\n private getFileUploadRequestBodyBuilderParameters({\n filePropertyInfo\n }: {\n filePropertyInfo: FilePropertyInfo;\n }): java.BuilderParameter[] {\n if (this.context.shouldInlineFileProperties()) {\n return [...filePropertyInfo.fileFields, ...filePropertyInfo.bodyPropertyFields];\n }\n return filePropertyInfo.bodyPropertyFields;\n }\n\n private getReferencedRequestBodyPropertyBuilderParameter({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBody;\n value: unknown;\n }): java.BuilderParameter {\n return {\n name: this.context.getMethodName(body.bodyKey),\n value: this.getReferencedRequestBodyPropertyTypeLiteral({ body: body.bodyType, value })\n };\n }\n\n private getReferencedRequestBodyPropertyTypeLiteral({\n body,\n value\n }: {\n body: FernIr.dynamic.ReferencedRequestBodyType;\n value: unknown;\n }): java.TypeLiteral {\n switch (body.type) {\n case \"bytes\":\n return this.getBytesBodyRequestArg({ value });\n case \"typeReference\":\n return this.context.dynamicTypeLiteralMapper.convert({\n typeReference: body.value,\n value,\n as: \"request\"\n });\n default:\n assertNever(body);\n }\n }\n\n private getInlinedRequestBodyPropertyBuilderParameters({\n parameters,\n value\n }: {\n parameters: FernIr.dynamic.NamedParameter[];\n value: unknown;\n }): java.BuilderParameter[] {\n const bodyProperties = this.context.associateByWireValue({\n parameters,\n values: this.context.getRecord(value) ?? {}\n });\n const filteredProperties = bodyProperties.filter(\n (parameter) => !this.context.isDirectLiteral(parameter.typeReference)\n );\n const sortedProperties = this.context.sortTypeInstancesByRequiredFirst(filteredProperties, parameters);\n return sortedProperties.map((parameter) => ({\n name: this.context.getMethodName(parameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert({\n typeReference: parameter.typeReference,\n value: parameter.value,\n as: \"request\"\n })\n }));\n }\n\n private getPathParameters({\n namedParameters,\n snippet\n }: {\n namedParameters: FernIr.dynamic.NamedParameter[];\n snippet: FernIr.dynamic.EndpointSnippetRequest;\n }): java.BuilderParameter[] {\n const args: java.BuilderParameter[] = [];\n const pathParameters = this.context.associateByWireValue({\n parameters: namedParameters,\n values: snippet.pathParameters ?? {}\n });\n for (const parameter of pathParameters) {\n args.push({\n name: this.context.getMethodName(parameter.name.name),\n value: this.context.dynamicTypeLiteralMapper.convert(parameter)\n });\n }\n return args;\n }\n\n private getMethod({ endpoint }: { endpoint: FernIr.dynamic.Endpoint }): string {\n if (endpoint.declaration.fernFilepath.allParts.length > 0) {\n return `${endpoint.declaration.fernFilepath.allParts\n .map((val) => `${this.context.getMethodName(val)}()`)\n .join(\".\")}.${this.context.getMethodName(endpoint.declaration.name)}`;\n }\n return this.context.getMethodName(endpoint.declaration.name);\n }\n\n private getStyle(options: Options): Style {\n return options.style ?? this.context.options.style ?? Style.Full;\n }\n\n private getConfig(options: Options): Config {\n return options.config ?? this.context.options.config ?? {};\n }\n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AAX,EAAAD,EAAQ,SAAR,KAAAC,EAAkB,KAAK,QAAQ,QAAQ,SAAvC,KAAAW,EAAiD,CAAC,CAC7D,CACJ","names":["init_process","init_buffer","SNIPPET_PACKAGE_NAME","SNIPPET_CLASS_NAME","SNIPPET_METHOD_NAME","SNIPPET_METHOD_ARG","CLIENT_VAR_NAME","STRING_TYPE_REFERENCE","unwrapOptionalFromListItems","typeReference","itemType","EndpointSnippetGenerator","context","formatter","__publicField","endpoint","request","options","_a","config","snippet","body","java_exports","writer","style","Style","assertNever","class_","stringArgs","_b","builderArgs","Severity","baseUrlArg","Scope","usedVariables","param","variable","variableName","apiPathParams","baseUrl","environment","classReference","value","auth","values","message","headers","args","header","arg","typeLiteral","pathParameters","field","requestOptionsArg","convertedValue","convertedValueStr","inlinePathParameters","inlineFileProperties","pathParameterFields","nonVariablePathParams","filePropertyInfo","_c","_d","_e","_f","filteredQueryParameters","queryParameter","queryParameterFields","filteredHeaders","headerFields","requestBodyFields","requestHeaders","requestOptionsClass","builderChain","buildMethodCall","parameters","filteredProperties","parameter","namedParameters","val"]}
|
|
File without changes
|
|
File without changes
|