@@ -1545,6 +1545,7 @@ function generateApiTypesCode(
15451545 out . push ( "//! Auto-generated from api.schema.json — do not edit manually." ) ;
15461546 out . push ( "" ) ;
15471547 out . push ( "#![allow(clippy::large_enum_variant)]" ) ;
1548+ out . push ( "#![allow(dead_code)]" ) ;
15481549 out . push ( "" ) ;
15491550 out . push ( "use std::collections::HashMap;" ) ;
15501551 out . push ( "" ) ;
@@ -1776,6 +1777,17 @@ function getResultTypeName(
17761777 return `${ toPascalCase ( method . rpcMethod ) } Result` ;
17771778}
17781779
1780+ function methodUsesInternalSchema (
1781+ schema : JSONSchema7 | null | undefined ,
1782+ defCollections : DefinitionCollections ,
1783+ ) : boolean {
1784+ if ( ! schema ) return false ;
1785+
1786+ const nonNullable = getNullableInner ( schema ) ?? schema ;
1787+ const resolved = resolveSchema ( nonNullable , defCollections ) ?? nonNullable ;
1788+ return isSchemaInternal ( resolved ) ;
1789+ }
1790+
17791791function pushNamespaceMethodBody (
17801792 out : string [ ] ,
17811793 constName : string ,
@@ -1884,7 +1896,12 @@ function emitNamespaceMethod(
18841896 } ;
18851897
18861898 const paramArg = hasParams ? `, params: ${ paramsTypeName } ` : "" ;
1887- const fnVis = method . visibility === "internal" ? "pub(crate)" : "pub" ;
1899+ const fnVis =
1900+ method . visibility === "internal" ||
1901+ methodUsesInternalSchema ( method . params , defCollections ) ||
1902+ methodUsesInternalSchema ( method . result , defCollections )
1903+ ? "pub(crate)"
1904+ : "pub" ;
18881905
18891906 if ( hasParams && paramsInfo . optional ) {
18901907 out . push ( ...buildDocs ( false ) ) ;
@@ -1949,6 +1966,7 @@ function generateRpcCode(apiSchema: ApiSchema): string {
19491966 out . push ( "" ) ;
19501967 out . push ( "#![allow(missing_docs)]" ) ;
19511968 out . push ( "#![allow(clippy::too_many_arguments)]" ) ;
1969+ out . push ( "#![allow(dead_code)]" ) ;
19521970 out . push ( "" ) ;
19531971 out . push ( "use super::api_types::{rpc_methods, *};" ) ;
19541972 const externalTypeRefs = new Map < string , Set < string > > ( ) ;
0 commit comments