@@ -21,7 +21,7 @@ export class VendorExtensionProcessor {
2121
2222 /**
2323 * Process the spec by pruning anything marked with x-protobuf-excluded
24- * and applying vendor extensions (x-protobuf-name, x-protobuf-type)
24+ * and applying vendor extensions (x-protobuf-name, x-protobuf-data- type)
2525 */
2626 public process ( ) : OpenAPIV3 . Document {
2727 deleteMatchingKeys ( this . root , ( item : any ) => this . hasProtobufExcluded ( item ) ) ;
@@ -130,39 +130,25 @@ export class VendorExtensionProcessor {
130130 }
131131
132132 /**
133- * Apply type override to a schema if it has x- protobuf- type
133+ * Apply type override to simplify complex schemas to a single protobuf type.
134134 */
135135 private applyTypeOverride ( schema : any ) : void {
136136 if ( ! schema ) return ;
137137
138138 if ( VendorExtensionProcessor . PROTOBUF_TYPE_EXTENSION in schema ) {
139139 const protoType = schema [ VendorExtensionProcessor . PROTOBUF_TYPE_EXTENSION ] ;
140140
141- // Clear structural properties that might conflict
142- if ( '$ref' in schema ) {
143- delete schema . $ref ;
144- }
145- if ( 'properties' in schema ) {
146- delete schema . properties ;
147- }
148- if ( 'additionalProperties' in schema ) {
149- delete schema . additionalProperties ;
150- }
151- if ( 'oneOf' in schema ) {
152- delete schema . oneOf ;
153- }
154- if ( 'anyOf' in schema ) {
155- delete schema . anyOf ;
156- }
157- if ( 'allOf' in schema ) {
158- delete schema . allOf ;
159- }
141+ // Clear structural properties that conflict with simple type
142+ delete schema . $ref ;
143+ delete schema . properties ;
144+ delete schema . additionalProperties ;
145+ delete schema . oneOf ;
146+ delete schema . anyOf ;
147+ delete schema . allOf ;
160148
161- // Directly use the x-protobuf-type value as the OpenAPI type
149+ // Set type to x-protobuf-type value (preserves x-protobuf-type for template)
162150 schema . type = protoType ;
163-
164- delete schema [ VendorExtensionProcessor . PROTOBUF_TYPE_EXTENSION ] ;
165- logger . info ( `Applied ${ VendorExtensionProcessor . PROTOBUF_TYPE_EXTENSION } : ${ protoType } -> type: ${ schema . type } ` ) ;
151+ logger . info ( `Applied ${ VendorExtensionProcessor . PROTOBUF_TYPE_EXTENSION } : ${ protoType } -> simplified to type: ${ schema . type } ` ) ;
166152 }
167153 }
168154
0 commit comments