@@ -29,14 +29,14 @@ public static LandingNavigationItem CreateNavigation(OpenApiDocument openApiDocu
2929 foreach ( var path in openApiDocument . Paths )
3030 {
3131 var endpointUrl = $ "{ url } /{ path . Key . Trim ( '/' ) . Replace ( '/' , '-' ) . Replace ( "{" , "" ) . Replace ( "}" , "" ) } ";
32- var apiEndpoint = new ApiEndpoint ( endpointUrl , path . Key , path . Value , rootNavigation ) ;
33- var endpointNavigationItem = new EndpointNavigationItem ( 1 , apiEndpoint , rootNavigation , rootNavigation ) ;
32+ var apiEndpoint = new ApiEndpoint ( path . Key , path . Value ) ;
33+ var endpointNavigationItem = new EndpointNavigationItem ( 1 , endpointUrl , apiEndpoint , rootNavigation , rootNavigation ) ;
3434 var endpointNavigationItems = new List < OperationNavigationItem > ( ) ;
3535 foreach ( var operation in path . Value . Operations )
3636 {
3737 var operationUrl = $ "{ endpointUrl } /{ operation . Key . ToString ( ) . ToLowerInvariant ( ) } ";
38- var apiOperation = new ApiOperation ( operationUrl , operation . Key , operation . Value , rootNavigation ) ;
39- var navigation = new OperationNavigationItem ( 2 , apiOperation , endpointNavigationItem , rootNavigation ) ;
38+ var apiOperation = new ApiOperation ( operation . Key , operation . Value ) ;
39+ var navigation = new OperationNavigationItem ( 2 , operationUrl , apiOperation , endpointNavigationItem , rootNavigation ) ;
4040 endpointNavigationItems . Add ( navigation ) ;
4141 }
4242
@@ -65,32 +65,33 @@ public async Task Generate(Cancel ctx = default)
6565
6666 var renderContext = new ApiRenderContext ( context , openApiDocument , _contentHashProvider )
6767 {
68- NavigationHtml = navigationHtml
68+ NavigationHtml = navigationHtml ,
69+ CurrentNavigation = navigation ,
6970 } ;
70- _ = await Render ( navigation . Landing , renderContext , ctx ) ;
71- foreach ( var endpoint in navigation . NavigationItems . OfType < EndpointNavigationItem > ( ) )
71+ _ = await Render ( navigation . Index , renderContext , ctx ) ;
72+ foreach ( var endpoint in navigation . NavigationItems )
7273 {
73- _ = await Render ( endpoint . Endpoint , renderContext , ctx ) ;
74- foreach ( var operation in endpoint . NavigationItems . OfType < OperationNavigationItem > ( ) )
75- _ = await Render ( operation . Operation , renderContext , ctx ) ;
74+ _ = await Render ( endpoint . Index , renderContext , ctx ) ;
75+ foreach ( var operation in endpoint . NavigationItems )
76+ _ = await Render ( operation . Model , renderContext , ctx ) ;
7677 }
7778 }
7879
7980 private async Task < IFileInfo > Render < T > ( T page , ApiRenderContext renderContext , Cancel ctx )
80- where T : IPageInformation , IPageRenderer < ApiRenderContext >
81+ where T : INavigationModel , IPageRenderer < ApiRenderContext >
8182 {
82- var outputFile = OutputFile ( page ) ;
83+ var outputFile = OutputFile ( renderContext . CurrentNavigation ) ;
8384 if ( ! outputFile . Directory ! . Exists )
8485 outputFile . Directory . Create ( ) ;
8586
8687 await using var stream = _writeFileSystem . FileStream . New ( outputFile . FullName , FileMode . OpenOrCreate ) ;
8788 await page . RenderAsync ( stream , renderContext , ctx ) ;
8889 return outputFile ;
8990
90- IFileInfo OutputFile ( IPageInformation pageInformation )
91+ IFileInfo OutputFile ( INavigationItem currentNavigation )
9192 {
9293 const string indexHtml = "index.html" ;
93- var fileName = pageInformation . Url + "/" + indexHtml ;
94+ var fileName = currentNavigation . Url + "/" + indexHtml ;
9495 var fileInfo = _writeFileSystem . FileInfo . New ( Path . Combine ( context . DocumentationOutputDirectory . FullName , fileName . Trim ( '/' ) ) ) ;
9596 return fileInfo ;
9697 }
0 commit comments