@Josefine Karlsson Thank you for your response. You can import API with schema definition in the APIM instance and add multiple examples as per OpenAPI specification. Both examples and schemas for XML payloads are displayed in the developer portal (refer Added basic XSD schema support).
Here is the sample that I created:
The schema used in the validation of policy is for runtime validation and unfortunately, we cannot reference it in the definition (has to be specified manually or automatically generated during the import like I tested above). However, by default, validate-content policy does use schema attached to API. Which means you can add validation content policy without specifying schema id that would pick default schema in the definition (refer sample request and response)
Sample
Request:
Response:
This is great feedback and would be nice to have such feature. I passed on the feedback to our product team internally. Also, I would recommend you posting it in https://aka.ms/apimwish so that others can upvote it too. I hope this answers your question and feel free to add if you have any questions. I would be happy to assist you.
Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community.
Hi!
Thanks for commenting! I have looked into this and it does not really fit my needs: I have a quite complex XML schema and one example file does not really cover all cases. Also, if the schema changes, I need to update both the schema and the example object. It would be nice to have the schema itself displayed in the developer portal so the users know what they can expect from the API validation. I hope that this will be included in the future.