@@ -9,7 +9,7 @@ import { XmsPageable } from "./model/x_ms_pageable.js";
99import { MutabilityEnum } from "./model/fields.js" ;
1010import { CMDHttpRequest , CMDHttpResponse } from "./model/http.js" ;
1111import { CMDArraySchemaBase , CMDClsSchemaBase , CMDObjectSchema , CMDObjectSchemaBase , CMDSchema , CMDSchemaBase , CMDStringSchema , CMDStringSchemaBase , CMDIntegerSchemaBase } from "./model/schema.js" ;
12- import { reportDiagnostic } from "./lib.js" ;
12+ import { getTracer , reportDiagnostic } from "./lib.js" ;
1313import {
1414 getExtensions ,
1515 isReadonlyProperty ,
@@ -398,6 +398,7 @@ function buildSchemaEmitterContext(context: AAZOperationEmitterContext, param: T
398398 return {
399399 ...context ,
400400 collectionFormat,
401+ deep : 0 ,
401402 }
402403}
403404
@@ -452,32 +453,55 @@ function convert2CMDSchemaBase(context: AAZSchemaEmitterContext, type: Type): CM
452453 if ( isNeverType ( type ) ) {
453454 return undefined ;
454455 }
456+ // const tracer = getTracer(context.program);
457+ // tracer.trace("Deeps", context.deep.toString());
455458 let schema ;
456459 switch ( type . kind ) {
457460 case "Intrinsic" :
458461 schema = undefined ;
459462 break ;
460463 case "Scalar" :
461- schema = convertScalar2CMDSchemaBase ( context , type as Scalar ) ;
464+ schema = convertScalar2CMDSchemaBase ( {
465+ ...context ,
466+ deep : context . deep + 1 ,
467+ } , type as Scalar ) ;
462468 break ;
463469 case "Model" :
464470 if ( isArrayModelType ( context . program , type ) ) {
465- schema = convertModel2CMDArraySchemaBase ( context , type as Model ) ;
471+ schema = convertModel2CMDArraySchemaBase ( {
472+ ...context ,
473+ deep : context . deep + 1 ,
474+ } , type as Model ) ;
466475 } else {
467- schema = convertModel2CMDObjectSchemaBase ( context , type as Model ) ;
476+ schema = convertModel2CMDObjectSchemaBase ( {
477+ ...context ,
478+ deep : context . deep + 1 ,
479+ } , type as Model ) ;
468480 }
469481 break ;
470482 case "ModelProperty" :
471- schema = convert2CMDSchema ( context , type . type as ModelProperty ) ;
483+ schema = convert2CMDSchema ( {
484+ ...context ,
485+ deep : context . deep + 1 ,
486+ } , type . type as ModelProperty ) ;
472487 break ;
473488 case "UnionVariant" :
474- schema = convert2CMDSchemaBase ( context , type . type ) ;
489+ schema = convert2CMDSchemaBase ( {
490+ ...context ,
491+ deep : context . deep + 1 ,
492+ } , type . type ) ;
475493 break ;
476494 case "Union" :
477- schema = convertUnion2CMDSchemaBase ( context , type as Union ) ;
495+ schema = convertUnion2CMDSchemaBase ( {
496+ ...context ,
497+ deep : context . deep + 1 ,
498+ } , type as Union ) ;
478499 break ;
479500 case "Enum" :
480- schema = convertEnum2CMDSchemaBase ( context , type as Enum ) ;
501+ schema = convertEnum2CMDSchemaBase ( {
502+ ...context ,
503+ deep : context . deep + 1 ,
504+ } , type as Enum ) ;
481505 break ;
482506 // TODO: handle Literals
483507 // case "Number":
@@ -573,7 +597,7 @@ function convertModel2CMDArraySchemaBase(context: AAZSchemaEmitterContext, model
573597 if ( isArrayModelType ( context . program , model ) ) {
574598 const array : CMDArraySchemaBase = {
575599 type : "array" ,
576- item : convert2CMDSchemaBase ( context , model . indexer . value ! ) ,
600+ // item: convert2CMDSchemaBase(context, model.indexer.value!),
577601 identifiers : getExtensions ( context . program , model ) . get ( "x-ms-identifiers" ) ,
578602 } ;
579603 if ( ! array . identifiers && getProperty ( model . indexer . value as Model , "id" ) ) {
0 commit comments