@@ -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 ) )
@@ -694,16 +691,6 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
694
691
context . pop ( )
695
692
}
696
693
697
- function validateImplements ( parents : ( model . Inherits [ ] | undefined ) , openGenerics : Set < string > ) : void {
698
- if ( parents == null || parents . length === 0 ) return
699
-
700
- context . push ( 'Implements' )
701
- for ( const parent of parents ) {
702
- validateTypeRef ( parent . type , parent . generics , openGenerics )
703
- }
704
- context . pop ( )
705
- }
706
-
707
694
function validateBehaviors ( typeDef : model . Request | model . Response | model . Interface , openGenerics : Set < string > ) : void {
708
695
if ( typeDef . kind !== 'response' && typeDef . behaviors != null && typeDef . behaviors . length > 0 ) {
709
696
context . push ( 'Behaviors' )
@@ -746,11 +733,10 @@ export default async function validateModel (apiModel: model.Model, restSpec: Ma
746
733
}
747
734
748
735
// Does a parent have this behavior?
749
- const parents = ( type . implements ?? [ ] ) . concat ( type . inherits ?? [ ] )
750
- for ( const parent of parents ) {
751
- const parentDef = getTypeDef ( parent . type )
736
+ if ( type . inherits != null ) {
737
+ const parentDef = getTypeDef ( type . inherits . type )
752
738
if ( parentDef == null ) {
753
- modelError ( `No type definition for parent '${ fqn ( parent . type ) } '` )
739
+ modelError ( `No type definition for parent '${ fqn ( type . inherits . type ) } '` )
754
740
return false
755
741
}
756
742
if ( parentDef . kind === 'request' || parentDef . kind === 'interface' ) {
0 commit comments