11import { validate , sortSpectralIssueBySeverity , convertSpectralDiagnosticToValidationOutputs , convertJsonSchemaIssuesToValidationOutputs , stripRefs , exitBasedOffOfValidationOutcome , extractChoicesFromArchitecture } from './validate' ;
2- import { readFileSync } from 'fs' ;
3- import path from 'path' ;
42import { ISpectralDiagnostic } from '@stoplight/spectral-core' ;
53import { ValidationOutcome , ValidationOutput } from './validation.output' ;
64import { ErrorObject } from 'ajv' ;
@@ -196,7 +194,7 @@ describe('validation support functions', () => {
196194 const given : ErrorObject [ ] = [
197195 {
198196 'instancePath' : '/nodes/0/interfaces/0/port' ,
199- 'schemaPath' : 'https://calm.finos.org/draft/2024-10 /meta/interface.json#/defs/host-port-interface/properties/port/type' ,
197+ 'schemaPath' : 'https://calm.finos.org/release/1.0 /meta/interface.json#/defs/host-port-interface/properties/port/type' ,
200198 'keyword' : 'type' ,
201199 'params' : {
202200 'type' : 'integer'
@@ -211,7 +209,7 @@ describe('validation support functions', () => {
211209 'error' ,
212210 'must be integer' ,
213211 '/nodes/0/interfaces/0/port' ,
214- 'https://calm.finos.org/draft/2024-10 /meta/interface.json#/defs/host-port-interface/properties/port/type'
212+ 'https://calm.finos.org/release/1.0 /meta/interface.json#/defs/host-port-interface/properties/port/type'
215213 )
216214 ] ;
217215
@@ -553,42 +551,6 @@ describe('validate - architecture only', () => {
553551 expect ( response . allValidationOutputs ( ) ) . not . toBeNull ( ) ;
554552 expect ( response . allValidationOutputs ( ) . length ) . toBe ( 0 ) ;
555553 } ) ;
556-
557- it ( 'validates architecture against schema specified in $schema property when no pattern provided' , async ( ) => {
558- const expectedSpectralOutput : ISpectralDiagnostic [ ] = [ ] ;
559- mocks . spectralRun . mockReturnValue ( expectedSpectralOutput ) ;
560-
561- // Create a simple valid architecture with a CALM schema reference
562- const validArchitecture = {
563- '$schema' : 'https://raw.githubusercontent.com/finos/architecture-as-code/main/calm/draft/2024-03/meta/calm.json' ,
564- 'nodes' : [
565- {
566- 'unique-id' : 'test-node' ,
567- 'node-type' : 'system' ,
568- 'name' : 'Test Node' ,
569- 'description' : 'A test node'
570- }
571- ] ,
572- 'relationships' : [ ]
573- } ;
574-
575- const calmSchema = readFileSync ( path . resolve ( __dirname , '../../../test_fixtures/calm/calm.json' ) , 'utf8' ) ;
576- const coreSchema = readFileSync ( path . resolve ( __dirname , '../../../test_fixtures/calm/core.json' ) , 'utf8' ) ;
577- schemaDirectory . getSchema = vi . fn ( ( id : string ) => {
578- if ( id . includes ( 'calm.json' ) ) return JSON . parse ( calmSchema ) ;
579- if ( id . includes ( 'core.json' ) ) return JSON . parse ( coreSchema ) ;
580- return undefined ;
581- } ) ;
582-
583- const response = await validate ( validArchitecture , undefined , schemaDirectory , false ) ;
584-
585- expect ( response ) . not . toBeNull ( ) ;
586- expect ( response ) . not . toBeUndefined ( ) ;
587-
588- // For a valid architecture, we should not have errors
589- expect ( response . hasErrors ) . toBeFalsy ( ) ;
590- expect ( response . hasWarnings ) . toBeFalsy ( ) ;
591- } ) ;
592554} ) ;
593555
594556function buildISpectralDiagnostic ( code : string , message : string , severity : number ) : ISpectralDiagnostic {
0 commit comments