Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no proper validation of XML exemple #346

Open
LasneF opened this issue Sep 20, 2023 · 0 comments
Open

no proper validation of XML exemple #346

LasneF opened this issue Sep 20, 2023 · 0 comments

Comments

@LasneF
Copy link

LasneF commented Sep 20, 2023

given an API Spec with a return content type set to application/xml it raise an error stating that example must be an object

Example for application/xml is not valid: expected object, but got string

i tried also the sample provided there https://swagger.io/docs/specification/data-models/representing-xml/ with no success as well

more details about how XML works here
https://spec.openapis.org/oas/latest.html#xml-modeling
https://spec.openapis.org/oas/latest.html#xml-object

NB : that the file looks correct according to editor.swagger.io
NB2 : reproducible if droping the xml part
NB3 : can be tricky or a mistake from myself not 100 % sure, as redocly linter fails as well.

sample to reproduce

{
    "openapi": "3.0.0",
    "info": {
        "title": "Kitten",
        "version": "1.0.0"
    },
    "paths": {
        "/pet": {
            "get": {
                "responses": {
                    "200": {
                        "description": "cat",
                        "content": {
                            "application/xml": {
                                "schema": {
                                    "$ref": "#/components/schemas/niceCatResult"
                                },
                                "example": "<Cat><nice>true</nice></Cat>"
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "niceCatResult": {
                "type": "object",
                "properties": {
                    "nice" : {
                        "type": "string"
                    }
                },
                "xml": {
                    "name": "Cat"
                }
            }
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants