@@ -1894,6 +1894,75 @@ describe('api-publisher', () => {
18941894 expect ( totalTasks ) . toBe ( 1 ) ;
18951895 } ) ;
18961896
1897+ it ( 'should skip WSDL-importer-generated XSD schemas (GUID names) on WSDL import' , async ( ) => {
1898+ const client = createMockClient ( ) ;
1899+ // GUID name is not caught by isAutoGeneratedId (24-hex only), but the
1900+ // WSDL importer recreates XSD schemas, so re-PUTs must be excluded.
1901+ const xsdSchema = {
1902+ type : ResourceType . ApiSchema ,
1903+ nameParts : [ 'soap-api' , '4b6fe4d6-dbad-4db0-a6d6-58958e74850d' ] ,
1904+ } ;
1905+ const store = createMockStore ( [ xsdSchema ] ) ;
1906+ store . readResource . mockImplementation ( async ( _dir : string , descriptor : ResourceDescriptor ) => {
1907+ if ( descriptor . type === ResourceType . Api ) {
1908+ return { name : 'soap-api' , properties : { path : 'soap' , type : 'soap' } } ;
1909+ }
1910+ if ( descriptor . type === ResourceType . ApiSchema ) {
1911+ return {
1912+ name : descriptor . nameParts [ 1 ] ,
1913+ properties : { contentType : 'application/vnd.ms-azure-apim.xsd+xml' , document : { value : '<xsd:schema/>' } } ,
1914+ } ;
1915+ }
1916+ return null ;
1917+ } ) ;
1918+ store . readContent . mockResolvedValue ( {
1919+ content : '<wsdl:definitions>...</wsdl:definitions>' ,
1920+ format : 'wsdl' ,
1921+ } ) ;
1922+
1923+ const apiDescriptor : ResourceDescriptor = { type : ResourceType . Api , nameParts : [ 'soap-api' ] } ;
1924+ await publishApi ( client , store , testContext , apiDescriptor , testConfig ) ;
1925+
1926+ const totalTasks = mockRunParallel . mock . calls . reduce ( ( sum , call ) => {
1927+ const tasks = call [ 0 ] as unknown [ ] ;
1928+ return sum + tasks . length ;
1929+ } , 0 ) ;
1930+ expect ( totalTasks ) . toBe ( 0 ) ;
1931+ } ) ;
1932+
1933+ it ( 'should retain GUID-named XSD schemas for non-WSDL spec imports' , async ( ) => {
1934+ const client = createMockClient ( ) ;
1935+ // OpenAPI import does not recreate XSD schemas, so the exclusion must
1936+ // apply only when the imported spec format is wsdl.
1937+ const xsdSchema = {
1938+ type : ResourceType . ApiSchema ,
1939+ nameParts : [ 'rest-api' , '4b6fe4d6-dbad-4db0-a6d6-58958e74850d' ] ,
1940+ } ;
1941+ const store = createMockStore ( [ xsdSchema ] ) ;
1942+ store . readResource . mockImplementation ( async ( _dir : string , descriptor : ResourceDescriptor ) => {
1943+ if ( descriptor . type === ResourceType . Api ) {
1944+ return { name : 'rest-api' , properties : { path : 'rest' } } ;
1945+ }
1946+ if ( descriptor . type === ResourceType . ApiSchema ) {
1947+ return {
1948+ name : descriptor . nameParts [ 1 ] ,
1949+ properties : { contentType : 'application/vnd.ms-azure-apim.xsd+xml' , document : { value : '<xsd:schema/>' } } ,
1950+ } ;
1951+ }
1952+ return null ;
1953+ } ) ;
1954+ store . readContent . mockResolvedValue ( { content : 'openapi: "3.0.0"' , format : 'yaml' } ) ;
1955+
1956+ const apiDescriptor : ResourceDescriptor = { type : ResourceType . Api , nameParts : [ 'rest-api' ] } ;
1957+ await publishApi ( client , store , testContext , apiDescriptor , testConfig ) ;
1958+
1959+ const totalTasks = mockRunParallel . mock . calls . reduce ( ( sum , call ) => {
1960+ const tasks = call [ 0 ] as unknown [ ] ;
1961+ return sum + tasks . length ;
1962+ } , 0 ) ;
1963+ expect ( totalTasks ) . toBe ( 1 ) ;
1964+ } ) ;
1965+
18971966 it ( 'should skip 13-digit portal schema when the imported spec recreates its components' , async ( ) => {
18981967 const client = createMockClient ( ) ;
18991968 // The portal assigns Date.now()-style schema IDs; when the imported spec
0 commit comments