XML examples are not rendered in OpenAPI Spec
Opened this issue · 1 comments
I loaded the OpenAPI Spec into the Swagger Editor https://editor.swagger.io (while documenting #172) . The XML examples of the responses are not rendered, Swagger Editor displays an error
<?xml version="1.0" encoding="UTF-8"?>
<!-- XML example cannot be generated; root element name is undefined -->
This also affects Swagger UI, e.g. https://dracor.org/doc/api#/public/play-tei
![Bildschirmfoto 2024-04-17 um 11 03 41](https://private-user-images.githubusercontent.com/12182347/323154073-8fbd68d2-0d03-4903-8536-5d6bc3e35368.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAxMTcyNjksIm5iZiI6MTcyMDExNjk2OSwicGF0aCI6Ii8xMjE4MjM0Ny8zMjMxNTQwNzMtOGZiZDY4ZDItMGQwMy00OTAzLTg1MzYtNWQ2YmMzZTM1MzY4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzA0VDE4MTYwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUyYWUxNGYzNmE5NTdlNjU3NWJkYzU4Y2QzNjRlNmFlNmYxYjFkZTk0ZGVhZjc4NDRjMWViY2NmMDMxNTgyNTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.W9pVS7xQHYC7VJOJ33C0Bbj4ZovrYFXlRV5YfgQljig)
I think the problem is that we don't define a schema for the response.
For the example endpoint and response (/corpora/{corpusname}/plays/{playname}/tei
) we don't actually provide a literal XML. But for /corpora/{corpusname}/plays/{playname}/relations/gexf we actually do and if I'm not completely mistaken this used to render just fine in the past. (Maybe it broke when upgrading Swagger UI in dracor-org/dracor-frontend@7af2edc)
Anyway, the OpenAPI documentation on how to specify XML responses at https://swagger.io/docs/specification/data-models/representing-xml/ seems to require a JSON schema. Which would seem to be quite challenge to come up with for TEI and other complex XML vocabularies. Is there a way to reference other existing schemas?