@@ -50,18 +50,16 @@ interface ParameterReportItem {
5050 params : ReportItem [ ]
5151}
5252
53- type Metadata = Partial < Pick < Blueprint , 'routes' | 'resources' > >
53+ interface Metadata {
54+ blueprint : Pick < Blueprint , 'routes' | 'resources' >
55+ pathMetadata : unknown
56+ }
5457
5558export const report = (
5659 files : Metalsmith . Files ,
5760 metalsmith : Metalsmith ,
5861) : void => {
59- const metadata = {
60- title : '' ,
61- routes : [ ] ,
62- resources : { } ,
63- ...( metalsmith . metadata ( ) as Metadata ) ,
64- }
62+ const metadata = metalsmith . metadata ( ) as Metadata
6563
6664 const reportData = generateReport ( metadata )
6765
@@ -70,9 +68,15 @@ export const report = (
7068 layout : 'report.hbs' ,
7169 ...reportData ,
7270 }
71+
72+ files [ 'api/_blueprint.json' ] = {
73+ contents : Buffer . from ( JSON . stringify ( metadata . blueprint , null , 2 ) ) ,
74+ layout : 'default.hbs' ,
75+ }
7376}
7477
7578function generateReport ( metadata : Metadata ) : Report {
79+ const { blueprint } = metadata
7680 const report : Report = {
7781 undocumented : createEmptyReportSection ( ) ,
7882 noDescription : { ...createEmptyReportSection ( ) , resources : [ ] } ,
@@ -87,12 +91,12 @@ function generateReport(metadata: Metadata): Report {
8791 } ,
8892 }
8993
90- const resources = metadata . resources ?? { }
94+ const resources = blueprint . resources ?? { }
9195 for ( const [ resourceName , resource ] of Object . entries ( resources ) ) {
9296 processResource ( resourceName , resource , report )
9397 }
9498
95- const routes = metadata . routes ?? [ ]
99+ const routes = blueprint . routes ?? [ ]
96100 for ( const route of routes ) {
97101 processRoute ( route , report , metadata )
98102 }
0 commit comments