@@ -4,24 +4,24 @@ const fs = require('fs')
44const path = require ( 'path' )
55
66// Post-test script to validate generated models against schema definitions
7- // Compares models in final-output .json with generated TypeScript and Java models
7+ // Compares models in complete-schema .json with generated TypeScript and Java models
88// Usage: node post-test.js [--verbose]
99
1010// Parse command line arguments
1111const args = process . argv . slice ( 2 )
1212const verbose = args . includes ( '--verbose' ) || args . includes ( '-v' )
1313
1414// File paths
15- const finalOutputPath = path . join ( __dirname , '../schema/final-output .json' )
15+ const completeSchemaPath = path . join ( __dirname , '../schema/complete-schema .json' )
1616const typescriptModelsPath = path . join ( __dirname , '../generated/typescript/src/models/index.ts' )
1717const javaModelsDir = path . join ( __dirname , '../generated/java/src/main/java/org/openapitools/client/model' )
1818const openapiConfigPath = path . join ( __dirname , '../openapitools.json' )
1919
2020console . log ( 'Starting model validation...\n' )
2121
22- // Check if final-output .json exists
23- if ( ! fs . existsSync ( finalOutputPath ) ) {
24- console . error ( 'Error: final-output .json not found in schema directory' )
22+ // Check if complete-schema .json exists
23+ if ( ! fs . existsSync ( completeSchemaPath ) ) {
24+ console . error ( 'Error: complete-schema .json not found in schema directory' )
2525 console . error ( ' Run "npm run generate-schema" first to create the schema file' )
2626 process . exit ( 1 )
2727}
@@ -49,21 +49,21 @@ try {
4949 console . warn ( 'Warning: Could not read OpenAPI configuration:' , error . message )
5050}
5151
52- // Load and parse final-output .json
52+ // Load and parse complete-schema .json
5353let schemaModels = new Set ( )
5454try {
55- const finalOutput = JSON . parse ( fs . readFileSync ( finalOutputPath , 'utf8' ) )
55+ const completeSchema = JSON . parse ( fs . readFileSync ( completeSchemaPath , 'utf8' ) )
5656
57- if ( ! finalOutput . components || ! finalOutput . components . schemas ) {
58- console . error ( 'Error: Invalid OpenAPI structure in final-output .json' )
57+ if ( ! completeSchema . components || ! completeSchema . components . schemas ) {
58+ console . error ( 'Error: Invalid OpenAPI structure in complete-schema .json' )
5959 console . error ( ' Missing components.schemas section' )
6060 process . exit ( 1 )
6161 }
6262
63- schemaModels = new Set ( Object . keys ( finalOutput . components . schemas ) )
63+ schemaModels = new Set ( Object . keys ( completeSchema . components . schemas ) )
6464 console . log ( `Found ${ schemaModels . size } models in schema\n` )
6565} catch ( error ) {
66- console . error ( 'Error parsing final-output .json:' , error . message )
66+ console . error ( 'Error parsing complete-schema .json:' , error . message )
6767 process . exit ( 1 )
6868}
6969
0 commit comments