@@ -948,6 +948,82 @@ describe("cli", () => {
948948 expect ( config . headers . Cookie ) . toBe ( "session_id=cookie-abc" ) ;
949949 } ) ;
950950
951+ it ( "shows schema hints in command help output" , async ( ) => {
952+ const localDir = `${ cwd } /.ocli` ;
953+ const profilesPath = `${ localDir } /profiles.ini` ;
954+ const cachePath = `${ localDir } /specs/help-hints-api.json` ;
955+
956+ const spec = {
957+ openapi : "3.1.0" ,
958+ paths : {
959+ "/reports" : {
960+ post : {
961+ requestBody : {
962+ required : true ,
963+ content : {
964+ "application/json" : {
965+ schema : {
966+ type : "object" ,
967+ properties : {
968+ format : {
969+ type : "string" ,
970+ enum : [ "csv" , "json" ] ,
971+ default : "json" ,
972+ } ,
973+ note : {
974+ type : "string" ,
975+ nullable : true ,
976+ } ,
977+ filter : {
978+ oneOf : [
979+ { type : "string" } ,
980+ { type : "integer" } ,
981+ ] ,
982+ } ,
983+ } ,
984+ required : [ "format" ] ,
985+ } ,
986+ } ,
987+ } ,
988+ } ,
989+ } ,
990+ } ,
991+ } ,
992+ } ;
993+
994+ const iniContent = [
995+ "[help-hints-api]" ,
996+ "api_base_url = https://api.example.com" ,
997+ "api_basic_auth = " ,
998+ "api_bearer_token = tok" ,
999+ "openapi_spec_source = /spec.json" ,
1000+ `openapi_spec_cache = ${ cachePath } ` ,
1001+ "include_endpoints = " ,
1002+ "exclude_endpoints = " ,
1003+ "" ,
1004+ ] . join ( "\n" ) ;
1005+
1006+ const log : string [ ] = [ ] ;
1007+ const { profileStore, openapiLoader } = createCliDeps ( cwd , homeDir , {
1008+ [ profilesPath ] : iniContent ,
1009+ [ cachePath ] : JSON . stringify ( spec ) ,
1010+ [ `${ localDir } /current` ] : "help-hints-api" ,
1011+ } ) ;
1012+
1013+ await run ( [ "reports" , "--help" ] , {
1014+ cwd,
1015+ profileStore,
1016+ openapiLoader,
1017+ stdout : ( msg : string ) => log . push ( msg ) ,
1018+ } ) ;
1019+
1020+ const out = log . join ( "" ) ;
1021+ expect ( out ) . toContain ( 'enum: "csv", "json"' ) ;
1022+ expect ( out ) . toContain ( 'default: "json"' ) ;
1023+ expect ( out ) . toContain ( "nullable" ) ;
1024+ expect ( out ) . toContain ( "oneOf: string | integer" ) ;
1025+ } ) ;
1026+
9511027 it ( "serializes query arrays and deepObject parameters from spec metadata" , async ( ) => {
9521028 const localDir = `${ cwd } /.ocli` ;
9531029 const profilesPath = `${ localDir } /profiles.ini` ;
0 commit comments