@@ -135,8 +135,8 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
135
135
const parentTypes = new Set < string > ( )
136
136
for ( const type of apiModel . types ) {
137
137
if ( type . kind === 'request' || type . kind === 'interface' ) {
138
- for ( const parent of ( type . implements ?? [ ] ) . concat ( type . inherits ?? [ ] ) ) {
139
- parentTypes . add ( fqn ( parent . type ) )
138
+ if ( type . inherits != null ) {
139
+ parentTypes . add ( fqn ( type . inherits . type ) )
140
140
}
141
141
}
142
142
}
@@ -380,7 +380,6 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
380
380
const openGenerics = openGenericSet ( typeDef )
381
381
382
382
validateInherits ( typeDef . inherits , openGenerics )
383
- validateImplements ( typeDef . implements , openGenerics )
384
383
validateBehaviors ( typeDef , openGenerics )
385
384
386
385
// Note: we validate codegen_name/name uniqueness independently in the path, query and body as there are some
@@ -495,7 +494,6 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
495
494
if ( typeDef . inherits != null ) {
496
495
addInherits ( typeDef . inherits )
497
496
}
498
- typeDef . implements ?. forEach ( addInherits )
499
497
typeDef . behaviors ?. forEach ( addInherits )
500
498
}
501
499
@@ -505,7 +503,6 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
505
503
function validateInterface ( typeDef : model . Interface ) : void {
506
504
const openGenerics = openGenericSet ( typeDef )
507
505
508
- validateImplements ( typeDef . implements , openGenerics )
509
506
validateInherits ( typeDef . inherits , openGenerics )
510
507
validateBehaviors ( typeDef , openGenerics )
511
508
validateProperties ( typeDef . properties , openGenerics , inheritedProperties ( typeDef ) )
@@ -628,16 +625,6 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
628
625
context . pop ( )
629
626
}
630
627
631
- function validateImplements ( parents : ( model . Inherits [ ] | undefined ) , openGenerics : Set < string > ) : void {
632
- if ( parents == null || parents . length === 0 ) return
633
-
634
- context . push ( 'Implements' )
635
- for ( const parent of parents ) {
636
- validateTypeRef ( parent . type , parent . generics , openGenerics )
637
- }
638
- context . pop ( )
639
- }
640
-
641
628
function validateBehaviors ( typeDef : model . Request | model . Response | model . Interface , openGenerics : Set < string > ) : void {
642
629
if ( typeDef . kind !== 'response' && typeDef . behaviors != null && typeDef . behaviors . length > 0 ) {
643
630
context . push ( 'Behaviors' )
@@ -673,11 +660,10 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
673
660
}
674
661
675
662
// Does a parent have this behavior?
676
- const parents = ( type . implements ?? [ ] ) . concat ( type . inherits ?? [ ] )
677
- for ( const parent of parents ) {
678
- const parentDef = getTypeDef ( parent . type )
663
+ if ( type . inherits != null ) {
664
+ const parentDef = getTypeDef ( type . inherits . type )
679
665
if ( parentDef == null ) {
680
- modelError ( `No type definition for parent '${ fqn ( parent . type ) } '` )
666
+ modelError ( `No type definition for parent '${ fqn ( type . inherits . type ) } '` )
681
667
return false
682
668
}
683
669
if ( parentDef . kind === 'request' || parentDef . kind === 'interface' ) {
0 commit comments