api-management-schema-import
api-management-schema-import copied to clipboard
Enhance WsdlDocument handling on includes and add example WSDL/XSD files
Purpose
When trying to process a WSDL with includes, if any include defines a xmlns:xsd attribute, it will fail with a key error, since dotnet XSL parser always adds an xmlns:xs attribute and the ToDictionary will have a key clash.
This PR will make it so that you can have multiple times the same namespace when doing includes. Which is correct, since the included namespace could use an existing namespace on a different property.
Enhancements to Namespace Handling:
ApiManagementSchemaImport/Microsoft.Azure.ApiManagement.WsdlProcessor.Common/WsdlDocument.cs: Improved theAddXmlnsAndChangePrefixReferencedmethod by capturing all declaredxmlnsattributes and using a composite key for the namespace dictionary to handle potential conflicts.
Addition of New Schema and WSDL Files:
examples/includeExample/additional.xsd: Added a new schema file defining anAdditionalElementof typexsd:string.examples/includeExample/common.xsd: Added a new schema file defining aCommonElementof typexsd:string.examples/includeExample/example.wsdl: Added a new WSDL file defining a web service with operations, bindings, and messages.examples/includeExample/schema1.xsd: Added a new schema file with an importedcommon.xsdand defined a complex typeExampleTypewith anexampleField.examples/includeExample/schema2.xsd: Added a new schema file with an importedcommon.xsd, includedadditional.xsd, and defined a complex typeExampleTypewith anexampleField.
Does this introduce a breaking change?
[ ] Yes
[x] No
Pull Request Type
What kind of change does this Pull Request introduce?
[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:
How to Test
- Get the code
- Test it on the new includeExample
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install